Skip to main content

dist-precheck

Python Version License Tests PyPI PyPI Downloads Author site Context7 Ask DeepWiki

Fail a Python release before upload when PyPI would reject it.

Features

  • Name check for first uploads: PyPI's own rules for a new project (valid name, not a stdlib module, not taken, not "too similar to an existing project"), run locally
  • Free alternatives: a refused or taken name comes with up to five names that pass the same rules
  • Archive checks: the wheel and sdist problems PyPI started rejecting on 18 Nov 2026 (ZIP data descriptors, linux_x86_64 tags, V7 and sparse tar members, and more)
  • CLI and GitHub Action: run it on your machine or as the step before pypa/gh-action-pypi-publish
  • Zero dependencies: only the Python standard library, Python 3.9+
  • Offline mode: --no-name-check runs the archive checks without network access

Why dist-precheck?

A 404 from pypi.org/simple/<name>/ does not mean PyPI will let you register the name. PyPI also refuses stdlib module names and any name that is "too similar to an existing project", and you only find out with a 400 at upload time. RedStar was free on the simple index and still got refused, because red-star exists.

The similarity rule is Warehouse's ultranormalize_name: drop ., _ and -, read l and i as 1 and o as 0, lowercase, then compare against every project on PyPI. dist-precheck downloads the PEP 691 simple index once a day (about 10 MB) and runs the same comparison locally.

twine check validates metadata only. PyPI has been tightening what it accepts in the archive itself (blog, 18 Nov 2026, docs.pypi.org/archives), and dist-precheck checks those rules too.

Checked against 25 names PyPI really refused in Oct to Dec 2026 (25 of 25 flagged) and the 40 newest accepted projects on 5 Dec 2026 (0 flagged). See tests/validate_real.py.

Installation

pip install dist-precheck

Or run it without installing:

pipx run dist-precheck --help

Usage Examples

Check a name before you build

dist-precheck name RedStar puremath json dist-precheck
TOO_SIMILAR PyPI will refuse 'RedStar' as too similar to existing 'red-star' (same name once . _ - are dropped, l/i read as 1 and o as 0). Pick another name, or ask in pypi/support for a name-similarity review
            free alternatives (same rules): redstar-py, redstar-kit, redstar-tool, redstar-lib, redstar-sdk
TOO_SIMILAR PyPI will refuse 'puremath' as too similar to existing 'pure-math' (same name once . _ - are dropped, l/i read as 1 and o as 0). Pick another name, or ask in pypi/support for a name-similarity review
            free alternatives (same rules): puremath-py, puremath-kit, puremath-tool, puremath-lib, puremath-sdk
STDLIB      'json' matches a Python standard-library module; PyPI refuses it
            free alternatives (same rules): json-sdk, json-core, json-dev, json-hq
FREE        'dist-precheck' is free and passes PyPI's public name rules (admin-prohibited names can't be checked)

The exit code is 1 when any name would be refused. Add --no-suggest to skip the alternatives.

Check built distributions

