twine(1)

πŸ“¦
version 6.2.0 Β· 7 versions
, in debian trixie, ubuntu questing, ubuntu resolute, ubuntu stonking

🌸 twine β€” the manual page, but make it cute 🌸

okay bestie, so this is twine(1), from the General Commands Manual section. yeah. section 1. command line stuff. we love her πŸ’…


✨ NAME ✨

twine β€” the client that does uploads on pypi. that's it. that's the whole job 🫢


πŸ’– DESCRIPTION πŸ’–

this command is like, the standard way people upload python modules to pypi.org or any other repo that plays nice with it. iconic behaviour honestly πŸ‘‘


πŸŽ€ NOTES ON PYPI.ORG πŸŽ€

so twine can talk to a bunch of different repositories, right? but the default? pypi.org. and because that's basically everybody's use case, this whole section exists to document all the quirky little things about pypi.org that aren't documented anywhere else. iykyk πŸ’€

πŸ”₯ Upload via token

username and password uploads are literally no longer supported on pypi.org. gone. dead. not a thing anymore. 😭

so if you wanna upload and authenticate with a token, the command looks like this:

twine upload --username __token__ --password `cat .token` dist/

that's the vibe. that's the move. ✨

🎯 Scope limited token

you can grab tokens from the pypi.org website, obviously.

but here's the tea β˜•: if you wanna make a token that's limited to a project that doesn't exist yet, you literally cannot do it directly. you have to:

  1. create a global token first
  2. use that global token to do the very first upload of the project
  3. then delete that global token from the website

and only then can you generate a token that's scoped to that project. the way that works is so extra but okay πŸ’…

πŸ–ŠοΈ Signing

signing is not allowed on pypi.org. periodt.

if you upload something that's signed, pypi.org greets you with a warning email 😬 β€” and the signature files get dropped. not even kept. just gone.

and in the future? they might make the upload straight up fail. so like, heads up fr fr 🚨


⭐ SYNOPSIS ⭐

twine [-h] [--version] [--no-color] [<command>] [args]

✨ Options:

  • -h, --help β€” show the help message and exit. classic. 🫢
  • -v, --version β€” show the version and exit. tell me who you are bestie πŸ‘‘
  • --no-color β€” disable coloured output. for when you want your terminal to be boring. (valid. i respect it.) πŸŽ€

πŸ¦‹ Commands:

🌸 check

usage:

twine check [-h] [--strict] dist [dist ...]

