Movatterモバイル変換


[0]ホーム

URL:


ContentsMenuExpandLight modeDark modeAuto light/dark, in light modeAuto light/dark, in dark modeSkip to content
Python Packaging User Guide
Python Packaging User Guide
Back to top

Using TestPyPI

TestPyPI is a separate instance of thePython Package Index (PyPI)that allows you to try out the distribution tools and process without worryingabout affecting the real index. TestPyPI is hosted attest.pypi.org

Registering your account

Because TestPyPI has a separate database from the live PyPI, you’ll need aseparate user account specifically for TestPyPI. Go tohttps://test.pypi.org/account/register/ to register your account.

Note

The database for TestPyPI may be periodically pruned, so it is notunusual for user accounts to be deleted.

Using TestPyPI with Twine

You can upload your distributions to TestPyPI usingtwine by specifyingthe--repository flag:

twineupload--repositorytestpypidist/*

You can see if your package has successfully uploaded by navigating to the URLhttps://test.pypi.org/project/<sampleproject> wheresampleproject isthe name of your project that you uploaded. It may take a minute or two foryour project to appear on the site.

Using TestPyPI with pip

You can tellpip to download packages from TestPyPI instead of PyPI byspecifying the--index-url flag:

python3-mpipinstall--index-urlhttps://test.pypi.org/simple/your-package
py -m pip install --index-url https://test.pypi.org/simple/ your-package

If you want to allow pip to also download packages from PyPI, you canspecify--extra-index-url to point to PyPI. This is useful when the packageyou’re testing has dependencies:

python3-mpipinstall--index-urlhttps://test.pypi.org/simple/--extra-index-urlhttps://pypi.org/simple/your-package
py -m pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple/ your-package

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 thespecification for.pypirc.

On this page

[8]ページ先頭

©2009-2026 Movatter.jp