Differences between revisions 6 and 12 (spanning 6 versions)
Revision 6 as of 2014-05-25 22:05:08
Size: 1013
Comment: spam
Revision 12 as of 2017-05-23 03:12:20
Size: 1967
Editor: NickCoghlan
Comment: Update based on comments in https://github.com/pypa/python-packaging-user-guide/issues/309#issuecomment-303214123
Deletions are marked like this. Additions are marked like this.
Line 2: Line 2:
Line 17: Line 16:
    test     testpypi
Line 19: Line 18:
[test] [testpypi]
Line 21: Line 20:
username = richard
password = <your password goes here>
username = <your user name goes here>
password = <your test password goes here>
Line 25: Line 24:
repository = http://pypi.python.org/pypi
username = richard
password = <your password goes here>
username = <your user name goes here>
password = <your live password optionally goes here>
}}}
/* We omit the live repository URL for consistency with https://packaging.python.org/distributing/#create-an-account
 *
 * This better allows tools to manage the default URL of the live service without having to account for config
 * files still using the old settings.
 */
3. Use the test server URL to register your project (it gives you the right to modify your project on the server):

{{{
   python setup.py register -r https://testpypi.python.org/pypi
Line 30: Line 38:
3. Then use the test server URL when uploading or installing packages: Note that the test server uses an older implementation of the upload interface and hence does ''not'' support auto-registration the way the live service does when using twine's default configuration.

4. Then upload it using twine:
Line 33: Line 43:
   python setup.py upload -r https://testpypi.python.org/pypi    twine upload dist/* -r testpypi
Line 35: Line 45:
To install packages from it:
Now that your project is on the server, test that you can install your package from testpypi (it may be a good idea to run your unit tests from another directory to make sure you are using the version you just installed):
Line 39: Line 51:
If you need to push your project again, change the version number in `setup.py` otherwise the server will give you an error.

Test PyPI Server

Just learning the packaging ropes or trying some system integration out?

Why not use our new test PyPI server at https://testpypi.python.org/pypi

To upload packages to it you need to:

1. Register with the site. It has a different user database than the main PyPI server. It also gets cleaned out on a semi-regular basis.

2. Fill in your test PyPI credentials in your ~/.pypirc file. You should end up with something like this:

[distutils]
index-servers=
    pypi
    testpypi

[testpypi]
repository = https://testpypi.python.org/pypi
username = <your user name goes here>
password = <your test password goes here>

[pypi]
username = <your user name goes here>
password = <your live password optionally goes here>

  • This better allows tools to manage the default URL of the live service without having to account for config
  • files still using the old settings.

3. Use the test server URL to register your project (it gives you the right to modify your project on the server):

   python setup.py register -r https://testpypi.python.org/pypi

Note that the test server uses an older implementation of the upload interface and hence does not support auto-registration the way the live service does when using twine's default configuration.

4. Then upload it using twine:

   twine upload dist/* -r testpypi

Now that your project is on the server, test that you can install your package from testpypi (it may be a good idea to run your unit tests from another directory to make sure you are using the version you just installed):

    pip install -i https://testpypi.python.org/pypi <package name>

If you need to push your project again, change the version number in setup.py otherwise the server will give you an error.

TestPyPI (last edited 2017-08-11 17:49:12 by rsyring)

Unable to edit the page? See the FrontPage for instructions.