dist-precheck 1.0.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- dist_precheck-1.0.0/.github/CODEOWNERS +2 -0
- dist_precheck-1.0.0/.github/FUNDING.yml +4 -0
- dist_precheck-1.0.0/.github/SECURITY.md +15 -0
- dist_precheck-1.0.0/.github/workflows/publish.yml +78 -0
- dist_precheck-1.0.0/.github/workflows/test.yml +80 -0
- dist_precheck-1.0.0/.gitignore +10 -0
- dist_precheck-1.0.0/.python-version +1 -0
- dist_precheck-1.0.0/CHANGELOG.md +22 -0
- dist_precheck-1.0.0/CONTRIBUTING.md +143 -0
- dist_precheck-1.0.0/LICENSE +21 -0
- dist_precheck-1.0.0/PKG-INFO +214 -0
- dist_precheck-1.0.0/README.md +185 -0
- dist_precheck-1.0.0/action.yml +22 -0
- dist_precheck-1.0.0/context7.json +33 -0
- dist_precheck-1.0.0/dist_precheck/__init__.py +302 -0
- dist_precheck-1.0.0/dist_precheck/__main__.py +4 -0
- dist_precheck-1.0.0/dist_precheck/stdlib_prohibited.txt +2365 -0
- dist_precheck-1.0.0/pyproject.toml +60 -0
- dist_precheck-1.0.0/tests/action-test.sh +30 -0
- dist_precheck-1.0.0/tests/test_archives.py +54 -0
- dist_precheck-1.0.0/tests/test_names.py +109 -0
- dist_precheck-1.0.0/tests/validate_real.py +63 -0
- dist_precheck-1.0.0/uv.lock +248 -0
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# Security Policy
|
|
2
|
+
|
|
3
|
+
## Supported versions
|
|
4
|
+
|
|
5
|
+
Only the latest release of dist-precheck receives security fixes.
|
|
6
|
+
|
|
7
|
+
Upgrade with `pip install -U dist-precheck`. In GitHub Actions, `ysskrishna/dist-precheck@v1` always points to the latest 1.x release.
|
|
8
|
+
|
|
9
|
+
## Reporting a vulnerability
|
|
10
|
+
|
|
11
|
+
Please **do not** open a public issue for security problems.
|
|
12
|
+
|
|
13
|
+
Report it privately through GitHub instead: open the [Security tab](https://github.com/ysskrishna/dist-precheck/security/advisories/new) of this repository and choose **Report a vulnerability**. Include the affected version, steps to reproduce, and the impact you expect.
|
|
14
|
+
|
|
15
|
+
You will get an acknowledgement within 7 days. Once a fix is released the advisory is published with credit to the reporter (unless you ask to stay anonymous).
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
name: "Publish"
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
tags:
|
|
6
|
+
# Publish on full version tags, e.g., v1.0.0
|
|
7
|
+
- "v*.*.*"
|
|
8
|
+
|
|
9
|
+
concurrency:
|
|
10
|
+
group: ${{ github.workflow }}-${{ github.ref }}
|
|
11
|
+
cancel-in-progress: false
|
|
12
|
+
|
|
13
|
+
permissions:
|
|
14
|
+
contents: read
|
|
15
|
+
|
|
16
|
+
jobs:
|
|
17
|
+
build:
|
|
18
|
+
name: Build distributions
|
|
19
|
+
runs-on: ubuntu-latest
|
|
20
|
+
permissions:
|
|
21
|
+
contents: read
|
|
22
|
+
steps:
|
|
23
|
+
- name: Checkout
|
|
24
|
+
uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 # v5.1.0
|
|
25
|
+
with:
|
|
26
|
+
persist-credentials: false
|
|
27
|
+
- name: Install uv
|
|
28
|
+
uses: astral-sh/setup-uv@37802adc94f370d6bfd71619e3f0bf239e1f3b78 # v7.6.0
|
|
29
|
+
with:
|
|
30
|
+
enable-cache: false
|
|
31
|
+
python-version: "3.11"
|
|
32
|
+
- name: Build
|
|
33
|
+
run: uv build
|
|
34
|
+
- name: Upload distributions
|
|
35
|
+
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
|
|
36
|
+
with:
|
|
37
|
+
name: dist
|
|
38
|
+
path: dist/
|
|
39
|
+
|
|
40
|
+
publish:
|
|
41
|
+
name: Publish to PyPI
|
|
42
|
+
needs: build
|
|
43
|
+
runs-on: ubuntu-latest
|
|
44
|
+
environment:
|
|
45
|
+
name: pypi
|
|
46
|
+
permissions:
|
|
47
|
+
id-token: write # trusted publishing (OIDC); no PyPI token is stored in the repo
|
|
48
|
+
steps:
|
|
49
|
+
- name: Install uv
|
|
50
|
+
uses: astral-sh/setup-uv@37802adc94f370d6bfd71619e3f0bf239e1f3b78 # v7.6.0
|
|
51
|
+
with:
|
|
52
|
+
enable-cache: false
|
|
53
|
+
python-version: "3.11"
|
|
54
|
+
- name: Download distributions
|
|
55
|
+
uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0
|
|
56
|
+
with:
|
|
57
|
+
name: dist
|
|
58
|
+
path: dist/
|
|
59
|
+
- name: Generate PEP 740 attestations
|
|
60
|
+
uses: astral-sh/attest-action@f589a42a7efb6fe400b4f400de60b4bc90390027 # v0.0.6
|
|
61
|
+
- name: Publish
|
|
62
|
+
run: uv publish
|
|
63
|
+
|
|
64
|
+
release:
|
|
65
|
+
name: Create GitHub Release
|
|
66
|
+
needs: publish
|
|
67
|
+
runs-on: ubuntu-latest
|
|
68
|
+
permissions:
|
|
69
|
+
contents: write
|
|
70
|
+
steps:
|
|
71
|
+
- name: Checkout
|
|
72
|
+
uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 # v5.1.0
|
|
73
|
+
with:
|
|
74
|
+
fetch-depth: 0
|
|
75
|
+
persist-credentials: false
|
|
76
|
+
|
|
77
|
+
- name: Create GitHub release from changelog
|
|
78
|
+
uses: ysskrishna/changelog-release-action@v1
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
name: Tests
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [main]
|
|
8
|
+
|
|
9
|
+
concurrency:
|
|
10
|
+
group: ${{ github.workflow }}-${{ github.ref }}
|
|
11
|
+
cancel-in-progress: true
|
|
12
|
+
|
|
13
|
+
permissions:
|
|
14
|
+
contents: read
|
|
15
|
+
|
|
16
|
+
jobs:
|
|
17
|
+
test:
|
|
18
|
+
runs-on: ${{ matrix.os }}
|
|
19
|
+
strategy:
|
|
20
|
+
fail-fast: false
|
|
21
|
+
matrix:
|
|
22
|
+
os: [ubuntu-latest]
|
|
23
|
+
python-version: ["3.9", "3.11", "3.13", "3.14"]
|
|
24
|
+
include:
|
|
25
|
+
- os: macos-latest
|
|
26
|
+
python-version: "3.14"
|
|
27
|
+
- os: windows-latest
|
|
28
|
+
python-version: "3.14"
|
|
29
|
+
|
|
30
|
+
steps:
|
|
31
|
+
- name: Checkout
|
|
32
|
+
uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 # v5.1.0
|
|
33
|
+
with:
|
|
34
|
+
persist-credentials: false
|
|
35
|
+
|
|
36
|
+
- name: Install uv
|
|
37
|
+
uses: astral-sh/setup-uv@37802adc94f370d6bfd71619e3f0bf239e1f3b78 # v7.6.0
|
|
38
|
+
with:
|
|
39
|
+
python-version: ${{ matrix.python-version }}
|
|
40
|
+
|
|
41
|
+
- name: Install dependencies
|
|
42
|
+
run: uv sync --locked --dev
|
|
43
|
+
|
|
44
|
+
- name: Run tests
|
|
45
|
+
run: uv run pytest
|
|
46
|
+
|
|
47
|
+
action:
|
|
48
|
+
name: Package and action self-test
|
|
49
|
+
runs-on: ubuntu-latest
|
|
50
|
+
steps:
|
|
51
|
+
- name: Checkout
|
|
52
|
+
uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 # v5.1.0
|
|
53
|
+
with:
|
|
54
|
+
persist-credentials: false
|
|
55
|
+
|
|
56
|
+
- name: Install uv
|
|
57
|
+
uses: astral-sh/setup-uv@37802adc94f370d6bfd71619e3f0bf239e1f3b78 # v7.6.0
|
|
58
|
+
with:
|
|
59
|
+
enable-cache: false
|
|
60
|
+
|
|
61
|
+
- name: Build
|
|
62
|
+
run: uv build
|
|
63
|
+
|
|
64
|
+
- name: Check metadata
|
|
65
|
+
run: uvx twine check --strict dist/*
|
|
66
|
+
|
|
67
|
+
- name: Install the wheel in a fresh venv
|
|
68
|
+
run: |
|
|
69
|
+
uv venv "$RUNNER_TEMP/venv"
|
|
70
|
+
uv pip install --python "$RUNNER_TEMP/venv/bin/python" dist/*.whl
|
|
71
|
+
"$RUNNER_TEMP/venv/bin/dist-precheck" --help
|
|
72
|
+
"$RUNNER_TEMP/venv/bin/dist-precheck" --version
|
|
73
|
+
|
|
74
|
+
- name: Action step test (offline and online)
|
|
75
|
+
run: bash tests/action-test.sh
|
|
76
|
+
|
|
77
|
+
- name: Use the action on its own dists
|
|
78
|
+
uses: ./
|
|
79
|
+
with:
|
|
80
|
+
path: dist
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
3.11
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## [1.0.0] - 2026-12-05
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
|
|
12
|
+
- Name check for first uploads. When the project is not on PyPI yet, dist-precheck applies the rules PyPI uses before it creates a project: a valid name, not a stdlib module (including dotted submodules such as `os.path`), not taken, and not "too similar to an existing project" (drop `.`, `_` and `-`, read `l` and `i` as `1` and `o` as `0`)
|
|
13
|
+
- `dist-precheck name <project>` checks a name before you build anything
|
|
14
|
+
- Free alternatives for a refused or taken name, checked with the same rules. `--no-suggest` turns them off
|
|
15
|
+
- `--no-name-check` and the action input `name-check: false` for offline runs
|
|
16
|
+
- Archive checks from PyPI's 18 Nov 2026 rules: ZIP data descriptors, trailing or prepended bytes, member comments, duplicate entries, bad file names, `linux_x86_64` tags, and V7, sparse or vendor-pax tar members. Archive-level ZIP comments and GNU tarballs are warnings
|
|
17
|
+
- GitHub Action (`ysskrishna/dist-precheck@v1`) with `path` and `name-check` inputs
|
|
18
|
+
- `--help` and `--version`
|
|
19
|
+
- Zero runtime dependencies
|
|
20
|
+
- Python 3.9+
|
|
21
|
+
|
|
22
|
+
[1.0.0]: https://github.com/ysskrishna/dist-precheck/releases/tag/v1.0.0
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
# Contributing to dist-precheck
|
|
2
|
+
|
|
3
|
+
Thank you for your interest in contributing to `dist-precheck`! This document provides guidelines and instructions for contributing.
|
|
4
|
+
|
|
5
|
+
## Getting Started
|
|
6
|
+
|
|
7
|
+
### Prerequisites
|
|
8
|
+
|
|
9
|
+
- Python 3.11 or higher
|
|
10
|
+
- [uv](https://github.com/astral-sh/uv)
|
|
11
|
+
|
|
12
|
+
### Setting Up the Development Environment
|
|
13
|
+
|
|
14
|
+
1. **Clone the repository**:
|
|
15
|
+
```bash
|
|
16
|
+
git clone https://github.com/ysskrishna/dist-precheck.git
|
|
17
|
+
cd dist-precheck
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
2. **Install dependencies**:
|
|
21
|
+
```bash
|
|
22
|
+
uv sync --locked --dev
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
3. **Verify the setup**:
|
|
26
|
+
```bash
|
|
27
|
+
uv run pytest
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Development Workflow
|
|
31
|
+
|
|
32
|
+
### Running Tests
|
|
33
|
+
|
|
34
|
+
Run the test suite to ensure everything works:
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
uv run pytest
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
Run a specific test file:
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
uv run pytest tests/test_names.py
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
### Code Style
|
|
47
|
+
|
|
48
|
+
- Follow [PEP 8](https://pep8.org/) style guidelines
|
|
49
|
+
- Keep the package on the Python standard library only (no runtime dependencies) and working on Python 3.9
|
|
50
|
+
- Keep functions simple and focused
|
|
51
|
+
- Add docstrings to all public functions
|
|
52
|
+
|
|
53
|
+
### Changing a check
|
|
54
|
+
|
|
55
|
+
Every check lives in `dist_precheck/__init__.py`: `check_wheel()` and `check_sdist()` for archives, `check_name()` and `suggest_names()` for names. The action in `action.yml` only calls the CLI.
|
|
56
|
+
|
|
57
|
+
1. Add a failing test in `tests/` for the archive or the name
|
|
58
|
+
2. Change the check
|
|
59
|
+
3. Run `uv run pytest`
|
|
60
|
+
4. If you touched `action.yml`, build the package with `uv build` and run `bash tests/action-test.sh` (it needs network for the name check)
|
|
61
|
+
5. Open a pull request into `main`
|
|
62
|
+
|
|
63
|
+
`python tests/validate_real.py` checks the name rules against names PyPI really refused. It downloads the PyPI simple index (about 10 MB) and is not part of the unit tests.
|
|
64
|
+
|
|
65
|
+
## Submitting Changes
|
|
66
|
+
|
|
67
|
+
### Pull Request Process
|
|
68
|
+
|
|
69
|
+
1. **Create a branch**:
|
|
70
|
+
```bash
|
|
71
|
+
git checkout -b feature/your-feature-name
|
|
72
|
+
# or
|
|
73
|
+
git checkout -b fix/your-fix-name
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
2. **Make your changes**:
|
|
77
|
+
- Write your code
|
|
78
|
+
- Add tests for new functionality
|
|
79
|
+
- Ensure all tests pass
|
|
80
|
+
- Update documentation if needed
|
|
81
|
+
|
|
82
|
+
3. **Commit your changes**:
|
|
83
|
+
```bash
|
|
84
|
+
git add .
|
|
85
|
+
git commit -m "Description of your changes"
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
Use clear, descriptive commit messages. Follow the format:
|
|
89
|
+
- `feat: add new feature`
|
|
90
|
+
- `fix: fix bug description`
|
|
91
|
+
- `docs: update documentation`
|
|
92
|
+
- `test: add tests for feature`
|
|
93
|
+
- `refactor: improve code structure`
|
|
94
|
+
|
|
95
|
+
4. **Push to your fork**:
|
|
96
|
+
```bash
|
|
97
|
+
git push origin feature/your-feature-name
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
5. **Create a Pull Request** into `main`:
|
|
101
|
+
- Go to the repository on GitHub
|
|
102
|
+
- Click "New Pull Request"
|
|
103
|
+
- Select your branch
|
|
104
|
+
- Fill out the PR description with:
|
|
105
|
+
- Description of changes
|
|
106
|
+
- Related issues (if any)
|
|
107
|
+
- Testing instructions
|
|
108
|
+
|
|
109
|
+
### Pull Request Guidelines
|
|
110
|
+
|
|
111
|
+
- Keep PRs focused on a single feature or fix
|
|
112
|
+
- Ensure all tests pass
|
|
113
|
+
- Update documentation if you're adding new features
|
|
114
|
+
- Write clear commit messages
|
|
115
|
+
- Reference any related issues
|
|
116
|
+
|
|
117
|
+
## Reporting Issues
|
|
118
|
+
|
|
119
|
+
When reporting issues, please include:
|
|
120
|
+
|
|
121
|
+
- Python version
|
|
122
|
+
- Package version
|
|
123
|
+
- Operating system and version
|
|
124
|
+
- Steps to reproduce
|
|
125
|
+
- Expected behavior
|
|
126
|
+
- Actual behavior
|
|
127
|
+
- Any relevant error messages or stack traces
|
|
128
|
+
|
|
129
|
+
## Code of Conduct
|
|
130
|
+
|
|
131
|
+
- Be respectful and considerate
|
|
132
|
+
- Welcome newcomers and help them learn
|
|
133
|
+
- Focus on constructive feedback
|
|
134
|
+
- Be open to feedback and suggestions
|
|
135
|
+
|
|
136
|
+
## Questions?
|
|
137
|
+
|
|
138
|
+
If you have questions about contributing, feel free to:
|
|
139
|
+
|
|
140
|
+
- Open an issue on GitHub
|
|
141
|
+
- Check existing issues and discussions
|
|
142
|
+
|
|
143
|
+
Thank you for contributing to `dist-precheck`!
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Y. Siva Sai Krishna
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: dist-precheck
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: Fail a Python release before upload if PyPI would reject it: archive format problems, or a first-upload name that is taken, a stdlib module, or too similar to an existing project.
|
|
5
|
+
Project-URL: Homepage, https://github.com/ysskrishna/dist-precheck
|
|
6
|
+
Project-URL: Repository, https://github.com/ysskrishna/dist-precheck.git
|
|
7
|
+
Project-URL: Issues, https://github.com/ysskrishna/dist-precheck/issues
|
|
8
|
+
Project-URL: Changelog, https://github.com/ysskrishna/dist-precheck/blob/main/CHANGELOG.md
|
|
9
|
+
Author-email: "Y. Siva Sai Krishna" <sivasaikrishnassk@gmail.com>
|
|
10
|
+
License: MIT
|
|
11
|
+
License-File: LICENSE
|
|
12
|
+
Keywords: github-action,packaging,pypi,release,sdist,twine,wheel
|
|
13
|
+
Classifier: Development Status :: 4 - Beta
|
|
14
|
+
Classifier: Environment :: Console
|
|
15
|
+
Classifier: Intended Audience :: Developers
|
|
16
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
17
|
+
Classifier: Operating System :: OS Independent
|
|
18
|
+
Classifier: Programming Language :: Python :: 3
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
23
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
24
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
25
|
+
Classifier: Topic :: Software Development :: Build Tools
|
|
26
|
+
Classifier: Topic :: System :: Archiving :: Packaging
|
|
27
|
+
Requires-Python: >=3.9
|
|
28
|
+
Description-Content-Type: text/markdown
|
|
29
|
+
|
|
30
|
+
# dist-precheck
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
[](https://www.python.org/downloads/)
|
|
34
|
+
[](https://github.com/ysskrishna/dist-precheck/blob/main/LICENSE)
|
|
35
|
+
[](https://github.com/ysskrishna/dist-precheck/actions/workflows/test.yml)
|
|
36
|
+
[](https://pypi.org/project/dist-precheck/)
|
|
37
|
+
[](https://pepy.tech/projects/dist-precheck)
|
|
38
|
+
[](https://ysskrishna.space)
|
|
39
|
+
[](https://context7.com/ysskrishna/dist-precheck)
|
|
40
|
+
[](https://deepwiki.com/ysskrishna/dist-precheck)
|
|
41
|
+
|
|
42
|
+
Fail a Python release before upload when PyPI would reject it.
|
|
43
|
+
|
|
44
|
+
## Features
|
|
45
|
+
|
|
46
|
+
- **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
|
|
47
|
+
- **Free alternatives**: a refused or taken name comes with up to five names that pass the same rules
|
|
48
|
+
- **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)
|
|
49
|
+
- **CLI and GitHub Action**: run it on your machine or as the step before `pypa/gh-action-pypi-publish`
|
|
50
|
+
- **Zero dependencies**: only the Python standard library, Python 3.9+
|
|
51
|
+
- **Offline mode**: `--no-name-check` runs the archive checks without network access
|
|
52
|
+
|
|
53
|
+
## Why dist-precheck?
|
|
54
|
+
|
|
55
|
+
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.
|
|
56
|
+
|
|
57
|
+
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.
|
|
58
|
+
|
|
59
|
+
`twine check` validates metadata only. PyPI has been tightening what it accepts in the archive itself ([blog, 18 Nov 2026](https://blog.pypi.org/posts/2026-11-18-stricter-checks-for-uploaded-sdists/), [docs.pypi.org/archives](https://docs.pypi.org/archives/)), and dist-precheck checks those rules too.
|
|
60
|
+
|
|
61
|
+
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`.
|
|
62
|
+
|
|
63
|
+
## Installation
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
pip install dist-precheck
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
Or run it without installing:
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
pipx run dist-precheck --help
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
## Usage Examples
|
|
76
|
+
|
|
77
|
+
### Check a name before you build
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
dist-precheck name RedStar puremath json dist-precheck
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
```
|
|
84
|
+
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
|
|
85
|
+
free alternatives (same rules): redstar-py, redstar-kit, redstar-tool, redstar-lib, redstar-sdk
|
|
86
|
+
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
|
|
87
|
+
free alternatives (same rules): puremath-py, puremath-kit, puremath-tool, puremath-lib, puremath-sdk
|
|
88
|
+
STDLIB 'json' matches a Python standard-library module; PyPI refuses it
|
|
89
|
+
free alternatives (same rules): json-sdk, json-core, json-dev, json-hq
|
|
90
|
+
FREE 'dist-precheck' is free and passes PyPI's public name rules (admin-prohibited names can't be checked)
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
The exit code is 1 when any name would be refused. Add `--no-suggest` to skip the alternatives.
|
|
94
|
+
|
|
95
|
+
### Check built distributions
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
python -m build
|
|
99
|
+
dist-precheck dist/*
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
```
|
|
103
|
+
OK dist_precheck-1.0.0-py3-none-any.whl
|
|
104
|
+
OK dist_precheck-1.0.0.tar.gz
|
|
105
|
+
NAME dist-precheck: FREE 'dist-precheck' is free and passes PyPI's public name rules (admin-prohibited names can't be checked)
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
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.
|
|
109
|
+
|
|
110
|
+
## Use as a GitHub Action
|
|
111
|
+
|
|
112
|
+
Add the action between the build step and the publish step:
|
|
113
|
+
|
|
114
|
+
```yaml
|
|
115
|
+
jobs:
|
|
116
|
+
release:
|
|
117
|
+
runs-on: ubuntu-latest
|
|
118
|
+
environment: pypi
|
|
119
|
+
permissions:
|
|
120
|
+
id-token: write
|
|
121
|
+
steps:
|
|
122
|
+
- uses: actions/checkout@v5
|
|
123
|
+
- uses: actions/setup-python@v6
|
|
124
|
+
with:
|
|
125
|
+
python-version: "3.13"
|
|
126
|
+
- run: python -m pip install build && python -m build
|
|
127
|
+
- uses: ysskrishna/dist-precheck@v1
|
|
128
|
+
- uses: pypa/gh-action-pypi-publish@release/v1
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
The step fails, and the upload never runs, when PyPI would reject a file or the name.
|
|
132
|
+
|
|
133
|
+
| Input | Default | Description |
|
|
134
|
+
|-------|---------|-------------|
|
|
135
|
+
| `path` | `dist` | Directory with the built `.whl` and `.tar.gz` files |
|
|
136
|
+
| `name-check` | `true` | On a first upload, check the project name against PyPI's rules. Set `false` on runners without network access |
|
|
137
|
+
|
|
138
|
+
The action runs with the runner's `python3` (3.9 or newer) and installs nothing.
|
|
139
|
+
|
|
140
|
+
## What it checks
|
|
141
|
+
|
|
142
|
+
| Check | Level |
|
|
143
|
+
|---|---|
|
|
144
|
+
| First upload: invalid name, stdlib module name, taken, too similar to an existing project | ERROR |
|
|
145
|
+
| ZIP data descriptors (`400 ... ZIP contains a data descriptor`) | ERROR |
|
|
146
|
+
| Trailing or prepended bytes, member comments, duplicate entries, non-UTF-8 or control-character names, central-directory gaps | ERROR |
|
|
147
|
+
| `linux_x86_64`-style platform tags (`400 ... unsupported platform tag`) | ERROR |
|
|
148
|
+
| V7 tar headers, GNU and pax sparse members, pax vendor extensions (`SCHILY.*`, `LIBARCHIVE.*`) | ERROR |
|
|
149
|
+
| Archive-level ZIP comment, GNU-format tarball | WARN (PyPI says it will reject these next) |
|
|
150
|
+
|
|
151
|
+
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.
|
|
152
|
+
|
|
153
|
+
## CLI Reference
|
|
154
|
+
|
|
155
|
+
| Command | Description |
|
|
156
|
+
|---------|-------------|
|
|
157
|
+
| `dist-precheck <files>...` | Check wheels and sdists, then the project name on a first upload. Exit 1 on any ERROR. |
|
|
158
|
+
| `dist-precheck <files>... --no-name-check` | Archive checks only. No network access. |
|
|
159
|
+
| `dist-precheck name <project>...` | Check one or more names against PyPI's rules. Exit 1 if any would be refused. |
|
|
160
|
+
| `dist-precheck name <project>... --no-suggest` | Same, without free alternatives. |
|
|
161
|
+
| `dist-precheck --help` / `--version` | Print usage or the version. |
|
|
162
|
+
|
|
163
|
+
The simple index is cached for a day in `$XDG_CACHE_HOME/dist-precheck` (default `~/.cache/dist-precheck`).
|
|
164
|
+
|
|
165
|
+
## Learn More
|
|
166
|
+
|
|
167
|
+
- [PyPI blog: Stricter checks for uploaded distributions (18 Nov 2026)](https://blog.pypi.org/posts/2026-11-18-stricter-checks-for-uploaded-sdists/)
|
|
168
|
+
- [PyPI docs: archive requirements](https://docs.pypi.org/archives/)
|
|
169
|
+
- [Warehouse project name checks](https://github.com/pypi/warehouse/blob/main/warehouse/packaging/services.py)
|
|
170
|
+
- [PEP 691: JSON-based Simple API](https://peps.python.org/pep-0691/)
|
|
171
|
+
|
|
172
|
+
## Acknowledgments
|
|
173
|
+
|
|
174
|
+
- [stdlib-list](https://github.com/pypi/stdlib-list) (MIT), the source of the stdlib name list, the same one Warehouse uses
|
|
175
|
+
- [Warehouse](https://github.com/pypi/warehouse), for the name rules this tool mirrors
|
|
176
|
+
|
|
177
|
+
## Contributing
|
|
178
|
+
|
|
179
|
+
We welcome contributions! Please see our [Contributing Guide](https://github.com/ysskrishna/dist-precheck/blob/main/CONTRIBUTING.md) for details.
|
|
180
|
+
|
|
181
|
+
## Built and maintained by
|
|
182
|
+
|
|
183
|
+
dist-precheck is built and maintained by:
|
|
184
|
+
|
|
185
|
+
| | Name | GitHub | Role |
|
|
186
|
+
|---|------|--------|------|
|
|
187
|
+
| <img src="https://github.com/ysskrishna.png?size=120" width="60" height="60" alt="Y. Siva Sai Krishna"> | **Y. Siva Sai Krishna** | [@ysskrishna](https://github.com/ysskrishna) | Creator |
|
|
188
|
+
|
|
189
|
+
## Changelog
|
|
190
|
+
|
|
191
|
+
See [CHANGELOG](CHANGELOG.md) for release history.
|
|
192
|
+
|
|
193
|
+
## Support
|
|
194
|
+
|
|
195
|
+
If you find this tool helpful:
|
|
196
|
+
|
|
197
|
+
- ⭐ Star the repository
|
|
198
|
+
- 🐛 [Report issues](https://github.com/ysskrishna/dist-precheck/issues)
|
|
199
|
+
- 🔀 Submit pull requests
|
|
200
|
+
- 💝 [Sponsor on GitHub](https://github.com/sponsors/ysskrishna)
|
|
201
|
+
|
|
202
|
+
## License
|
|
203
|
+
|
|
204
|
+
MIT © [Y. Siva Sai Krishna](https://github.com/ysskrishna) - see [LICENSE](LICENSE) for details.
|
|
205
|
+
|
|
206
|
+
---
|
|
207
|
+
|
|
208
|
+
<p align="left">
|
|
209
|
+
<a href="https://github.com/ysskrishna">Author's GitHub</a> •
|
|
210
|
+
<a href="https://linkedin.com/in/ysskrishna">Author's LinkedIn</a> •
|
|
211
|
+
<a href="https://ysskrishna.space">Author's site</a> •
|
|
212
|
+
<a href="https://pypi.org/project/dist-precheck/">Package on PyPI</a> •
|
|
213
|
+
<a href="https://github.com/ysskrishna/dist-precheck/issues">Report Issues</a>
|
|
214
|
+
</p>
|