positional arguments:

  • dist β€” The distribution files to check, usually dist/*

options:

  • -h, --help β€” show this help message and exit
  • --strict β€” Fail on warnings

πŸ’œ register

usage:

twine register [-h] [-r REPOSITORY] [--repository-url REPOSITORY_URL] [--attestations] [-s] [--sign-with SIGN_WITH] [-i IDENTITY] [-u USERNAME] [-p PASSWORD] [--non-interactive] [-c COMMENT] [--config-file CONFIG_FILE] [--skip-existing] [--cert path] [--client-cert path] [--verbose] [--disable-progress-bar] package
register operation is not required with PyPI.org

just so you know. you don't need it over there. πŸ™ˆ

positional arguments:

  • package β€” File from which we read the package metadata.

options:

  • -h, --help β€” show this help message and exit
  • -r REPOSITORY, --repository REPOSITORY β€” The repository (package index) to upload the package to. Should be a section in the config file (default: pypi). (Can also be set via TWINE_REPOSITORY environment variable.)
  • --repository-url REPOSITORY_URL β€” The repository (package index) URL to upload the package to. This overrides --repository. (Can also be set via TWINE_REPOSITORY_URL environment variable.)
  • --attestations β€” Upload each file's associated attestations.
  • -s, --sign β€” Sign files to upload using GPG.
  • --sign-with SIGN_WITH β€” GPG program used to sign uploads (default: gpg).
  • -i IDENTITY, --identity IDENTITY β€” GPG identity used to sign files.
  • -u USERNAME, --username USERNAME β€” The username to authenticate to the repository (package index) as. (Can also be set via TWINE_USERNAME environment variable.)
  • -p PASSWORD, --password PASSWORD β€” The password to authenticate to the repository (package index) with. (Can also be set via TWINE_PASSWORD environment variable.)
  • --non-interactive β€” Do not interactively prompt for username/password if the required credentials are missing. (Can also be set via TWINE_NON_INTERACTIVE environment variable.)
  • -c COMMENT, --comment COMMENT β€” The comment to include with the distribution file.
  • --config-file CONFIG_FILE β€” The .pypirc config file to use.
  • --skip-existing β€” Continue uploading files if one already exists. (Only valid when uploading to PyPI. Other implementations may not support this.)
  • --cert path β€” Path to alternate CA bundle (can also be set via TWINE_CERT environment variable).
  • --client-cert path β€” Path to SSL client certificate, a single file containing the private key and the certificate in PEM format.
  • --verbose β€” Show verbose output.
  • --disable-progress-bar β€” Disable the progress bar.

🌈 upload

usage:

twine upload [-h] [-r REPOSITORY] [--repository-url REPOSITORY_URL] [--attestations] [-s] [--sign-with SIGN_WITH] [-i IDENTITY] [-u USERNAME] [-p PASSWORD] [--non-interactive] [-c COMMENT] [--config-file CONFIG_FILE] [--skip-existing] [--cert path] [--client-cert path] [--verbose] [--disable-progress-bar] dist [dist ...]

positional arguments:

  • dist β€” The distribution files to upload to the repository (package index). Usually dist/* . May additionally contain a .asc file to include an existing signature with the file upload.

options:

  • -h, --help β€” show this help message and exit
  • -r REPOSITORY, --repository REPOSITORY β€” The repository (package index) to upload the package to. Should be a section in the config file (default: pypi). (Can also be set via TWINE_REPOSITORY environment variable.)
  • --repository-url REPOSITORY_URL β€” The repository (package index) URL to upload the package to. This overrides --repository. (Can also be set via TWINE_REPOSITORY_URL environment variable.)
  • --attestations β€” Upload each file's associated attestations.
  • -s, --sign β€” Sign files to upload using GPG.
  • --sign-with SIGN_WITH β€” GPG program used to sign uploads (default: gpg).
  • -i IDENTITY, --identity IDENTITY β€” GPG identity used to sign files.
  • -u USERNAME, --username USERNAME β€” The username to authenticate to the repository (package index) as. (Can also be set via TWINE_USERNAME environment variable.)
  • -p PASSWORD, --password PASSWORD β€” The password to authenticate to the repository (package index) with. (Can also be set via TWINE_PASSWORD environment variable.)
  • --non-interactive β€” Do not interactively prompt for username/password if the required credentials are missing. (Can also be set via TWINE_NON_INTERACTIVE environment variable.)
  • -c COMMENT, --comment COMMENT β€” The comment to include with the distribution file.
  • --config-file CONFIG_FILE β€” The .pypirc config file to use.
  • --skip-existing β€” Continue uploading files if one already exists. (Only valid when uploading to PyPI. Other implementations may not support this.)
  • --cert path β€” Path to alternate CA bundle (can also be set via TWINE_CERT environment variable).
  • --client-cert path β€” Path to SSL client certificate, a single file containing the private key and the certificate in PEM format.
  • --verbose β€” Show verbose output.
  • --disable-progress-bar β€” Disable the progress bar.

🌱 ENVIRONMENT 🌱

all of these can be used instead of the command line options. so if you're the kind of person who sets env vars and forgets, this is for you bestie πŸ’–

  • TWINE_USERNAME
  • TWINE_PASSWORD
  • TWINE_REPOSITORY_URL
  • TWINE_REPOSITORY
  • TWINE_CERT
  • TWINE_NON_INTERACTIVE

πŸ‘€ SEE ALSO πŸ‘€

(yeah. section 3. don't ask. just go look. πŸ¦‹)


πŸ’Œ AUTHOR πŸ’Œ

this manual page was written for Debian by Salvo 'LtWorf' Tomaselli <ltworf@debian.org> β€” but it may freely be used by others. so generous. we love that for us 🫢✨


and that's the whole page bestie!! no cap, you now know everything this manpage knows πŸ’…

twine β€” "Client to upload on pypi" β€” dated Sep 13, 2024 β€” page twine(1), and she ate, periodt πŸ‘‘πŸŒˆ

πŸ“¦ where this page comes from