3 ***************************************
4 Uploading Packages to the Package Index
5 ***************************************
9 The Python Package Index (PyPI) not only stores the package info, but also the
10 package data if the author of the package wishes to. The distutils command
11 :command:`upload` pushes the distribution files to PyPI.
13 The command is invoked immediately after building one or more distribution
14 files. For example, the command ::
16 python setup.py sdist bdist_wininst upload
18 will cause the source distribution and the Windows installer to be uploaded to
19 PyPI. Note that these will be uploaded even if they are built using an earlier
20 invocation of :file:`setup.py`, but that only distributions named on the command
21 line for the invocation including the :command:`upload` command are uploaded.
23 The :command:`upload` command uses the username, password, and repository URL
24 from the :file:`$HOME/.pypirc` file (see section :ref:`pypirc` for more on this
25 file). If a :command:`register` command was previously called in the same command,
26 and if the password was entered in the prompt, :command:`upload` will reuse the
27 entered password. This is useful if you do not want to store a clear text
28 password in the :file:`$HOME/.pypirc` file.
30 You can specify another PyPI server with the :option:`--repository=*url*` option::
32 python setup.py sdist bdist_wininst upload -r http://example.com/pypi
34 See section :ref:`pypirc` for more on defining several servers.
36 You can use the :option:`--sign` option to tell :command:`upload` to sign each
37 uploaded file using GPG (GNU Privacy Guard). The :program:`gpg` program must
38 be available for execution on the system :envvar:`PATH`. You can also specify
39 which key to use for signing using the :option:`--identity=*name*` option.
41 Other :command:`upload` options include :option:`--repository=<url>` or
42 :option:`--repository=<section>` where *url* is the url of the server and
43 *section* the name of the section in :file:`$HOME/.pypirc`, and
44 :option:`--show-response` (which displays the full response text from the PyPI
45 server for help in debugging upload problems).
50 The ``long_description`` field plays a special role at PyPI. It is used by
51 the server to display a home page for the registered package.
53 If you use the `reStructuredText <http://docutils.sourceforge.net/rst.html>`_
54 syntax for this field, PyPI will parse it and display an HTML output for
55 the package home page.
57 The ``long_description`` field can be attached to a text file located
60 from distutils.core import setup
62 setup(name='Distutils',
63 long_description=open('README.txt'))
65 In that case, `README.txt` is a regular reStructuredText text file located
66 in the root of the package besides `setup.py`.
68 To prevent registering broken reStructuredText content, you can use the
69 :program:`rst2html` program that is provided by the `docutils` package
70 and check the ``long_description`` from the command line::
72 $ python setup.py --long-description | rst2html.py > output.html
74 `docutils` will display a warning if there's something wrong with your syntax.