twine upload sends built Python distributions to PyPI or TestPyPI; twine check validates them
Answer: Create distributions with python -m build, upload to Test PyPI with twine upload -r testpypi dist/, then upload to PyPI with twine upload dist/. Twine is a utility for publishing Python packages to PyPI and other repositories, independent of the build system.
Commands
python -m build
twine check --strict dist/*
twine upload -r testpypi dist/*
twine upload dist/*
twine upload --skip-existing dist/*
Options worth knowing
twine checkreports whether the long description of your distribution will render correctly on PyPI.--config-filesets the.pypircconfig file to use, and-rnames the repository.-u/--usernamehas no effect on PyPI or TestPyPI. The username can also be set via theTWINE_USERNAMEenvironment variable.--non-interactivecan also be set via theTWINE_NON_INTERACTIVEenvironment variable.--skip-existingcontinues uploading files if one already exists; it is only valid when uploading to PyPI.
Why twine
The goal of Twine is to improve PyPI interaction by improving security and testability. It uploads source and binary distribution artifacts for both new and existing projects. Twine does not show any characters when you type a password.
See also
Claims
- id: C1 claim: Twine publishes Python packages to PyPI and other repositories. source: S1 evidence: "Twine is a utility for publishing Python packages to PyPI and other repositories"
- id: C2 claim: twine check verifies the long description renders on PyPI. source: S1 evidence: "long description will render correctly on PyPI"
- id: C3 claim: --skip-existing continues when a file already exists. source: S1 evidence: "Continue uploading files if one already exists."
- id: C4 claim: Twine aims to improve security and testability. source: S2 evidence: "is to improve PyPI interaction by improving security and testability"
Sources
- [S1] Twine documentation. Twine docs (Read the Docs). https://twine.readthedocs.io/en/stable/ . License: Apache-2.0. Accessed 2026-11-18.
- [S2] docs/index.rst (source page). pypa/twine (GitHub). https://github.com/pypa/twine/blob/main/docs/index.rst . License: Apache-2.0. Accessed 2026-11-18.
License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted). Sources: Twine docs (Read the Docs), Twine documentation; pypa/twine (GitHub), docs/index.rst (source page). Apache-2.0 (https://raw.githubusercontent.com/pypa/twine/main/LICENSE). Copyright twine contributors. Text was condensed and changed from the originals.
License: CC-BY-4.0 · Summary by iinventedlight (AI-assisted). Sources: Twine docs (Read the Docs), Twine documentation; pypa/twine (GitHub), docs/index.rst (source page). Apache-2.0 (https://raw.githubusercontent.com/pypa/twine/main/LICENSE). Copyright twine contributors.
Cite this
iinventedlight. 2026. "twine upload sends built Python distributions to PyPI or TestPyPI; twine check validates them." iinventedlight Library, iil:note:9ssw2nze, version of 2026-11-18. https://iinventedlight.com/library/notes/python-twine-upload/. License: CC-BY-4.0.
@misc{iil_note_9ssw2nze,
author = {{iinventedlight}},
title = {{twine upload sends built Python distributions to PyPI or TestPyPI; twine check validates them}},
howpublished = {iinventedlight Library},
year = {2026},
date = {2026-11-18},
url = {https://iinventedlight.com/library/notes/python-twine-upload/},
note = {Permanent ID iil:note:9ssw2nze. License: CC-BY-4.0.},
}
Spotted a mistake? Use the MCP feedback tool or email hello@iinventedlight.com. Or Report a correction (no account needed).
Extra files beside this note
These files use this note's license, shown below. Paper extras retain their reproduction status; a link is not a reproduction.
- python-twine-upload.table.json (table; CC-BY-4.0)
- python-twine-upload.schema.json (schema; CC-BY-4.0)
For language models and agents: start at /llms.txt | /agents.md | /.well-known/agent-library.json. This page in Markdown: /library/notes/python-twine-upload.md.