Skip to main content

pydistcheck

conda-forge version conda-forge downloads PyPI Version PyPI downloads Documentation Status GitHub Actions GitHub Actions

What is pydistcheck?

pydistcheck is a command line interface (CLI) that you run on Python packages, which can:

  • detect common portability issues
  • print useful summaries of the package's contents

It's inspired by R's R CMD check.

Supported formats:

  • Python sdists
  • Python wheels
  • conda packages (both .conda and .tar.bz2)
  • any .tar.bz2, .tar.gz, or .zip archive

See "Check Reference" for a complete list of the types of issues pydistcheck can catch.

See "How to Test a Python Distribution" to learn how pydistcheck and similar tools like auditwheel, check-wheel-contents, and twine check fit into Python development workflows.

For more background on the value of such a tool, see the SciPy 2022 talk "Does that CSV Belong on PyPI? Probably Not" (video link).

Installation

Install with pip.

pip install pydistcheck

Or conda.

conda install -c conda-forge pydistcheck

For more details, see "Installation" (link).

Quickstart

Try it out on a package you like...

pip download \
  --no-deps \
  -d ./downloads \
  pyarrow

pydistcheck --inspect ./downloads/*.whl

... to see what it contains.

----- package inspection summary -----
file size
  * compressed size: 25.9M
  * uncompressed size: 94.0M
  * compression space saving: 72.4%
contents
  * directories: 0
  * files: 809 (30 compiled)
size by extension
  * .dylib - 73.2M (77.9%)
  * .so - 10.8M (11.4%)
  * .h - 4.5M (4.8%)
  * .py - 2.4M (2.5%)
  * .pyx - 0.8M (0.8%)
  * .pxi - 0.7M (0.8%)
  * .cc - 0.4M (0.5%)
  * .cmake - 0.4M (0.4%)
  * .pxd - 0.3M (0.3%)
  * .gz - 0.2M (0.2%)
  * .hpp - 0.1M (0.1%)
  * .txt - 0.1M (0.1%)
  * no-extension - 77.4K (0.1%)
  * .orc - 48.4K (0.1%)
  * .parquet - 14.0K (0.0%)
  * .sh - 7.8K (0.0%)
  * .md - 3.6K (0.0%)
  * .yml - 1.5K (0.0%)
  * .ubuntu - 1.3K (0.0%)
  * .fedora - 1.0K (0.0%)
  * .diff - 1.0K (0.0%)
  * .feather - 0.6K (0.0%)
largest files
  * (49.1M) pyarrow/libarrow.1700.dylib
  * (10.7M) pyarrow/libarrow_flight.1700.dylib
  * (3.8M) pyarrow/lib.cpython-311-darwin.so
  * (3.8M) pyarrow/libparquet.1700.dylib
  * (2.9M) pyarrow/libarrow_substrait.1700.dylib

==================== done running pydistcheck ===============

Or on the test data in this repo ...

pydistcheck tests/data/problematic-package-*

... to see the types of issues it checks for.

------------ check results -----------
1. [files-only-differ-by-case] Found files which differ only by case. Files: problematic-package-0.1.0/problematic_package/Question.py,problematic-package-0.1.0/problematic_package/question.PY,problematic-package-0.1.0/problematic_package/question.py
2. [mixed-file-extensions] Found a mix of file extensions for the same file type: .NDJSON (1), .jsonl (1), .ndjson (1)
3. [mixed-file-extensions] Found a mix of file extensions for the same file type: .yaml (2), .yml (1)
4. [path-contains-non-ascii-characters] Found file path containing non-ASCII characters: 'problematic-package-0.1.0/problematic_package/?veryone-loves-python.py'
5. [path-contains-spaces] Found path with spaces: 'problematic-package-0.1.0/beep boop.ini'
6. [path-contains-spaces] Found path with spaces: 'problematic-package-0.1.0/problematic_package/bad code/'
7. [path-contains-spaces] Found path with spaces: 'problematic-package-0.1.0/problematic_package/bad code/__init__.py'
8. [path-contains-spaces] Found path with spaces: 'problematic-package-0.1.0/problematic_package/bad code/ship-it.py'
9. [unexpected-files] Found unexpected directory 'problematic-package-0.1.0/.git/'.
10. [unexpected-files] Found unexpected file 'problematic-package-0.1.0/.gitignore'.
11. [unexpected-files] Found unexpected file 'problematic-package-0.1.0/.hadolint.yaml'.
12. [unexpected-files] Found unexpected file 'problematic-package-0.1.0/problematic_package/.gitignore'.
errors found while checking: 12

And on a built distribution containing compiled objects ...

pydistcheck tests/data/debug-baseballmetrics*.whl

... pydistcheck can detect the inclusion of debug symbols (which increase distribution size).

checking 'tests/data/debug-baseballmetrics-0.1.0-py3-none-macosx_10_15_x86_64.macosx_11_6_x86_64.macosx_12_5_x86_64.whl'
------------ check results -----------
1. [compiled-objects-have-debug-symbols] Found compiled object containing debug symbols. For details, extract the distribution contents and run 'dsymutil -s "lib/lib_baseballmetrics.dylib"'.
errors found while checking: 1

checking 'tests/data/debug-baseballmetrics-py3-none-manylinux_2_28_x86_64.manylinux_2_5_x86_64.manylinux1_x86_64.whl'
------------ check results -----------
1. [compiled-objects-have-debug-symbols] Found compiled object containing debug symbols. For details, extract the distribution contents and run 'objdump --all-headers "lib/lib_baseballmetrics.so"'.
errors found while checking: 1

See https://pydistcheck.readthedocs.io/en/latest/ to learn more.

References

Download files

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

Source Distribution

pydistcheck-0.11.3.tar.gz (18.5 kB view details)

Uploaded Source

Built Distribution

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

pydistcheck-0.11.3-py3-none-any.whl (22.2 kB view details)

Uploaded Python 3

File details

Details for the file pydistcheck-0.11.3.tar.gz.

File metadata

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

File hashes

Hashes for pydistcheck-0.11.3.tar.gz
Algorithm Hash digest
SHA256 7b95d2559a7875c4a91752d881c7b771892fbc45ba624d84d1b2c99c28c0eb63
MD5 46d60f1d5cd1ed9a2025a5326c31a9eb
BLAKE2b-256 06fb87977e228addc14dca334e51243f19b6e162d51a4055eadbc4dc6f6b7348

See more details on using hashes here.

Provenance

The following attestation bundles were made for pydistcheck-0.11.3.tar.gz:

Publisher: build-and-publish-wheels.yml on jameslamb/pydistcheck

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

File details

Details for the file pydistcheck-0.11.3-py3-none-any.whl.

File metadata

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

File hashes

Hashes for pydistcheck-0.11.3-py3-none-any.whl
Algorithm Hash digest
SHA256 9b3a92b414aeb171a2c5e2928c5591a01a05681358072194a929813fe6529dc2
MD5 194e26c4cacaf3c76b292b552ef92732
BLAKE2b-256 e4d1cf9b8739184b8af5efc7d2b232fd9300a9a8b190dcd85bbd5e7b09f12c44

See more details on using hashes here.

Provenance

The following attestation bundles were made for pydistcheck-0.11.3-py3-none-any.whl:

Publisher: build-and-publish-wheels.yml on jameslamb/pydistcheck

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.11.3 This release

2 files

0.11.2

2 files

0.11.1

2 files

0.11.0

2 files

0.10.0

2 files

0.9.1

2 files

0.9.0

2 files

0.8.0

2 files

0.7.1

2 files

0.7.0

2 files

0.6.0

2 files

0.5.2

2 files

0.5.1

2 files

0.5.0

2 files

0.4.0

2 files

0.3.0

2 files

0.2.0

2 files

0.1.0

2 files

0.0.2.99

2 files

0.0.2

2 files

0.0.1

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