python -m build
dist-precheck dist/*
OK   dist_precheck-1.0.1-py3-none-any.whl
OK   dist_precheck-1.0.1.tar.gz
NAME dist-precheck: FREE 'dist-precheck' is free and passes PyPI's public name rules (admin-prohibited names can't be checked)

Each file gets OK or FAIL with its problems listed. The name check runs only when the project is not on PyPI yet. Add --no-name-check to skip it and stay offline.

Use as a GitHub Action

Add the action between the build step and the publish step:

jobs:
  release:
    runs-on: ubuntu-latest
    environment: pypi
    permissions:
      id-token: write
    steps:
      - uses: actions/checkout@v5
      - uses: actions/setup-python@v6
        with:
          python-version: "3.13"
      - run: python -m pip install build && python -m build
      - uses: ysskrishna/dist-precheck@v1
      - uses: pypa/gh-action-pypi-publish@release/v1

The step fails, and the upload never runs, when PyPI would reject a file or the name.

Input Default Description
path dist Directory with the built .whl and .tar.gz files
name-check true On a first upload, check the project name against PyPI's rules. Set false on runners without network access

The action runs with the runner's python3 (3.9 or newer) and installs nothing.

What it checks

Check Level
First upload: invalid name, stdlib module name, taken, too similar to an existing project ERROR
ZIP data descriptors (400 ... ZIP contains a data descriptor) ERROR
Trailing or prepended bytes, member comments, duplicate entries, non-UTF-8 or control-character names, central-directory gaps ERROR
linux_x86_64-style platform tags (400 ... unsupported platform tag) ERROR
V7 tar headers, GNU and pax sparse members, pax vendor extensions (SCHILY.*, LIBARCHIVE.*) ERROR
Archive-level ZIP comment, GNU-format tarball WARN (PyPI says it will reject these next)

If the project already exists on PyPI, the name check is skipped: dist-precheck cannot tell whether you own it, and an upload to someone else's project fails with 403 anyway. Admin-prohibited names are not public, so they cannot be checked. That includes some deleted names.

CLI Reference

Command Description
dist-precheck <files>... Check wheels and sdists, then the project name on a first upload. Exit 1 on any ERROR.
dist-precheck <files>... --no-name-check Archive checks only. No network access.
dist-precheck name <project>... Check one or more names against PyPI's rules. Exit 1 if any would be refused.
dist-precheck name <project>... --no-suggest Same, without free alternatives.
dist-precheck --help / --version Print usage or the version.

The simple index is cached for a day in $XDG_CACHE_HOME/dist-precheck (default ~/.cache/dist-precheck).

Learn More

Acknowledgments

  • stdlib-list (MIT), the source of the stdlib name list, the same one Warehouse uses
  • Warehouse, for the name rules this tool mirrors

Contributing

We welcome contributions! Please see our Contributing Guide for details.

Built and maintained by

dist-precheck is built and maintained by:

Name GitHub Role
Y. Siva Sai Krishna Y. Siva Sai Krishna @ysskrishna Creator

Changelog

See CHANGELOG for release history.

Support

If you find this tool helpful:

License

MIT © Y. Siva Sai Krishna - see LICENSE for details.


Author's GitHub • Author's LinkedIn • Author's site • Package on PyPI • Report Issues

Metadata

Release files for dist-precheck 1.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for dist-precheck 1.0.1
File Size Uploaded Provenance Actions
dist_precheck-1.0.1.tar.gz 42.4 kB With provenance Details for dist_precheck-1.0.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for dist-precheck 1.0.1
File Interpreter ABI Platform Actions
dist_precheck-1.0.1-py3-none-any.whl Python 3 none any Details for dist_precheck-1.0.1-py3-none-any.whl

Total release size: 65.4 kB

Release files / dist_precheck-1.0.1.tar.gz

Download URL dist_precheck-1.0.1.tar.gz
Size 42.4 kB
Tags Source
SHA-256 checksum
How to use checksums
76523c376c1195debd0a60b1e08cce020e70d0fa78cd65ddb2dddcc537a98f61
BLAKE2b-256 checksum
How to use checksums
fb3ed1e70dcf5faaec356bbd1769762819c9d19188df27c991377e84167e4227
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.13 {"installer":{"name":"uv","version":"0.13.13","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 5, 2026.

Transparency log

Release files / dist_precheck-1.0.1-py3-none-any.whl

Download URL dist_precheck-1.0.1-py3-none-any.whl
Size 23.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
455827ef334c8c6a3317d563fe5909804d62592108e2e5785c838659aab94fde
BLAKE2b-256 checksum
How to use checksums
c120473de5838e0ce3c0cbb1db1b2f306ab2cdba8c2f5c647487bf0d69fc009b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.13 {"installer":{"name":"uv","version":"0.13.13","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 5, 2026.

Transparency log

Security for dist-precheck 1.0.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for dist_precheck-1.0.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 5, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.0.1 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page