Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit d15f4e3

Browse files
committed
[Patch #658093 ] Documentation support for PEP 301
Add two sections to this manual about package meta-data and about registering packages
1 parent 51a6a4c commit d15f4e3

1 file changed

Lines changed: 124 additions & 3 deletions

File tree

Doc/dist/dist.tex

Lines changed: 124 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,8 @@ \section{Writing the Setup Script}
282282
rather than by module. This is important since the Distutils consist of
283283
a couple of dozen modules split into (so far) two packages; an explicit
284284
list of every module would be tedious to generate and difficult to
285-
maintain.
285+
maintain. For more information on the additional meta-data, see
286+
section~\ref{meta-data}.
286287

287288
Note that any pathnames (files or directories) supplied in the setup
288289
script should be written using the \UNIX{} convention, i.e.
@@ -680,6 +681,74 @@ \subsection{Installing Additional Files}
680681
To install data files directly in the target directory, an empty
681682
string should be given as the directory.
682683

684+
\subsection{Additional meta-data}
685+
\label{meta-data}
686+
687+
The setup script may include additional meta-data beyond the name and
688+
version. This information includes:
689+
690+
\begin{tableiii}{l|l|c}{code}%
691+
{Meta-Data}{Description}{Notes}
692+
\lineiii{name}{the name of the package}{(1)}
693+
\lineiii{version}{the version of this release}{(1)}
694+
\lineiii{author}{package author's name}{(2)}
695+
\lineiii{author_email}{email address of the package author}{(2)}
696+
\lineiii{maintainer}{package maintainer's name}{(2)}
697+
\lineiii{maintainer_email}{email address of the package maintainer}{(2)}
698+
\lineiii{home_page}{a URL}{(1)}
699+
\lineiii{license}{the terms the package is released under}{}
700+
\lineiii{description}{a short, summary description of the package}{}
701+
\lineiii{long_description}{a longer description of the package}{}
702+
\lineiii{keywords}{some keywords appropriate to the package}{}
703+
\lineiii{platform}{a list of the target platforms}{}
704+
\lineiii{classifiers}{a list of Trove classifiers}{(2)}
705+
\end{tableiii}
706+
707+
\noindent Notes:
708+
\begin{description}
709+
\item[(1)] these fields are required
710+
\item[(2)] either the author or the maintainer must be nominated
711+
\item[(3)] should not be used if your package is to be compatible with
712+
Python versions prior to 2.2.3 or 2.3. The list is available from the
713+
PyPI website.
714+
\end{description}
715+
716+
\option{classifiers} are specified in a python list:
717+
718+
\begin{verbatim}
719+
setup(...
720+
classifiers = [
721+
'Development Status :: 4 - Beta',
722+
'Environment :: Console',
723+
'Environment :: Web Environment',
724+
'Intended Audience :: End Users/Desktop',
725+
'Intended Audience :: Developers',
726+
'Intended Audience :: System Administrators',
727+
'License :: OSI Approved :: Python Software Foundation License',
728+
'Operating System :: MacOS :: MacOS X',
729+
'Operating System :: Microsoft :: Windows',
730+
'Operating System :: POSIX',
731+
'Programming Language :: Python',
732+
'Topic :: Communications :: Email',
733+
'Topic :: Office/Business',
734+
'Topic :: Software Development :: Bug Tracking',
735+
],
736+
...
737+
)
738+
\end{verbatim}
739+
740+
If you wish to include classifiers in your \file{setup.py} file and also
741+
wish to remain backwards-compatible with Python releases prior to 2.2.3,
742+
then you can include the following code fragment in your \file{setup.py}
743+
before the \code{setup()} call.
744+
745+
\begin{verbatim}
746+
# patch distutils if it can't cope with the "classifiers" keyword
747+
if sys.version < '2.2.3':
748+
from distutils.dist import DistributionMetadata
749+
DistributionMetadata.classifiers = None
750+
\end{verbatim}
751+
683752

684753
\section{Writing the Setup Configuration File}
685754
\label{setup-config}
@@ -1394,10 +1463,62 @@ \subsubsection{The Postinstallation script}
13941463
\var{iconpath}. Again, for details consult the Microsoft
13951464
documentation for the \code{IShellLink} interface.
13961465

1397-
\section{Examples}
1398-
\label{examples}
1466+
\section{Registering with the Package Index}
1467+
\label{package-index}
13991468

1469+
The Python Package Index (PyPI) holds meta-data describing distributions
1470+
packaged with distutils. The distutils command \command{register} is
1471+
used to submit your distribution's meta-data to the index. It is invoked
1472+
as follows:
14001473

1474+
\begin{verbatim}
1475+
python setup.py register
1476+
\end{verbatim}
1477+
1478+
Distutils will respond with the following prompt:
1479+
1480+
\begin{verbatim}
1481+
running register
1482+
We need to know who you are, so please choose either:
1483+
1. use your existing login,
1484+
2. register as a new user,
1485+
3. have the server generate a new password for you (and email it to you), or
1486+
4. quit
1487+
Your selection [default 1]:
1488+
\end{verbatim}
1489+
1490+
\noindent Note: if your username and password are saved locally, you will
1491+
not see this menu.
1492+
1493+
If you have not registered with PyPI, then you will need to do so now. You
1494+
should choose option 2, and enter your details as required. Soon after
1495+
submitting your details, you will receive an email which will be used to
1496+
confirm your registration.
1497+
1498+
Once you are registered, you may choose option 1 from the menu. You will
1499+
be prompted for your PyPI username and password, and \command{register}
1500+
will then submit your meta-data to the index.
1501+
1502+
You may submit any number of versions of your distribution to the index. If
1503+
you alter the meta-data for a particular version, you may submit it again
1504+
and the index will be updated.
1505+
1506+
PyPI holds a record for each (name, version) combination submitted. The
1507+
first user to submit information for a given name is designated the Owner
1508+
of that name. They may submit changes through the \command{register}
1509+
command or through the web interface. They may also designate other users
1510+
as Owners or Maintainers. Maintainers may edit the package information, but
1511+
not designate other Owners or Maintainers.
1512+
1513+
By default PyPI will list all versions of a given package. To hide certain
1514+
versions, the Hidden property should be set to yes. This must be edited
1515+
through the web interface.
1516+
1517+
1518+
1519+
\section{Examples}
1520+
\label{examples}
1521+
14011522
\subsection{Pure Python distribution (by module)}
14021523
\label{pure-mod}
14031524

0 commit comments

Comments
 (0)