Page 84 -
P. 84
register and upload
Upload your code to PyPI
You’re ready to rock! The code in your function has been placed in a module,
used to create a distribution and installed into your local copy of Python. To
upload your distribution to PyPI, complete these two steps: command-line
registration with PyPI and command-line uploading.
It might seem strange to have to register with PyPI again, seeing as you just
did this with their website. However, the command-line uploading tool needs
to be made aware of your PyPI Username and Password, and that’s what this
registration does. Don’t worry: you have to do this only once.
Instruct setup to File Edit Window Help Register
$ python3 setup.py register
register your details. running register
running check
We need to know who you are, so please choose either:
Confirm that you 1. use your existing login,
want to use your 2. register as a new user,
just-created PyPI 3. have the server generate a new password for you (and email it to you), or
4. quit
credentials. Your selection [default 1]:
1
Username: hfpython
Password:
Use your PyPI Registering nester to http://pypi.python.org/pypi
settings and save Server response (200): OK
them for future I can store your PyPI login so future submissions will be faster.
use. (the login will be stored in /Users/barryp/.pypirc)
Save your login (y/N)?y
Note: If you try to upload a module called
With your registration details entered and saved, you are now ready to upload
your distribution to PyPI. Another command line does the trick: “nester”, you’ll get an error as that name’s
already taken. §
Instruct setup to File Edit Window Help Upload
upload your software $ python3 setup.py sdist upload
distribution to PyPI. running check
running sdist
reading manifest file ‘MANIFEST’
creating nester-1.0.0
Setup confirms making hard links in nester-1.0.0...
that the upload hard linking nester.py -> nester-1.0.0
hard linking setup.py -> nester-1.0.0
is successful. Your Creating tar archive
distribution is now removing ‘nester-1.0.0’ (and everything under it)
part of PyPI. running upload
Submitting dist/nester-1.0.0.tar.gz to http://pypi.python.org/pypi
Server response (200): OK
$
48 Chapter 2