Skip to content

Commit 2ac05b5

Browse files
committed
PEP 518: Light editing to fit packaging.python.org
1 parent 001a68f commit 2ac05b5

File tree

1 file changed

+55
-84
lines changed

1 file changed

+55
-84
lines changed

source/specifications/declaring-build-dependencies.rst

Lines changed: 55 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -5,56 +5,37 @@
55
Declaring build system dependencies
66
===================================
77

8-
``pyproject.toml`` is a build system independent file format defined in :pep:`518`
9-
that projects may provide in order to declare any Python level dependencies that
10-
must be installed in order to run the project's build system successfully.
8+
The ``pyproject.toml`` file is written in `TOML <https://toml.io>`_.
9+
Among other metadata (such as :ref:`project metadata <declaring-project-metadata>`),
10+
it declares any Python level dependencies that must be installed in order to
11+
run the project's build system successfully.
1112

13+
.. TODO: move this sentence elsewhere
1214
13-
Abstract
14-
========
15+
Tables not defined by PyPA specifications are reserved for future use.
1516

16-
This PEP specifies how Python software packages should specify what
17-
build dependencies they have in order to execute their chosen build
18-
system. As part of this specification, a new configuration file is
19-
introduced for software packages to use to specify their build
20-
dependencies (with the expectation that the same configuration file
21-
will be used for future configuration details).
22-
23-
24-
Specification
25-
=============
26-
27-
File Format
28-
-----------
29-
30-
The build system dependencies will be stored in a file named
31-
``pyproject.toml`` that is written in the TOML format [#toml]_.
32-
33-
Below we list the tables that tools are expected to recognize/respect.
34-
Tables not specified in this PEP are reserved for future use by other
35-
PEPs.
3617

3718
build-system table
3819
------------------
3920

4021
The ``[build-system]`` table is used to store build-related data.
41-
Initially only one key of the table will be valid and is mandatory
22+
Currently, only one key of the table is be valid and is mandatory
4223
for the table: ``requires``. This key must have a value of a list
43-
of strings representing :pep:`508` dependencies required to execute the
44-
build system (currently that means what dependencies are required to
45-
execute a ``setup.py`` file).
24+
of strings representing dependencies required to execute the
25+
build system. The strings in this list follow the :ref:`version specifier
26+
specification <version-specifiers>`.
27+
28+
An example ``build-system`` table for a project built with
29+
``setuptools`` is:
4630

47-
For the vast majority of Python projects that rely upon setuptools,
48-
the ``pyproject.toml`` file will be::
31+
.. code-block:: toml
4932
50-
[build-system]
51-
# Minimum requirements for the build system to execute.
52-
requires = ["setuptools", "wheel"] # PEP 508 specifications.
33+
[build-system]
34+
# Minimum requirements for the build system to execute.
35+
requires = ["setuptools", "wheel"]
5336
54-
Because the use of setuptools and wheel are so expansive in the
55-
community at the moment, build tools are expected to use the example
56-
configuration file above as their default semantics when a
57-
``pyproject.toml`` file is not present.
37+
Build tools are expected to use the example configuration file above as
38+
their default semantics when a ``pyproject.toml`` file is not present.
5839

5940
Tools should not require the existence of the ``[build-system]`` table.
6041
A ``pyproject.toml`` file may be used to store configuration details
@@ -65,6 +46,8 @@ If the table is specified but is missing required fields then the tool
6546
should consider it an error.
6647

6748

49+
.. TODO: move elsewhere
50+
6851
tool table
6952
----------
7053

@@ -74,8 +57,8 @@ data as long as they use a sub-table within ``[tool]``, e.g. the
7457
`flit <https://pypi.python.org/pypi/flit>`_ tool would store its
7558
configuration in ``[tool.flit]``.
7659

77-
We need some mechanism to allocate names within the ``tool.*``
78-
namespace, to make sure that different projects don't attempt to use
60+
A mechanism is needed to allocate names within the ``tool.*``
61+
namespace, to make sure that different projects do not attempt to use
7962
the same sub-table and collide. Our rule is that a project can use
8063
the subtable ``tool.$NAME`` if, and only if, they own the entry for
8164
``$NAME`` in the Cheeseshop/PyPI.
@@ -84,47 +67,35 @@ JSON Schema
8467
-----------
8568

8669
To provide a type-specific representation of the resulting data from
87-
the TOML file for illustrative purposes only, the following JSON
88-
Schema [#jsonschema]_ would match the data format::
89-
90-
{
91-
"$schema": "http://json-schema.org/schema#",
92-
93-
"type": "object",
94-
"additionalProperties": false,
95-
96-
"properties": {
97-
"build-system": {
98-
"type": "object",
99-
"additionalProperties": false,
100-
101-
"properties": {
102-
"requires": {
103-
"type": "array",
104-
"items": {
105-
"type": "string"
106-
}
107-
}
108-
},
109-
"required": ["requires"]
110-
},
111-
112-
"tool": {
113-
"type": "object"
114-
}
115-
}
116-
}
117-
118-
119-
120-
References
121-
==========
122-
123-
.. [#toml] TOML
124-
(https://github.com/toml-lang/toml)
125-
126-
.. [#yaml] YAML
127-
(http://yaml.org/)
128-
129-
.. [#jsonschema] JSON Schema
130-
(http://json-schema.org/)
70+
the TOML file for illustrative purposes only, the following
71+
`JSON Schema <https://json-schema.org>`_ would match the data format:
72+
73+
.. code-block:: json
74+
75+
{
76+
"$schema": "http://json-schema.org/schema#",
77+
78+
"type": "object",
79+
"additionalProperties": false,
80+
81+
"properties": {
82+
"build-system": {
83+
"type": "object",
84+
"additionalProperties": false,
85+
86+
"properties": {
87+
"requires": {
88+
"type": "array",
89+
"items": {
90+
"type": "string"
91+
}
92+
}
93+
},
94+
"required": ["requires"]
95+
},
96+
97+
"tool": {
98+
"type": "object"
99+
}
100+
}
101+
}

0 commit comments

Comments
 (0)