check_dist¶
Submodules¶
Attributes¶
Exceptions¶
Error raised when distribution checks fail. |
Functions¶
|
Return error strings for any patterns found in files. |
|
Run all distribution checks. |
|
Return error strings for any patterns not found in files. |
|
Compare sdist contents against VCS-tracked files. |
|
Flag files that use an extension from another platform. |
|
Derive default check-dist config from copier answers. |
|
Return |
|
Return files tracked by git in source_dir. |
|
List files inside an sdist, stripping the top-level directory. |
|
List files inside a wheel. |
|
Load |
|
Load |
|
Load |
|
Check whether filepath matches pattern. |
|
Translate file extensions to the current platform's convention. |
Package Contents¶
- check_dist.__version__ = '0.1.5'¶
- exception check_dist.CheckDistError[source]¶
Bases:
ExceptionError raised when distribution checks fail.
Initialize self. See help(type(self)) for accurate signature.
- check_dist.check_absent(files: list[str], patterns: list[str], dist_type: str, *, present_patterns: list[str] | None = None) list[str][source]¶
Return error strings for any patterns found in files.
When present_patterns is given, files nested inside a directory that matches a present pattern are not flagged. This avoids false positives like
lerna/tests/fake_package/pyproject.tomlbeing flagged as unwanted whenlernais a required present pattern.
- check_dist.check_dist(source_dir: str = '.', *, no_isolation: bool = False, verbose: bool = False, pre_built: str | None = None, rebuild: bool = False) tuple[bool, list[str]][source]¶
Run all distribution checks.
- Parameters:
source_dir – Path to the project root.
no_isolation – Passed to
python -m build --no-isolation.verbose – List every file in each distribution.
pre_built – If given, skip building and use existing dist files from this directory. Useful when native toolchains have already produced the archives.
rebuild – Force a fresh build even when pre-built distributions exist in
dist/orwheelhouse/.``(success (Returns) –
messages)``.
- check_dist.check_present(files: list[str], patterns: list[str], dist_type: str) list[str][source]¶
Return error strings for any patterns not found in files.
- check_dist.check_sdist_vs_vcs(sdist_files: list[str], vcs_files: list[str], hatch_config: dict, sdist_absent: list[str] | None = None) list[str][source]¶
Compare sdist contents against VCS-tracked files.
- check_dist.check_wrong_platform_extensions(files: list[str], dist_type: str) list[str][source]¶
Flag files that use an extension from another platform.
- check_dist.copier_defaults(copier_config: dict, hatch_config: dict | None = None) dict | None[source]¶
Derive default check-dist config from copier answers.
Returns a config dict with the same shape as
load_configoutput, orNoneif deriving defaults is not possible (noadd_extensionkey, or unknown extension type).When hatch_config is provided,
sdist_present_extrapatterns are filtered against the hatch sdist configuration to only require paths that will actually appear in the archive. Follows hatch precedence:only-include(exhaustive) >packages(used asonly-includefallback) >include(filter on full tree).
- check_dist.find_dist_files(output_dir: str) tuple[str | None, str | None][source]¶
Return
(sdist_path, wheel_path)found in output_dir.
- check_dist.get_vcs_files(source_dir: str) list[str][source]¶
Return files tracked by git in source_dir.
- check_dist.list_sdist_files(sdist_path: str) list[str][source]¶
List files inside an sdist, stripping the top-level directory.
- check_dist.load_config(pyproject_path: str | pathlib.Path = 'pyproject.toml', *, source_dir: str | pathlib.Path | None = None) dict[source]¶
Load
[tool.check-dist]configuration from pyproject.toml.If no
[tool.check-dist]section exists and source_dir contains a.copier-answers.yamlwith anadd_extensionkey, sensible defaults are derived from the copier template answers.
- check_dist.load_copier_config(source_dir: str | pathlib.Path) dict[source]¶
Load
.copier-answers.yamlfrom source_dir, if it exists.
- check_dist.load_hatch_config(pyproject_path: str | pathlib.Path = 'pyproject.toml') dict[source]¶
Load
[tool.hatch.build]configuration from pyproject.toml.
- check_dist.matches_pattern(filepath: str, pattern: str) bool[source]¶
Check whether filepath matches pattern.
A bare name like
check_distmatches any file whose path starts withcheck_dist/.Glob wildcards (
*,?,[…]) are matched against both the full path and the basename.Extensions are translated to the current platform before matching.