|
1 | | - |
2 | | -.. _specifications: |
3 | | - |
4 | | -=================== |
5 | 1 | PyPA Specifications |
6 | | -=================== |
| 2 | +################### |
7 | 3 |
|
8 | 4 | This is a list of currently active interoperability specifications maintained |
9 | 5 | by the Python Packaging Authority. |
10 | 6 |
|
11 | | -Package distribution metadata |
12 | | -############################# |
13 | | - |
14 | | -Core metadata |
15 | | -============= |
16 | | - |
17 | | -The current core metadata file format, version 1.2, is specified in :pep:`345`. |
18 | | - |
19 | | -However, the version specifiers and environment markers sections of that PEP |
20 | | -have been superceded as described below. In addition, metadata files are |
21 | | -permitted to contain the following additional fields: |
22 | | - |
23 | | -Provides-Extra (multiple use) |
24 | | -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
25 | | - |
26 | | -A string containing the name of an optional feature. Must be a valid Python |
27 | | -identifier. May be used to make a dependency conditional on whether the |
28 | | -optional feature has been requested. |
29 | | - |
30 | | -Example:: |
31 | | - |
32 | | - Provides-Extra: pdf |
33 | | - Requires-Dist: reportlab; extra == 'pdf' |
34 | | - |
35 | | -A second distribution requires an optional dependency by placing it |
36 | | -inside square brackets, and can request multiple features by separating |
37 | | -them with a comma (,). The requirements are evaluated for each requested |
38 | | -feature and added to the set of requirements for the distribution. |
39 | | - |
40 | | -Example:: |
41 | | - |
42 | | - Requires-Dist: beaglevote[pdf] |
43 | | - Requires-Dist: libexample[test, doc] |
44 | | - |
45 | | -Two feature names `test` and `doc` are reserved to mark dependencies that |
46 | | -are needed for running automated tests and generating documentation, |
47 | | -respectively. |
48 | | - |
49 | | -It is legal to specify ``Provides-Extra:`` without referencing it in any |
50 | | -``Requires-Dist:``. |
51 | | - |
52 | | -Description-Content-Type |
53 | | -~~~~~~~~~~~~~~~~~~~~~~~~ |
54 | | - |
55 | | -A string stating the markup syntax (if any) used in the distribution's |
56 | | -description, so that tools can intelligently render the description. |
57 | | - |
58 | | -Historically, PyPI supported descriptions in plain text and `reStructuredText |
59 | | -(reST) <http://docutils.sourceforge.net/docs/ref/rst/restructuredtext.html>`_, |
60 | | -and could render reST into HTML. However, it is common for distribution |
61 | | -authors to write the description in `Markdown |
62 | | -<https://daringfireball.net/projects/markdown/>`_ (`RFC 7763 |
63 | | -<https://tools.ietf.org/html/rfc7763>`_) as many code hosting sites render |
64 | | -Markdown READMEs, and authors would reuse the file for the description. PyPI |
65 | | -didn't recognize the format and so could not render the description correctly. |
66 | | -This resulted in many packages on PyPI with poorly-rendered descriptions when |
67 | | -Markdown is left as plain text, or worse, was attempted to be rendered as reST. |
68 | | -This field allows the distribution author to specify the format of their |
69 | | -description, opening up the possibility for PyPI and other tools to be able to |
70 | | -render Markdown and other formats. |
71 | | - |
72 | | -The format of this field is the same as the ``Content-Type`` header in HTTP |
73 | | -(i.e.: |
74 | | -`RFC 1341 <https://www.w3.org/Protocols/rfc1341/4_Content-Type.html>`_). |
75 | | -Briefly, this means that it has a ``type/subtype`` part and then it can |
76 | | -optionally have a number of parameters: |
77 | | - |
78 | | -Format:: |
79 | | - |
80 | | - Description-Content-Type: <type>/<subtype>; charset=<charset>[; <param_name>=<param value> ...] |
81 | | - |
82 | | -The ``type/subtype`` part has only a few legal values: |
83 | | - |
84 | | -- ``text/plain`` |
85 | | -- ``text/x-rst`` |
86 | | -- ``text/markdown`` |
87 | | - |
88 | | -The ``charset`` parameter can be used to specify the character encoding of |
89 | | -the description. The only legal value is ``UTF-8``. If omitted, it is assumed to |
90 | | -be ``UTF-8``. |
91 | | - |
92 | | -Other parameters might be specific to the chosen subtype. For example, for the |
93 | | -``markdown`` subtype, there is an optional ``variant`` parameter that allows |
94 | | -specifying the variant of Markdown in use (defaults to ``CommonMark`` if not |
95 | | -specified). Currently, the only value that is recognized is: |
96 | | - |
97 | | -- ``CommonMark`` for `CommonMark |
98 | | - <https://tools.ietf.org/html/rfc7764#section-3.5>`_ |
99 | | - |
100 | | -Example:: |
101 | | - |
102 | | - Description-Content-Type: text/plain; charset=UTF-8 |
103 | | - |
104 | | -Example:: |
105 | | - |
106 | | - Description-Content-Type: text/x-rst; charset=UTF-8 |
107 | | - |
108 | | -Example:: |
109 | | - |
110 | | - Description-Content-Type: text/markdown; charset=UTF-8; variant=CommonMark |
111 | | - |
112 | | -Example:: |
113 | | - |
114 | | - Description-Content-Type: text/markdown |
115 | | - |
116 | | -If a ``Description-Content-Type`` is not specified, then applications should |
117 | | -attempt to render it as ``text/x-rst; charset=UTF-8`` and fall back to |
118 | | -``text/plain`` if it is not valid rst. |
119 | | - |
120 | | -If a ``Description-Content-Type`` is an unrecognized value, then the assumed |
121 | | -content type is ``text/plain`` (Although PyPI will probably reject anything |
122 | | -with an unrecognized value). |
123 | | - |
124 | | -If the ``Description-Content-Type`` is ``text/markdown`` and ``variant`` is not |
125 | | -specified or is set to an unrecognized value, then the assumed ``variant`` is |
126 | | -``CommonMark``. |
127 | | - |
128 | | -So for the last example above, the ``charset`` defaults to ``UTF-8`` and the |
129 | | -``variant`` defaults to ``CommonMark`` and thus it is equivalent to the example |
130 | | -before it. |
131 | | - |
132 | | - |
133 | | -Version Specifiers |
134 | | -================== |
135 | | - |
136 | | -Version numbering requirements and the semantics for specifying comparisons |
137 | | -between versions are defined in :pep:`440`. |
138 | | - |
139 | | -The version specifiers section in this PEP supersedes the version specifiers |
140 | | -section in :pep:`345`. |
141 | | - |
142 | | -Dependency Specifiers |
143 | | -===================== |
144 | | - |
145 | | -The dependency specifier format used to declare a dependency on another |
146 | | -component is defined in :pep:`508`. |
147 | | - |
148 | | -The environment markers section in this PEP supersedes the environment markers |
149 | | -section in :pep:`345`. |
150 | | - |
151 | | -Declaring Build System Dependencies |
152 | | -=================================== |
153 | | - |
154 | | -`pyproject.toml` is a build system independent file format defined in :pep:`518` |
155 | | -that projects may provide in order to declare any Python level dependencies that |
156 | | -must be installed in order to run the project's build system successfully. |
157 | | - |
158 | | -Source Distribution Format |
159 | | -========================== |
160 | | - |
161 | | -The source distribution format (``sdist``) is not currently formally defined. |
162 | | -Instead, its format is implicitly defined by the behaviour of the |
163 | | -standard library's ``distutils`` module when executing the ``setup.py sdist`` |
164 | | -command. |
165 | | - |
166 | | -Binary Distribution Format |
167 | | -========================== |
168 | | - |
169 | | -The binary distribution format (``wheel``) is defined in :pep:`427`. |
170 | | - |
171 | | -Platform Compatibility Tags |
172 | | -=========================== |
173 | | - |
174 | | -The platform compatibility tagging model used for ``wheel`` distribution is |
175 | | -defined in :pep:`425`. |
176 | | - |
177 | | -The scheme defined in that PEP is insufficient for public distribution |
178 | | -of Linux wheel files (and \*nix wheel files in general), so :pep:`513` was |
179 | | -created to define the ``manylinux1`` tag. |
180 | | - |
181 | | -Recording Installed Distributions |
182 | | -================================= |
183 | | - |
184 | | -The format used to record installed packages and their contents is defined in |
185 | | -:pep:`376`. |
186 | | - |
187 | | -Note that only the ``dist-info`` directory and the ``RECORD`` file format from |
188 | | -that PEP are currently implemented in the default packaging toolchain. |
189 | | - |
190 | | - |
191 | | -Package index interfaces |
192 | | -######################## |
193 | | - |
194 | | -Simple repository API |
195 | | -===================== |
196 | | - |
197 | | -The current interface for querying available package versions and retrieving packages |
198 | | -from an index server is defined in :pep:`503`. |
| 7 | +.. toctree:: |
| 8 | + :maxdepth: 1 |
| 9 | + |
| 10 | + core-metadata |
| 11 | + version-specifiers |
| 12 | + dependency-specifiers |
| 13 | + declaring-build-dependencies |
| 14 | + distribution-formats |
| 15 | + platform-compatibility-tags |
| 16 | + recording-installed-packages |
| 17 | + simple-repository-api |
0 commit comments