Check the contents of an SDist vs. git
Project description
check-sdist
Have you ever shipped broken SDists with missing files or possibly dirty SDists
with files that shouldn't have been there? Have you noticed that standards
compliant tools aren't making the same SDist that flit build
is? Is hatchling
adding .DSStore
files when you ship from your macOS? No matter what
build-backend you use, check-sdist can help!
Check-sdist builds an SDist and compares the contents with your Git repository contents. It can even temporarily inject common junk files (like pycache files or OS specific files) and help verify that those aren't getting bundled into your SDist. If you are getting files you didn't expect or missing files you did expect, consult your build backend's docs to see how to include or exclude files.
Quick start
To run:
$ pipx run check-sdist[uv]
You can add --no-isolation
to disable build isolation (faster, but must
preinstall build dependencies), --source-dir
to select a different source
directory to check, and --inject-junk
to temporarily inject some common junk
files while running. You can select an installer for build to use with
--installer=
, choices are uv
, pip
, or uv|pip
, which will use uv if
available (the default).
If you need the latest development version:
$ pipx run --spec git+https://github.com/henryiii/check-sdist check-sdist
Pre-commit integration
To use the pre-commit integration, put this in your
.pre-commit-config.yaml
:
- repo: https://github.com/henryiii/check-sdist
rev: v0.1.3
hooks:
- id: check-sdist
args: [--inject-junk]
additional_dependencies: [] # list your build deps here
This requires your build dependencies, but in doing so, it can cache the environment, making it quite fast. If you don't mind slower runs and don't want to require build dependency listing:
- repo: https://github.com/henryiii/check-sdist
rev: v0.1.3
hooks:
- id: check-sdist-isolated
args: [--inject-junk]
Configuration
To configure, these options are supported in your pyproject.toml
file:
[tool.check-sdist]
sdist-only = []
git-only = []
default-ignore = true
recurse-submodules = true
mode = "git"
You can add .gitignore
style lines here, and you can turn off the default
ignore list, which adds some default git-only files.
By default, check-sdist recursively scans the contents of Git submodules, but you can disable this behavior (e.g. to support older Git versions that don't have this capability).
You can also select mode = "all"
, which will instead check every file on your
system. Be prepared to ignore lots of things manually, like *.pyc
files, if
you use this.
See also
- check-manifest: A (currently) setuptools specific checker that can suggest possible ways to include/exclude files.
- Scientific Python Development Guide: Guidelines on which this package was designed.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file check_sdist-1.0.0rc2.tar.gz
.
File metadata
- Download URL: check_sdist-1.0.0rc2.tar.gz
- Upload date:
- Size: 14.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.0.0 CPython/3.12.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4b1315da0599626d7222ed7bff0bd3c2f4f7b150febd7c71496c930d2be65efd |
|
MD5 | ac5566ab71c32267cd2de44399c328a7 |
|
BLAKE2b-256 | e9826c432f7a42133a7ea690eee06f4d5bf31fdb55c75701a91ecba8277074e9 |
File details
Details for the file check_sdist-1.0.0rc2-py3-none-any.whl
.
File metadata
- Download URL: check_sdist-1.0.0rc2-py3-none-any.whl
- Upload date:
- Size: 11.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.0.0 CPython/3.12.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5f75514217c772e874c990400a300fe8d303f2b1ec58c16d79a9018cbada6980 |
|
MD5 | d97d0b03123a8ebc12a6c54d9cfc18ac |
|
BLAKE2b-256 | 38e7f38c6fcac72d73bc2b973d42450763e0bb97425477c074e010f0c58cae18 |