pydistcheck


Namepydistcheck JSON
Version 0.9.0 PyPI version JSON
download
home_pageNone
SummaryInspect Python package distributions and raise warnings on common problems.
upload_time2025-02-12 00:19:40
maintainerNone
docs_urlNone
authorNone
requires_python>=3.8
licenseNone
keywords linter python-packaging testing
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # pydistcheck

[![conda-forge version](https://img.shields.io/conda/vn/conda-forge/pydistcheck.svg)](https://anaconda.org/conda-forge/pydistcheck)
[![conda-forge downloads](https://img.shields.io/conda/dn/conda-forge/pydistcheck.svg)](https://anaconda.org/conda-forge/pydistcheck)
[![PyPI Version](https://img.shields.io/pypi/v/pydistcheck.svg?logo=pypi&logoColor=white)](https://pypi.org/project/pydistcheck)
[![PyPI downloads](https://static.pepy.tech/badge/pydistcheck)](https://pypi.org/project/pydistcheck)
[![Documentation Status](https://readthedocs.org/projects/pydistcheck/badge/?version=latest)](https://pydistcheck.readthedocs.io/)
[![GitHub Actions](https://github.com/jameslamb/pydistcheck/actions/workflows/unit-tests.yml/badge.svg?branch=main)](https://github.com/jameslamb/pydistcheck/actions/workflows/unit-tests.yml)
[![GitHub Actions](https://github.com/jameslamb/pydistcheck/actions/workflows/smoke-tests.yml/badge.svg?branch=main)](https://github.com/jameslamb/pydistcheck/actions/workflows/smoke-tests.yml)

## 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"](https://pydistcheck.readthedocs.io/en/latest/check-reference.html) for a complete list of the types of issues `pydistcheck` can catch.

See ["How to Test a Python Distribution"](https://pydistcheck.readthedocs.io/en/latest/how-to-test-a-python-distribution.html) to learn how `pydistcheck` and similar tools like [`auditwheel`](https://github.com/pypa/auditwheel), [`check-wheel-contents`](https://github.com/jwodder/check-wheel-contents), and [`twine check`](https://twine.readthedocs.io/en/stable/#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](https://www.youtube.com/watch?v=1a7g5l_g_U8)).

## Installation

Install with `pip`.

```shell
pip install pydistcheck
```

Or `conda`.

```shell
conda install -c conda-forge pydistcheck
```

For more details, see "Installation" ([link](./docs/installation.rst)).

## Quickstart

Try it out on a package you like...

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

pydistcheck --inspect ./downloads/*.whl
```

... to see what it contains.

```text
----- 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 ...

```shell
pydistcheck tests/data/problematic-package-*
```

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

```text
------------ 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 ...

```shell
pydistcheck tests/data/debug-baseballmetrics*.whl
```

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

```text
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

* Python packaging guides: https://packaging.python.org/en/latest/guides/#

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "pydistcheck",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": "James Lamb <jaylamb20@gmail.com>",
    "keywords": "linter, python-packaging, testing",
    "author": null,
    "author_email": "James Lamb <jaylamb20@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/12/8b/3eddafb51b3eb41819544fa90932d847de10a68b6da28b0542fcecd7f3eb/pydistcheck-0.9.0.tar.gz",
    "platform": null,
    "description": "# pydistcheck\n\n[![conda-forge version](https://img.shields.io/conda/vn/conda-forge/pydistcheck.svg)](https://anaconda.org/conda-forge/pydistcheck)\n[![conda-forge downloads](https://img.shields.io/conda/dn/conda-forge/pydistcheck.svg)](https://anaconda.org/conda-forge/pydistcheck)\n[![PyPI Version](https://img.shields.io/pypi/v/pydistcheck.svg?logo=pypi&logoColor=white)](https://pypi.org/project/pydistcheck)\n[![PyPI downloads](https://static.pepy.tech/badge/pydistcheck)](https://pypi.org/project/pydistcheck)\n[![Documentation Status](https://readthedocs.org/projects/pydistcheck/badge/?version=latest)](https://pydistcheck.readthedocs.io/)\n[![GitHub Actions](https://github.com/jameslamb/pydistcheck/actions/workflows/unit-tests.yml/badge.svg?branch=main)](https://github.com/jameslamb/pydistcheck/actions/workflows/unit-tests.yml)\n[![GitHub Actions](https://github.com/jameslamb/pydistcheck/actions/workflows/smoke-tests.yml/badge.svg?branch=main)](https://github.com/jameslamb/pydistcheck/actions/workflows/smoke-tests.yml)\n\n## What is `pydistcheck`?\n\n`pydistcheck` is a command line interface (CLI) that you run on Python packages, which can:\n\n* detect common portability issues\n* print useful summaries of the package's contents\n\nIt's inspired by R's `R CMD check`.\n\nSupported formats:\n\n* Python sdists\n* Python wheels\n* `conda` packages (both `.conda` and `.tar.bz2`)\n* any `.tar.bz2`, `.tar.gz`, or `.zip` archive\n\nSee [\"Check Reference\"](https://pydistcheck.readthedocs.io/en/latest/check-reference.html) for a complete list of the types of issues `pydistcheck` can catch.\n\nSee [\"How to Test a Python Distribution\"](https://pydistcheck.readthedocs.io/en/latest/how-to-test-a-python-distribution.html) to learn how `pydistcheck` and similar tools like [`auditwheel`](https://github.com/pypa/auditwheel), [`check-wheel-contents`](https://github.com/jwodder/check-wheel-contents), and [`twine check`](https://twine.readthedocs.io/en/stable/#twine-check) fit into Python development workflows.\n\nFor more background on the value of such a tool, see the SciPy 2022 talk \"Does that CSV Belong on PyPI? Probably Not\" ([video link](https://www.youtube.com/watch?v=1a7g5l_g_U8)).\n\n## Installation\n\nInstall with `pip`.\n\n```shell\npip install pydistcheck\n```\n\nOr `conda`.\n\n```shell\nconda install -c conda-forge pydistcheck\n```\n\nFor more details, see \"Installation\" ([link](./docs/installation.rst)).\n\n## Quickstart\n\nTry it out on a package you like...\n\n```shell\npip download \\\n  --no-deps \\\n  -d ./downloads \\\n  pyarrow\n\npydistcheck --inspect ./downloads/*.whl\n```\n\n... to see what it contains.\n\n```text\n----- package inspection summary -----\nfile size\n  * compressed size: 25.9M\n  * uncompressed size: 94.0M\n  * compression space saving: 72.4%\ncontents\n  * directories: 0\n  * files: 809 (30 compiled)\nsize by extension\n  * .dylib - 73.2M (77.9%)\n  * .so - 10.8M (11.4%)\n  * .h - 4.5M (4.8%)\n  * .py - 2.4M (2.5%)\n  * .pyx - 0.8M (0.8%)\n  * .pxi - 0.7M (0.8%)\n  * .cc - 0.4M (0.5%)\n  * .cmake - 0.4M (0.4%)\n  * .pxd - 0.3M (0.3%)\n  * .gz - 0.2M (0.2%)\n  * .hpp - 0.1M (0.1%)\n  * .txt - 0.1M (0.1%)\n  * no-extension - 77.4K (0.1%)\n  * .orc - 48.4K (0.1%)\n  * .parquet - 14.0K (0.0%)\n  * .sh - 7.8K (0.0%)\n  * .md - 3.6K (0.0%)\n  * .yml - 1.5K (0.0%)\n  * .ubuntu - 1.3K (0.0%)\n  * .fedora - 1.0K (0.0%)\n  * .diff - 1.0K (0.0%)\n  * .feather - 0.6K (0.0%)\nlargest files\n  * (49.1M) pyarrow/libarrow.1700.dylib\n  * (10.7M) pyarrow/libarrow_flight.1700.dylib\n  * (3.8M) pyarrow/lib.cpython-311-darwin.so\n  * (3.8M) pyarrow/libparquet.1700.dylib\n  * (2.9M) pyarrow/libarrow_substrait.1700.dylib\n\n==================== done running pydistcheck ===============\n```\n\nOr on the test data in this repo ...\n\n```shell\npydistcheck tests/data/problematic-package-*\n```\n\n... to see the types of issues it checks for.\n\n```text\n------------ check results -----------\n1. [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\n2. [mixed-file-extensions] Found a mix of file extensions for the same file type: .NDJSON (1), .jsonl (1), .ndjson (1)\n3. [mixed-file-extensions] Found a mix of file extensions for the same file type: .yaml (2), .yml (1)\n4. [path-contains-non-ascii-characters] Found file path containing non-ASCII characters: 'problematic-package-0.1.0/problematic_package/?veryone-loves-python.py'\n5. [path-contains-spaces] Found path with spaces: 'problematic-package-0.1.0/beep boop.ini'\n6. [path-contains-spaces] Found path with spaces: 'problematic-package-0.1.0/problematic_package/bad code/'\n7. [path-contains-spaces] Found path with spaces: 'problematic-package-0.1.0/problematic_package/bad code/__init__.py'\n8. [path-contains-spaces] Found path with spaces: 'problematic-package-0.1.0/problematic_package/bad code/ship-it.py'\n9. [unexpected-files] Found unexpected directory 'problematic-package-0.1.0/.git/'.\n10. [unexpected-files] Found unexpected file 'problematic-package-0.1.0/.gitignore'.\n11. [unexpected-files] Found unexpected file 'problematic-package-0.1.0/.hadolint.yaml'.\n12. [unexpected-files] Found unexpected file 'problematic-package-0.1.0/problematic_package/.gitignore'.\nerrors found while checking: 12\n```\n\nAnd on a built distribution containing compiled objects ...\n\n```shell\npydistcheck tests/data/debug-baseballmetrics*.whl\n```\n\n... `pydistcheck` can detect the inclusion of debug symbols (which increase distribution size).\n\n```text\nchecking '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'\n------------ check results -----------\n1. [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\"'.\nerrors found while checking: 1\n\nchecking 'tests/data/debug-baseballmetrics-py3-none-manylinux_2_28_x86_64.manylinux_2_5_x86_64.manylinux1_x86_64.whl'\n------------ check results -----------\n1. [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\"'.\nerrors found while checking: 1\n```\n\nSee https://pydistcheck.readthedocs.io/en/latest/ to learn more.\n\n## References\n\n* Python packaging guides: https://packaging.python.org/en/latest/guides/#\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "Inspect Python package distributions and raise warnings on common problems.",
    "version": "0.9.0",
    "project_urls": {
        "changelog": "https://github.com/jameslamb/pydistcheck/releases",
        "documentation": "https://pydistcheck.readthedocs.io/en/latest/",
        "homepage": "https://pydistcheck.readthedocs.io/en/latest/",
        "repository": "https://github.com/jameslamb/pydistcheck"
    },
    "split_keywords": [
        "linter",
        " python-packaging",
        " testing"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "ba85900cbd18f01706b764bc908d1fab1f66ed2c2fbbc04eef647c7f701f0ddd",
                "md5": "9da95daf903d34142417c741cc5c7c1a",
                "sha256": "6b31488ecaff9b4c62f27f8df58f15fee3b8cb6d57e268cd0340f947de5fdaf1"
            },
            "downloads": -1,
            "filename": "pydistcheck-0.9.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "9da95daf903d34142417c741cc5c7c1a",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 21462,
            "upload_time": "2025-02-12T00:19:39",
            "upload_time_iso_8601": "2025-02-12T00:19:39.163896Z",
            "url": "https://files.pythonhosted.org/packages/ba/85/900cbd18f01706b764bc908d1fab1f66ed2c2fbbc04eef647c7f701f0ddd/pydistcheck-0.9.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "128b3eddafb51b3eb41819544fa90932d847de10a68b6da28b0542fcecd7f3eb",
                "md5": "e24a56c597b498939e645583cc645633",
                "sha256": "17251cf01f5229152d36d1ba51cd2ae1366b0000270b3865f71be4ce77155688"
            },
            "downloads": -1,
            "filename": "pydistcheck-0.9.0.tar.gz",
            "has_sig": false,
            "md5_digest": "e24a56c597b498939e645583cc645633",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 31537,
            "upload_time": "2025-02-12T00:19:40",
            "upload_time_iso_8601": "2025-02-12T00:19:40.961325Z",
            "url": "https://files.pythonhosted.org/packages/12/8b/3eddafb51b3eb41819544fa90932d847de10a68b6da28b0542fcecd7f3eb/pydistcheck-0.9.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-02-12 00:19:40",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "jameslamb",
    "github_project": "pydistcheck",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "pydistcheck"
}
        
Elapsed time: 0.41977s