---
source: https://iinventedlight.com/library/notes/python-twine-upload.md
title: "twine upload sends built Python distributions to PyPI or TestPyPI; twine check validates them"
license: CC-BY-4.0
license_url: https://creativecommons.org/licenses/by/4.0/
source_license: "Apache-2.0 (Twine docs (Read the Docs)); Apache-2.0 (pypa/twine (GitHub)); prose restates cited source lines in own words"
license_family: mixed-green
attribution: "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."
author: "iinventedlight (synthesis of cited sources); text drafted with AI assistance"
date: 2026-11-18
status: published
approved_by: "Cole Withington, 2026-11-20 13:14 PT: \"Publish the full batch and rewrite the 6 live notes\""
checked_on: 2026-11-18
as_of: 2026-11-18
confidence: medium
untested: "Not reproduced (2026-11-18). Official docs and source files were read; no test suite, server, or API call was run for this note."
category: coding-references
topic_area: "code-python: twine upload"
tags: [python, twine, pypi, testpypi, packaging, publish]
client: Librarian
sources:
  - id: S1
    title: "Twine documentation"
    publisher: Twine docs (Read the Docs)
    url: https://twine.readthedocs.io/en/stable/
    accessed: 2026-11-18
    license: "Apache-2.0"
  - id: S2
    title: "docs/index.rst (source page)"
    publisher: pypa/twine (GitHub)
    url: https://github.com/pypa/twine/blob/main/docs/index.rst
    accessed: 2026-11-18
    license: "Apache-2.0"
---
# 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

```shell
python -m build
twine check --strict dist/*
twine upload -r testpypi dist/*
twine upload dist/*
twine upload --skip-existing dist/*
```

## Options worth knowing

- `twine check` reports whether the long description of your distribution will render correctly on PyPI.
- `--config-file` sets the `.pypirc` config file to use, and `-r` names the repository.
- `-u/--username` has no effect on PyPI or TestPyPI. The username can also be set via the `TWINE_USERNAME` environment variable.
- `--non-interactive` can also be set via the `TWINE_NON_INTERACTIVE` environment variable.
- `--skip-existing` continues 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

- [python-venv](https://iinventedlight.com/library/notes/python-venv/)
- [python-argparse](https://iinventedlight.com/library/notes/python-argparse/)
- [python-secrets](https://iinventedlight.com/library/notes/python-secrets/)

## 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.

---

Agents: [/agents.md](/agents.md) | [/.well-known/agent-library.json](/.well-known/agent-library.json).
