twine check: Validate Distributions Command Reference
Catch broken package metadata before you publish.
twine check validates the metadata and long-description rendering of built distributions. Running it before twine upload prevents a publish from failing or rendering badly on PyPI.
Common flags / usage
- twine check dist/* -- validate every artifact in dist/
- --strict -- treat rendering warnings as errors
- run after python -m build, before twine upload
Example
shell
- run: python -m build
- run: python -m twine check --strict dist/*In CI
Add twine check --strict as a fast gate after the build step. It flags an unrenderable README or missing metadata so the failure surfaces in seconds rather than on a rejected upload.
Key takeaways
- twine check validates distribution metadata and README rendering.
- --strict turns rendering warnings into failures.
- Run it after build and before upload as a cheap publish gate.
Related guides
twine upload: Publish to PyPI Command ReferenceReference for twine upload in CI: publishing built distributions to PyPI or a private index, token authentica…
python -m build: Build Distributions Command ReferenceReference for python -m build in CI: producing an sdist and wheel in an isolated environment from pyproject.t…
poetry build: Build Artifacts Command ReferenceReference for poetry build in CI: producing a wheel and sdist into dist/ from pyproject.toml, the --format fl…