Configuration

This page describes how to configure pydistcheck.

pydistcheck combines different sources of configuration in the following order.

  1. default values

  2. pyproject.toml (or custom TOML file passed via --config)

  3. CLI arguments

Configuration found further down the list overrides configuration found earlier in the list.

CLI arguments

pydistcheck

Run the contents of a distribution through a set of checks, and warn about any problematic characteristics that are detected.

Exit codes:

0 = no issues detected

1 = issues detected

pydistcheck [OPTIONS] [FILEPATHS]...

Options

--version

Print the version of pydistcheck and exit.

--config <config>

Path to a TOML file containing a [tool.pydistcheck] table. If provided, pyproject.toml will be ignored.

--ignore <ignore>

ID of a check to skip, e.g. ‘compiled-objects-have-debug-symbols’. See https://pydistcheck.readthedocs.io/en/docs-fix/check-reference.html for a complete list of valid options. Can be passed multiple times.

--inspect

Print a summary of the distribution, like its total size and largest files.

--expected-directories <expected_directories>

Pattern matching directories that are expected to be found in the distribution. Prefix with ‘!’ to indicate a pattern which should NOT match any of the distribution’s contents. Other than that possible leading ‘!’, patterns should be in the format understood by fnmatch.fnmatchcase() (https://docs.python.org/3/library/fnmatch.html). Can be passed multiple times.

Default:

'!*/.appveyor', '!*/.binder', '!*/.circleci', '!*/.git', '!*/.github', '!*/.idea', '!*/.pytest_cache', '!*/.mypy_cache'

--expected-files <expected_files>

Pattern matching files that are expected to be found in the distribution. Prefix with ‘!’ to indicate a pattern which should NOT match any of the distribution’s contents. Other than that possible leading ‘!’, patterns should be in the format understood by fnmatch.fnmatchcase() (https://docs.python.org/3/library/fnmatch.html). Can be passed multiple times.

Default:

'!*/appveyor.yml', '!*/.appveyor.yml', '!*/azure-pipelines.yml', '!*/.azure-pipelines.yml', '!*/.cirrus.star', '!*/.cirrus.yml', '!*/codecov.yml', '!*/.codecov.yml', '!*/.DS_Store', '!*/.gitignore', '!*/.gitpod.yml', '!*/.hadolint.yaml', '!*/.readthedocs.yaml', '!*/.travis.yml', '!*/vsts-ci.yml', '!*/.vsts-ci.yml'

--max-allowed-files <max_allowed_files>

maximum number of files allowed in the distribution

Default:

2000

--max-allowed-size-compressed <max_allowed_size_compressed>

maximum allowed compressed size, a string like ‘1.5M’ indicating ‘1.5 megabytes’. Supported units: - B = bytes - K = kilobytes - M = megabytes - G = gigabytes

Default:

'50M'

--max-allowed-size-uncompressed <max_allowed_size_uncompressed>

maximum allowed uncompressed size, a string like ‘1.5M’ indicating ‘1.5 megabytes’. Supported units: - B = bytes - K = kilobytes - M = megabytes - G = gigabytes

Default:

'75M'

--max-path-length <max_path_length>

Maximum allowed filepath length for files or directories in the distribution.

Default:

200

Arguments

FILEPATHS

Optional argument(s)

pyproject.toml

If a file pyproject.toml exists in the working directory pydistcheck is run from, pydistcheck will look there for configuration.

Alternatively, a path to a TOML file can be provided via CLI argument --config.

Put configuration in a [tool.pydistcheck] section.

The example below contains all of the configuration options for pydistcheck, set to their default values.

[tool.pydistcheck]

# List of checks to ignore.
# See https://pydistcheck.readthedocs.io/en/latest/check-reference.html for
# a complete list.
ignore = []

# Set to true to print a summary of the distribution, like its total
# size and largest files.
inspect = false

# If more than this many files is found in the distribution,
# pydistcheck reports a 'too-many-files' check failure.
max_allowed_files = 2000

# If the distribution is larger than this size (compressed),
# pydistcheck reports a 'distro-too-large-compressed' check failure.
#
# See 'pydistcheck --help' for available units.
max_allowed_size_compressed = '50M'

# If the distribution is larger than this size (uncompressed),
# pydistcheck reports a 'distro-too-large-compressed' check failure.
#
# See 'pydistcheck --help' for available units.
max_allowed_size_uncompressed = '75M'

# If any file or directory in the distribution has a path longer
# than this many characters, pydistcheck reports a 'path-too-long' check failure.
#
# For help choosing a value, see
# https://pydistcheck.readthedocs.io/en/latest/check-reference.html#path-too-long
max_path_length = 200

# List of fnmatch.fnmatchcase() patterns to be compared to directories
# in the distribution.
expected_directories = [
    '!*/.appveyor',
    '!*/.binder',
    '!*/.circleci',
    '!*/.git',
    '!*/.github',
    '!*/.idea',
    '!*/.pytest_cache',
    '!*/.mypy_cache'
]

# List of fnmatch.fnmatchcase() patterns to be compared to files
# in the distribution.
expected_files = [
    '!*/appveyor.yml',
    '!*/.appveyor.yml',
    '!*/azure-pipelines.yml',
    '!*/.azure-pipelines.yml',
    '!*/.cirrus.star',
    '!*/.cirrus.yml',
    '!*/codecov.yml',
    '!*/.codecov.yml',
    '!*/.DS_Store',
    '!*/.gitignore',
    '!*/.gitpod.yml',
    '!*/.hadolint.yaml',
    '!*/.readthedocs.yaml',
    '!*/.travis.yml',
    '!*/vsts-ci.yml',
    '!*/.vsts-ci.yml'
]