5
5
Declaring build system dependencies
6
6
===================================
7
7
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.
11
12
13
+ .. TODO: move this sentence elsewhere
12
14
13
- Abstract
14
- ========
15
+ Tables not defined by PyPA specifications are reserved for future use.
15
16
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.
36
17
37
18
build-system table
38
19
------------------
39
20
40
21
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
42
23
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:
46
30
47
- For the vast majority of Python projects that rely upon setuptools,
48
- the ``pyproject.toml `` file will be::
31
+ .. code-block :: toml
49
32
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"]
53
36
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.
58
39
59
40
Tools should not require the existence of the ``[build-system] `` table.
60
41
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
65
46
should consider it an error.
66
47
67
48
49
+ .. TODO: move elsewhere
50
+
68
51
tool table
69
52
----------
70
53
@@ -74,8 +57,8 @@ data as long as they use a sub-table within ``[tool]``, e.g. the
74
57
`flit <https://pypi.python.org/pypi/flit >`_ tool would store its
75
58
configuration in ``[tool.flit] ``.
76
59
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
79
62
the same sub-table and collide. Our rule is that a project can use
80
63
the subtable ``tool.$NAME `` if, and only if, they own the entry for
81
64
``$NAME `` in the Cheeseshop/PyPI.
@@ -84,47 +67,35 @@ JSON Schema
84
67
-----------
85
68
86
69
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