Skip to main content

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:

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 py313

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

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pkgcheck-0.10.42.tar.gz (422.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pkgcheck-0.10.42-py3-none-any.whl (202.1 kB view details)

Uploaded Python 3

File details

Details for the file pkgcheck-0.10.42.tar.gz.

File metadata

  • Download URL: pkgcheck-0.10.42.tar.gz
  • Upload date:
  • Size: 422.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pkgcheck-0.10.42.tar.gz
Algorithm Hash digest
SHA256 5e1a83ab1f7fdc2c7f300ff6db0c7cb30925302445f6d6756226d52580af3d00
MD5 605062fb4c35e9aa5b1447bd08a79800
BLAKE2b-256 5098494ab74235024cdd448bc20253f579b70ab8114d575ada2f544d94071a0d

See more details on using hashes here.

Provenance

The following attestation bundles were made for pkgcheck-0.10.42.tar.gz:

Publisher: release.yml on pkgcore/pkgcheck

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pkgcheck-0.10.42-py3-none-any.whl.

File metadata

  • Download URL: pkgcheck-0.10.42-py3-none-any.whl
  • Upload date:
  • Size: 202.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pkgcheck-0.10.42-py3-none-any.whl
Algorithm Hash digest
SHA256 590c5028845a56623a7ea746cc1eda9c990637af98ea465bfa51a3f4ab2fce41
MD5 323b7bfd5f3ce7266879b88f05e06874
BLAKE2b-256 f4bab3297121756eeac3cdd29c4e58ee0867504762b68eca0102b4ae18e00380

See more details on using hashes here.

Provenance

The following attestation bundles were made for pkgcheck-0.10.42-py3-none-any.whl:

Publisher: release.yml on pkgcore/pkgcheck

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

0.10.42 This release

2 files

0.10.41

2 files

0.10.40

2 files

0.10.39

2 files

0.10.38

2 files

0.10.37

2 files

0.10.36

2 files

0.10.35

2 files

0.10.34

2 files

0.10.33

2 files

0.10.32

2 files

0.10.31

2 files

0.10.30

2 files

0.10.29

2 files

0.10.28

5 files

0.10.27

5 files

0.10.26

9 files

0.10.25

9 files

0.10.24

9 files

0.10.23

9 files

0.10.22

9 files

0.10.21

9 files

0.10.20

9 files

0.10.19

9 files

0.10.18

7 files

0.10.17

9 files

0.10.16

9 files

0.10.15

9 files

0.10.14

9 files

0.10.13

9 files

0.10.12

3 files

0.10.11

3 files

0.10.10

3 files

0.10.9

3 files

0.10.8

3 files

0.10.7

3 files

0.10.6

3 files

0.10.5

3 files

0.10.4

3 files

0.10.3

3 files

0.10.2

3 files

0.10.1

3 files

0.10.0

3 files

0.9.7

5 files

0.9.6

5 files

0.9.5

1 file

0.9.4

2 files

0.9.3

2 files

0.9.2

2 files

0.9.1

2 files

0.9.0

2 files

0.8.2

2 files

0.8.1

2 files

0.8.0

2 files

0.7.9

2 files

0.7.8

2 files

0.7.7

2 files

0.7.6

2 files

0.7.5

2 files

0.7.4

2 files

0.7.3

2 files

0.7.2

2 files

0.7.1

2 files

0.7.0

2 files

0.6.9

2 files

0.6.8

2 files

0.6.7

2 files

0.6.6

2 files

0.6.5

2 files

0.6.4

2 files

0.6.3

2 files

0.6.2

2 files

0.6.1

2 files

0.6.0

2 files

0.5.4

3 files

0.5.3

1 file

0.5.2

1 file

0.5.1

1 file

0.5

1 file

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page