twine
TLDR
Upload package to PyPI
SYNOPSIS
twine [upload] [check] [-r repository] [-u user] [options] files
DESCRIPTION
twine uploads Python packages to PyPI and other package indexes. It's the recommended tool for publishing Python packages.
Package files (.tar.gz and .whl) in the dist directory are uploaded. These are created by build tools like build or setuptools.
Check mode validates package metadata before upload. It catches common issues that would cause upload failure.
TestPyPI allows testing the upload process without affecting the real PyPI. Packages can be installed from TestPyPI to verify.
Authentication uses username/password, API tokens, or keyring integration. API tokens are recommended for security.
HTTPS is always used for uploads. Previous tools allowed insecure uploads, which twine explicitly prevents.
PARAMETERS
upload FILES
Upload packages.check FILES
Check package metadata.-r REPO, --repository REPO
Target repository (pypi, testpypi, or URL).--repository-url URL
Repository URL.-u USER, --username USER
Username.-p PASS, --password PASS
Password.--non-interactive
Don't prompt for credentials.-s, --sign
Sign files with GPG.-c FILE, --config-file FILE
Config file.--skip-existing
Skip already-uploaded files.--verbose
Verbose output.
CAVEATS
Package names are permanent on PyPI. Version numbers can't be reused. Credentials need secure handling. Package must pass validation.
HISTORY
Twine was created by the Python Packaging Authority around 2013 to replace the insecure upload mechanism in setuptools. It ensures all uploads use HTTPS.
SEE ALSO
pip(1), build(1), setuptools(1), flit(1)
