pkgcheck


Namepkgcheck JSON
Version 0.10.32 PyPI version JSON
download
home_pageNone
Summarypkgcore-based QA utility for ebuild repos
upload_time2024-11-23 10:48:50
maintainerNone
docs_urlNone
authorMarien Zwart
requires_python~=3.10
licenseNone
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage
            |pypi| |test| |coverage|

========
pkgcheck
========

Dependencies
============

pkgcheck is developed alongside pkgcore_ and snakeoil_. Running pkgcheck from
git will often require both pkgcore and snakeoil from git as well.

For releases, see the required runtime dependencies_.

There are also several optional runtime dependencies that add or extend check
support in various ways if found on the host system including the following:

- git_: supports historical queries for git-based repos and commit-related checks
- requests_: supports various network-related checks
- Gentoo-PerlMod-Version_: supports Perl package version checks
- tree-sitter-bash_: used in checks that inspect the CST of ebuilds and
  eclasess. Must be language version >= 14.

Installing
==========

Installing latest pypi release::

    pip install pkgcheck

Installing from git::

    pip install https://github.com/pkgcore/pkgcheck/archive/master.tar.gz

Installing from a tarball::

    python setup.py install

Usage
=====

Most users will use pkgcheck on the command line via ``pkgcheck scan`` to
target ebuild repos. See the docs_ or the man page for more information on
running pkgcheck.

It's also possible to run pkgcheck natively from python. For example, to output
the results for a given ebuild repo:

.. code-block:: python

    from pkgcheck import scan

    for result in scan(['/path/to/ebuild/repo']):
        print(result)

This allows third party tools written in python to leverage pkgcheck's scanning
functionality for purposes such as CI or VCS commit support.

Tests
=====

Normal pytest is used, just execute::

    pytest

In addition, a tox config is provided so the testsuite can be run in a
virtualenv setup against all supported python versions. To run tests for all
environments just execute **tox** in the root directory of a repo or unpacked
tarball. Otherwise, for a specific python version execute something similar to
the following::

    tox -e py311

Adding new checks
=================

Adding a new check consists of 2 main parts: writing the logic and
documentation, and adding tests for the check.

Writing the logic
-----------------

1. Select the best file for the check under ``src/pkgcheck/checks/``.

2. Create new classes for the results:

   - You would need to select the correct result level (style, info, warning,
     error) - you might want to consult QA team.

   - You would need to select the correct context: category, package, version,
     profile, etc.

   - Add long user friendly documentation for the result.

   - Implement the ``desc`` property which is printed to the user.

3. Create a new class for the check:

   - Add long user friendly documentation for the result.

   - Put the source of input for the check. This is hard, so best case is to
     find similar check and copy the code.

   - Define the results it can return.

   - Implement the ``feed`` function.

Adding tests
------------

1. Select one of the repos under ``testdata/repos``. In most cases you would
   want ``standalone``.

2. Add the ebuild/category/test case you want to catch.

3. ``cd`` into this directory, and run ``pkgcheck scan --cache-dir /tmp -R JsonStream``.
   This should yield the results you want to catch (filter out what you expect).

4. Add the results to the test case under:
   ``testdata/data/repos/${REPO}/${CHECK CLASS}/${RESULT CLASS}/expected.json``

5. If you want to check the fix for the test case, ``git add`` the files under
   ``testdata/repos/${REPO}``, modify to fix the results, and using
   ``git diff testdata/repos/${REPO}`` collect the diff.

6. Copy similar patch, add the diff to the patch file, and fix file names, under:
   ``testdata/data/repos/${REPO}/${CHECK CLASS}/${RESULT CLASS}/fix.patch``


.. _pkgcore: https://github.com/pkgcore/pkgcore
.. _snakeoil: https://github.com/pkgcore/snakeoil
.. _dependencies: https://github.com/pkgcore/pkgcheck/blob/master/requirements/install.txt
.. _git: https://git-scm.com/
.. _requests: https://pypi.org/project/requests/
.. _Gentoo-PerlMod-version: https://metacpan.org/release/Gentoo-PerlMod-Version
.. _tree-sitter-bash: https://github.com/tree-sitter/tree-sitter-bash
.. _docs: https://pkgcore.github.io/pkgcheck/man/pkgcheck.html

