Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
79333db7
Commit
79333db7
authored
Feb 27, 2013
by
Chris Jerdonek
Browse files
Options
Browse Files
Download
Plain Diff
Issue #16406: Combine the doc pages for uploading and registering to PyPI.
parents
e98631d5
13fb9796
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
122 additions
and
84 deletions
+122
-84
Doc/distutils/index.rst
Doc/distutils/index.rst
+0
-1
Doc/distutils/packageindex.rst
Doc/distutils/packageindex.rst
+115
-6
Doc/distutils/setupscript.rst
Doc/distutils/setupscript.rst
+3
-2
Doc/distutils/uploading.rst
Doc/distutils/uploading.rst
+2
-75
Misc/NEWS
Misc/NEWS
+2
-0
No files found.
Doc/distutils/index.rst
View file @
79333db7
...
...
@@ -22,7 +22,6 @@ very little overhead for build/release/install mechanics.
sourcedist.rst
builtdist.rst
packageindex.rst
uploading.rst
examples.rst
extending.rst
commandref.rst
...
...
Doc/distutils/packageindex.rst
View file @
79333db7
.. index::
single: Python Package Index (PyPI)
single: PyPI; (see Python Package Index (PyPI))
.. _package-index:
**********************************
Registering with the Package Index
**********************************
*******************************
The Python Package Index (PyPI)
*******************************
The `Python Package Index (PyPI)`_ holds :ref:`meta-data <meta-data>`
describing distributions packaged with distutils, as well as package data like
distribution files if the package author wishes.
Distutils exposes two commands for submitting package data to PyPI: the
:ref:`register <package-register>` command for submitting meta-data to PyPI
and the :ref:`upload <package-upload>` command for submitting distribution
files. Both commands read configuration data from a special file called the
:ref:`.pypirc file <pypirc>`. PyPI :ref:`displays a home page
<package-display>` for each package created from the ``long_description``
submitted by the :command:`register` command.
.. _package-register:
The Python Package Index (PyPI) holds meta-data describing distributions
packaged with distutils. The distutils command :command:`register` is used to
submit your distribution's meta-data to the index. It is invoked as follows::
Registering Packages
====================
The distutils command :command:`register` is used to submit your distribution's
meta-data to the index. It is invoked as follows::
python setup.py register
...
...
@@ -48,6 +69,52 @@ interface lets one change this default behavior and manually select which
versions to display and hide.
.. _package-upload:
Uploading Packages
==================
The distutils command :command:`upload` pushes the distribution files to PyPI.
The command is invoked immediately after building one or more distribution
files. For example, the command ::
python setup.py sdist bdist_wininst upload
will cause the source distribution and the Windows installer to be uploaded to
PyPI. Note that these will be uploaded even if they are built using an earlier
invocation of :file:`setup.py`, but that only distributions named on the command
line for the invocation including the :command:`upload` command are uploaded.
The :command:`upload` command uses the username, password, and repository URL
from the :file:`$HOME/.pypirc` file (see section :ref:`pypirc` for more on this
file). If a :command:`register` command was previously called in the same command,
and if the password was entered in the prompt, :command:`upload` will reuse the
entered password. This is useful if you do not want to store a clear text
password in the :file:`$HOME/.pypirc` file.
You can specify another PyPI server with the ``--repository=url`` option::
python setup.py sdist bdist_wininst upload -r http://example.com/pypi
See section :ref:`pypirc` for more on defining several servers.
You can use the ``--sign`` option to tell :command:`upload` to sign each
uploaded file using GPG (GNU Privacy Guard). The :program:`gpg` program must
be available for execution on the system :envvar:`PATH`. You can also specify
which key to use for signing using the ``--identity=name`` option.
Other :command:`upload` options include ``--repository=url`` or
``--repository=section`` where *url* is the url of the server and
*section* the name of the section in :file:`$HOME/.pypirc`, and
``--show-response`` (which displays the full response text from the PyPI
server for help in debugging upload problems).
.. index::
single: .pypirc file
single: Python Package Index (PyPI); .pypirc file
.. _pypirc:
The .pypirc file
...
...
@@ -102,3 +169,45 @@ For convenience, the name of the section that describes the repository
may also be used::
python setup.py register -r other
.. _package-display:
PyPI package display
====================
The ``long_description`` field plays a special role at PyPI. It is used by
the server to display a home page for the registered package.
If you use the `reStructuredText <http://docutils.sourceforge.net/rst.html>`_
syntax for this field, PyPI will parse it and display an HTML output for
the package home page.
The ``long_description`` field can be attached to a text file located
in the package::
from distutils.core import setup
with open('README.txt') as file:
long_description = file.read()
setup(name='Distutils',
long_description=long_description)
In that case, :file:`README.txt` is a regular reStructuredText text file located
in the root of the package besides :file:`setup.py`.
To prevent registering broken reStructuredText content, you can use the
:program:`rst2html` program that is provided by the :mod:`docutils` package and
check the ``long_description`` from the command line::
$ python setup.py --long-description | rst2html.py > output.html
:mod:`docutils` will display a warning if there's something wrong with your
syntax. Because PyPI applies additional checks (e.g. by passing ``--no-raw``
to ``rst2html.py`` in the command above), being able to run the command above
without warnings does not guarantee that PyPI will convert the content
successfully.
.. _Python Package Index (PyPI): http://pypi.python.org/
Doc/distutils/setupscript.rst
View file @
79333db7
...
...
@@ -610,8 +610,9 @@ Notes:
<
http
://
pypi
.
python
.
org
/
pypi
>`
_
.
(
5
)
The
``
long_description
``
field
is
used
by
PyPI
when
you
are
registering
a
package
,
to
build
its
home
page
.
The
``
long_description
``
field
is
used
by
PyPI
when
you
are
:
ref
:`
registering
<
package
-
register
>`
a
package
,
to
:
ref
:`
build
its
home
page
<
package
-
display
>`.
(
6
)
The
``
license
``
field
is
a
text
indicating
the
license
covering
the
...
...
Doc/distutils/uploading.rst
View file @
79333db7
..
_package
-
upload
:
:orphan
:
***************************************
Uploading Packages to the Package Index
***************************************
The
Python
Package
Index
(
PyPI
)
not
only
stores
the
package
info
,
but
also
the
package
data
if
the
author
of
the
package
wishes
to
.
The
distutils
command
:
command
:`
upload
`
pushes
the
distribution
files
to
PyPI
.
The
command
is
invoked
immediately
after
building
one
or
more
distribution
files
.
For
example
,
the
command
::
python
setup
.
py
sdist
bdist_wininst
upload
will
cause
the
source
distribution
and
the
Windows
installer
to
be
uploaded
to
PyPI
.
Note
that
these
will
be
uploaded
even
if
they
are
built
using
an
earlier
invocation
of
:
file
:`
setup
.
py
`,
but
that
only
distributions
named
on
the
command
line
for
the
invocation
including
the
:
command
:`
upload
`
command
are
uploaded
.
The
:
command
:`
upload
`
command
uses
the
username
,
password
,
and
repository
URL
from
the
:
file
:`$
HOME
/.
pypirc
`
file
(
see
section
:
ref
:`
pypirc
`
for
more
on
this
file
).
If
a
:
command
:`
register
`
command
was
previously
called
in
the
same
command
,
and
if
the
password
was
entered
in
the
prompt
,
:
command
:`
upload
`
will
reuse
the
entered
password
.
This
is
useful
if
you
do
not
want
to
store
a
clear
text
password
in
the
:
file
:`$
HOME
/.
pypirc
`
file
.
You
can
specify
another
PyPI
server
with
the
``--
repository
=
url
``
option
::
python
setup
.
py
sdist
bdist_wininst
upload
-
r
http
://
example
.
com
/
pypi
See
section
:
ref
:`
pypirc
`
for
more
on
defining
several
servers
.
You
can
use
the
``--
sign
``
option
to
tell
:
command
:`
upload
`
to
sign
each
uploaded
file
using
GPG
(
GNU
Privacy
Guard
).
The
:
program
:`
gpg
`
program
must
be
available
for
execution
on
the
system
:
envvar
:`
PATH
`.
You
can
also
specify
which
key
to
use
for
signing
using
the
``--
identity
=
name
``
option
.
Other
:
command
:`
upload
`
options
include
``--
repository
=
url
``
or
``--
repository
=
section
``
where
*
url
*
is
the
url
of
the
server
and
*
section
*
the
name
of
the
section
in
:
file
:`$
HOME
/.
pypirc
`,
and
``--
show
-
response
``
(
which
displays
the
full
response
text
from
the
PyPI
server
for
help
in
debugging
upload
problems
).
PyPI
package
display
====================
The
``
long_description
``
field
plays
a
special
role
at
PyPI
.
It
is
used
by
the
server
to
display
a
home
page
for
the
registered
package
.
If
you
use
the
`
reStructuredText
<
http
://
docutils
.
sourceforge
.
net
/
rst
.
html
>`
_
syntax
for
this
field
,
PyPI
will
parse
it
and
display
an
HTML
output
for
the
package
home
page
.
The
``
long_description
``
field
can
be
attached
to
a
text
file
located
in
the
package
::
from
distutils
.
core
import
setup
with
open
(
'README.txt'
)
as
file
:
long_description
=
file
.
read
()
setup
(
name
=
'Distutils'
,
long_description
=
long_description
)
In
that
case
,
:
file
:`
README
.
txt
`
is
a
regular
reStructuredText
text
file
located
in
the
root
of
the
package
besides
:
file
:`
setup
.
py
`.
To
prevent
registering
broken
reStructuredText
content
,
you
can
use
the
:
program
:`
rst2html
`
program
that
is
provided
by
the
:
mod
:`
docutils
`
package
and
check
the
``
long_description
``
from
the
command
line
::
$
python
setup
.
py
--
long
-
description
|
rst2html
.
py
>
output
.
html
:
mod
:`
docutils
`
will
display
a
warning
if
there
's something wrong with your
syntax. Because PyPI applies additional checks (e.g. by passing ``--no-raw``
to ``rst2html.py`` in the command above), being able to run the command above
without warnings does not guarantee that PyPI will convert the content
successfully.
The contents of this page have moved to the section :ref:`package-index`.
Misc/NEWS
View file @
79333db7
...
...
@@ -774,6 +774,8 @@ Tools/Demos
Documentation
-------------
-
Issue
#
16406
:
Combine
the
pages
for
uploading
and
registering
to
PyPI
.
-
Issue
#
16403
:
Document
how
distutils
uses
the
maintainer
field
in
PKG
-
INFO
.
Patch
by
Jyrki
Pulliainen
.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment