Skip to main content

Check the contents of an SDist vs. git

Project description

check-sdist

Actions Status codecov PyPI version PyPI platforms

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 with pipx:

$ pipx run check-sdist[uv]

Or, if you like uv instead (faster):

$ uvx check-sdist

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: v1.3.0
  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. The installation is handled by pre-commit; see pre-commit-uv if you want to try to optimize the initial setup. If uv is present (including in your additional_dependencies), the build will be slightly faster, as uv is used to do the build. If you don't mind slower runs and don't want to require a build dependency listing:

- repo: https://github.com/henryiii/check-sdist
  rev: v1.3.0
  hooks:
    - id: check-sdist-isolated
      args: [--inject-junk]

This one defaults to including uv in additional_dependencies; you shouldn't have to specify anything else.

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"
build-backend = "auto"

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.

You can tell check-sdist to look for exclude lists for a specific build backend with build-backend, or "none" to only use it's own exclude list. Build backends supported are "flit_core.buildapi", "hatchling.build", "scikit_build_core.build", "pdm.backend", "maturin", and "poetry.core.masonry.api". The default, "auto", will try to detect the build backend if build-system.build-backend is set to a known value.

See also

Project details


Download files

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

Source Distribution

check_sdist-1.3.0.tar.gz (16.8 kB view details)

Uploaded Source

Built Distribution

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

check_sdist-1.3.0-py3-none-any.whl (13.0 kB view details)

Uploaded Python 3

File details

Details for the file check_sdist-1.3.0.tar.gz.

File metadata

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

File hashes

Hashes for check_sdist-1.3.0.tar.gz
Algorithm Hash digest
SHA256 20f80f8c5e8e1d878d70e9d4f82dfa5a531198d9704b5e8b60a19bcc8dd1f1e7
MD5 8c079c9c1106c225e79a75f9619f54ed
BLAKE2b-256 7c8a9690d2741a85447d0ab10b23451403a5d00c1ff37638247ec8cd05bf0d5a

See more details on using hashes here.

Provenance

The following attestation bundles were made for check_sdist-1.3.0.tar.gz:

Publisher: cd.yml on henryiii/check-sdist

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

File details

Details for the file check_sdist-1.3.0-py3-none-any.whl.

File metadata

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

File hashes

Hashes for check_sdist-1.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9c0b71ea7bfa2f81235205ac237912640c4ce9eafba4ca66ee31d612a2dc610b
MD5 12357f352e53b7a317cc2e70894f3771
BLAKE2b-256 e37ce95f2ff82f1790013a997ee1bf2f96aba1b4d4dea70f849048748d600e9c

See more details on using hashes here.

Provenance

The following attestation bundles were made for check_sdist-1.3.0-py3-none-any.whl:

Publisher: cd.yml on henryiii/check-sdist

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

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page