HTTP/2 302
date: Tue, 30 Dec 2025 17:41:11 GMT
content-type: text/html; charset=utf-8
content-length: 0
location: https://packaging.python.org/en/latest/guides/using-testpypi
server: cloudflare
cf-ray: 9b635398abf1c1ae-BLR
cf-cache-status: EXPIRED
cache-control: max-age=1200
content-language: en
vary: Accept-Language, Accept-Encoding
cdn-cache-control: public
cross-origin-opener-policy: same-origin
referrer-policy: no-referrer-when-downgrade
x-backend: web-i-094765eed6622a07e
x-content-type-options: nosniff
x-rtd-domain: packaging.python.org
x-rtd-force-addons: true
x-rtd-project: python-packaging-user-guide
x-rtd-project-method: custom_domain
x-rtd-redirect: user
x-rtd-version-method: path
x-served: Proxito-404
set-cookie: __cf_bm=_54QPIqzmVnnmCoxSGCY8X8JTk.lFTxdsaFQ2V.7vYU-1767116471-1.0.1.1-ZwV4my2g9JknFIzFUEDW_o7jT3QOApzxP2qxqc4utQYjdUjKNgwXmwwMgREj3tFVCyG04_eBFoRCSrfoApP39mNO3g9T9kMtBQRZi0BkdvI; path=/; expires=Tue, 30-Dec-25 18:11:11 GMT; domain=.packaging.python.org; HttpOnly; Secure; SameSite=None
set-cookie: _cfuvid=g6GcDODSOQss15QM9LDBQyLrs8uftbiDsz5RqUOmy_Q-1767116471521-0.0.1.1-604800000; path=/; domain=.packaging.python.org; HttpOnly; Secure; SameSite=None
alt-svc: h3=":443"; ma=86400
HTTP/2 302
date: Tue, 30 Dec 2025 17:41:12 GMT
content-type: text/html; charset=utf-8
content-length: 0
server: cloudflare
location: /en/latest/guides/using-testpypi/
cf-ray: 9b63539b0cb8c1ae-BLR
cf-cache-status: MISS
access-control-allow-origin: *
cache-control: max-age=1200
content-language: en
vary: Accept-Language, Accept-Encoding
access-control-allow-methods: HEAD, OPTIONS, GET
cdn-cache-control: public
cross-origin-opener-policy: same-origin
referrer-policy: no-referrer-when-downgrade
x-backend: web-i-0a16560de9a28e757
x-content-type-options: nosniff
x-rtd-domain: packaging.python.org
x-rtd-force-addons: true
x-rtd-project: python-packaging-user-guide
x-rtd-project-method: custom_domain
x-rtd-resolver-filename: /guides/using-testpypi
x-rtd-version: latest
x-rtd-version-method: path
x-served: Proxito-404
alt-svc: h3=":443"; ma=86400
HTTP/2 200
date: Tue, 30 Dec 2025 17:41:13 GMT
content-type: text/html; charset=utf-8
server: cloudflare
cf-ray: 9b6353a17ec4c1ae-BLR
cf-cache-status: HIT
access-control-allow-origin: *
cache-control: max-age=1200
content-encoding: gzip
etag: W/"d2b01e6e9ce954da73ee8e6065cd28da"
last-modified: Tue, 30 Dec 2025 16:43:39 GMT
vary: Accept-Encoding
access-control-allow-methods: HEAD, OPTIONS, GET
cdn-cache-control: public
cross-origin-opener-policy: same-origin
referrer-policy: no-referrer-when-downgrade
x-amz-id-2: 38O9S0vBdEjYOKxket4aqSaEur2urh09mTdpVQa+GZiQ6BIYsSZF0BUzMrqFuiJV/qtSMIln8Go=
x-amz-meta-mtime: 1767113012.32603004
x-amz-request-id: 4086PS3A3QA2FP7B
x-amz-server-side-encryption: AES256
x-backend: web-i-04449c60d97ff5ed6
x-content-type-options: nosniff
x-rtd-domain: packaging.python.org
x-rtd-force-addons: true
x-rtd-path: /proxito/html/python-packaging-user-guide/latest/guides/using-testpypi/index.html
x-rtd-project: python-packaging-user-guide
x-rtd-project-method: custom_domain
x-rtd-resolver-filename: /guides/using-testpypi/
x-rtd-version: latest
x-rtd-version-method: path
x-served: Nginx-Proxito-Sendfile
alt-svc: h3=":443"; ma=86400
Using TestPyPI - Python Packaging User Guide
Contents
Expand
Light mode
Dark mode
Auto light/dark, in light mode
Auto light/dark, in dark mode
Hide table of contents sidebar
Skip to content
Back to top
Toggle Light / Dark / Auto color theme
Toggle table of contents sidebar
Using TestPyPI
TestPyPI is a separate instance of the Python Package Index (PyPI)
that allows you to try out the distribution tools and process without worrying
about affecting the real index. TestPyPI is hosted at
test.pypi.org
Registering your account
Because TestPyPI has a separate database from the live PyPI, you’ll need a
separate user account specifically for TestPyPI. Go to
https://test.pypi.org/account/register/ to register your account.
Note
The database for TestPyPI may be periodically pruned, so it is not
unusual for user accounts to be deleted.
Using TestPyPI with Twine
You can upload your distributions to TestPyPI using twine by specifying
the --repository flag:
twine upload --repository testpypi dist/*
You can see if your package has successfully uploaded by navigating to the URL
https://test.pypi.org/project/<sampleproject> where sampleproject is
the name of your project that you uploaded. It may take a minute or two for
your project to appear on the site.
Using TestPyPI with pip
You can tell pip to download packages from TestPyPI instead of PyPI by
specifying the --index-url flag:
If you want to allow pip to also download packages from PyPI, you can
specify --extra-index-url to point to PyPI. This is useful when the package
you’re testing has dependencies:
Setting up TestPyPI in .pypirc
If you want to avoid being prompted for your username and password every time,
you can configure TestPyPI in your $HOME/.pypirc :
[testpypi]
username = __token__
password = <your TestPyPI API Token>
For more details, see the specification for .pypirc .