.. |pypi| image:: https://img.shields.io/pypi/v/pkgcheck.svg
    :target: https://pypi.python.org/pypi/pkgcheck
.. |test| image:: https://github.com/pkgcore/pkgcheck/workflows/test/badge.svg
    :target: https://github.com/pkgcore/pkgcheck/actions?query=workflow%3A%22test%22
.. |coverage| image:: https://codecov.io/gh/pkgcore/pkgcheck/branch/master/graph/badge.svg
    :target: https://codecov.io/gh/pkgcore/pkgcheck


            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "pkgcheck",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "~=3.10",
    "maintainer_email": "Arthur Zamarin <arthurzam@gentoo.org>",
    "keywords": null,
    "author": "Marien Zwart",
    "author_email": "Micha\u0142 G\u00f3rny <mgorny@gentoo.org>, Tim Harder <radhermit@gmail.com>, Brian Harring <ferringb@gmail.com>, Arthur Zamarin <arthurzam@gentoo.org>",
    "download_url": "https://files.pythonhosted.org/packages/4d/b0/d54a8b92382db9f890195cce73e52fe9cd3b5a0b001ae01a1783b4fe7e52/pkgcheck-0.10.32.tar.gz",
    "platform": null,
    "description": "|pypi| |test| |coverage|\n\n========\npkgcheck\n========\n\nDependencies\n============\n\npkgcheck is developed alongside pkgcore_ and snakeoil_. Running pkgcheck from\ngit will often require both pkgcore and snakeoil from git as well.\n\nFor releases, see the required runtime dependencies_.\n\nThere are also several optional runtime dependencies that add or extend check\nsupport in various ways if found on the host system including the following:\n\n- git_: supports historical queries for git-based repos and commit-related checks\n- requests_: supports various network-related checks\n- Gentoo-PerlMod-Version_: supports Perl package version checks\n- tree-sitter-bash_: used in checks that inspect the CST of ebuilds and\n  eclasess. Must be language version >= 14.\n\nInstalling\n==========\n\nInstalling latest pypi release::\n\n    pip install pkgcheck\n\nInstalling from git::\n\n    pip install https://github.com/pkgcore/pkgcheck/archive/master.tar.gz\n\nInstalling from a tarball::\n\n    python setup.py install\n\nUsage\n=====\n\nMost users will use pkgcheck on the command line via ``pkgcheck scan`` to\ntarget ebuild repos. See the docs_ or the man page for more information on\nrunning pkgcheck.\n\nIt's also possible to run pkgcheck natively from python. For example, to output\nthe results for a given ebuild repo:\n\n.. code-block:: python\n\n    from pkgcheck import scan\n\n    for result in scan(['/path/to/ebuild/repo']):\n        print(result)\n\nThis allows third party tools written in python to leverage pkgcheck's scanning\nfunctionality for purposes such as CI or VCS commit support.\n\nTests\n=====\n\nNormal pytest is used, just execute::\n\n    pytest\n\nIn addition, a tox config is provided so the testsuite can be run in a\nvirtualenv setup against all supported python versions. To run tests for all\nenvironments just execute **tox** in the root directory of a repo or unpacked\ntarball. Otherwise, for a specific python version execute something similar to\nthe following::\n\n    tox -e py311\n\nAdding new checks\n=================\n\nAdding a new check consists of 2 main parts: writing the logic and\ndocumentation, and adding tests for the check.\n\nWriting the logic\n-----------------\n\n1. Select the best file for the check under ``src/pkgcheck/checks/``.\n\n2. Create new classes for the results:\n\n   - You would need to select the correct result level (style, info, warning,\n     error) - you might want to consult QA team.\n\n   - You would need to select the correct context: category, package, version,\n     profile, etc.\n\n   - Add long user friendly documentation for the result.\n\n   - Implement the ``desc`` property which is printed to the user.\n\n3. Create a new class for the check:\n\n   - Add long user friendly documentation for the result.\n\n   - Put the source of input for the check. This is hard, so best case is to\n     find similar check and copy the code.\n\n   - Define the results it can return.\n\n   - Implement the ``feed`` function.\n\nAdding tests\n------------\n\n1. Select one of the repos under ``testdata/repos``. In most cases you would\n   want ``standalone``.\n\n2. Add the ebuild/category/test case you want to catch.\n\n3. ``cd`` into this directory, and run ``pkgcheck scan --cache-dir /tmp -R JsonStream``.\n   This should yield the results you want to catch (filter out what you expect).\n\n4. Add the results to the test case under:\n   ``testdata/data/repos/${REPO}/${CHECK CLASS}/${RESULT CLASS}/expected.json``\n\n5. If you want to check the fix for the test case, ``git add`` the files under\n   ``testdata/repos/${REPO}``, modify to fix the results, and using\n   ``git diff testdata/repos/${REPO}`` collect the diff.\n\n6. Copy similar patch, add the diff to the patch file, and fix file names, under:\n   ``testdata/data/repos/${REPO}/${CHECK CLASS}/${RESULT CLASS}/fix.patch``\n\n\n.. _pkgcore: https://github.com/pkgcore/pkgcore\n.. _snakeoil: https://github.com/pkgcore/snakeoil\n.. _dependencies: https://github.com/pkgcore/pkgcheck/blob/master/requirements/install.txt\n.. _git: https://git-scm.com/\n.. _requests: https://pypi.org/project/requests/\n.. _Gentoo-PerlMod-version: https://metacpan.org/release/Gentoo-PerlMod-Version\n.. _tree-sitter-bash: https://github.com/tree-sitter/tree-sitter-bash\n.. _docs: https://pkgcore.github.io/pkgcheck/man/pkgcheck.html\n\n.. |pypi| image:: https://img.shields.io/pypi/v/pkgcheck.svg\n    :target: https://pypi.python.org/pypi/pkgcheck\n.. |test| image:: https://github.com/pkgcore/pkgcheck/workflows/test/badge.svg\n    :target: https://github.com/pkgcore/pkgcheck/actions?query=workflow%3A%22test%22\n.. |coverage| image:: https://codecov.io/gh/pkgcore/pkgcheck/branch/master/graph/badge.svg\n    :target: https://codecov.io/gh/pkgcore/pkgcheck\n\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "pkgcore-based QA utility for ebuild repos",
    "version": "0.10.32",
    "project_urls": {
        "Documentation": "https://pkgcore.github.io/pkgcheck/",
        "Homepage": "https://github.com/pkgcore/pkgcheck",
        "Source": "https://github.com/pkgcore/pkgcheck"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "497db88fdc3a15b5d6f846614eb892d23c57c0201958ead601c157a95088f49d",
                "md5": "deb5a1d5e5b6142ff8d7e106d82fc70d",
                "sha256": "9c3046ac01687ae1f2fec131a42773b1f5ea5257e9bc303ec1a9d93b356d591a"
            },
            "downloads": -1,
            "filename": "pkgcheck-0.10.32-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "deb5a1d5e5b6142ff8d7e106d82fc70d",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "~=3.10",
            "size": 188952,
            "upload_time": "2024-11-23T10:48:48",
            "upload_time_iso_8601": "2024-11-23T10:48:48.144557Z",
            "url": "https://files.pythonhosted.org/packages/49/7d/b88fdc3a15b5d6f846614eb892d23c57c0201958ead601c157a95088f49d/pkgcheck-0.10.32-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "4db0d54a8b92382db9f890195cce73e52fe9cd3b5a0b001ae01a1783b4fe7e52",
                "md5": "281bc4421fcd75f953ef3d7d88ba0dfd",
                "sha256": "41557803fd7fcaf2a0ebcb91d037b0fdb82decd856359ac991afb101f575572e"
            },
            "downloads": -1,
            "filename": "pkgcheck-0.10.32.tar.gz",
            "has_sig": false,
            "md5_digest": "281bc4421fcd75f953ef3d7d88ba0dfd",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "~=3.10",
            "size": 380032,
            "upload_time": "2024-11-23T10:48:50",
            "upload_time_iso_8601": "2024-11-23T10:48:50.650467Z",
            "url": "https://files.pythonhosted.org/packages/4d/b0/d54a8b92382db9f890195cce73e52fe9cd3b5a0b001ae01a1783b4fe7e52/pkgcheck-0.10.32.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-11-23 10:48:50",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "pkgcore",
    "github_project": "pkgcheck",
    "travis_ci": false,
    "coveralls": true,
    "github_actions": true,
    "tox": true,
    "lcname": "pkgcheck"
}
        
Elapsed time: 0.36614s