@@ -16,6 +16,110 @@ specification as the canonical source for the format used.
1616 :ref: `writing-pyproject-toml `.
1717
1818
19+ .. _declaring-build-dependencies :
20+
21+ ===================================
22+ Declaring build system dependencies
23+ ===================================
24+
25+ The ``pyproject.toml `` file is written in `TOML <https://toml.io >`_.
26+ Among other metadata (such as :ref: `project metadata <declaring-project-metadata >`),
27+ it declares any Python level dependencies that must be installed in order to
28+ run the project's build system successfully.
29+
30+ .. TODO: move this sentence elsewhere
31+
32+ Tables not defined by PyPA specifications are reserved for future use.
33+
34+ build-system table
35+ ------------------
36+
37+ .. TODO: merge with PEP 517
38+
39+ The ``[build-system] `` table is used to store build-related data.
40+ Initially, only one key of the table is valid and is mandatory
41+ for the table: ``requires ``. This key must have a value of a list
42+ of strings representing dependencies required to execute the
43+ build system. The strings in this list follow the :ref: `version specifier
44+ specification <version-specifiers>`.
45+
46+ An example ``build-system `` table for a project built with
47+ ``setuptools `` is:
48+
49+ .. code-block :: toml
50+
51+ [build-system]
52+ # Minimum requirements for the build system to execute.
53+ requires = ["setuptools"]
54+
55+ Build tools are expected to use the example configuration file above as
56+ their default semantics when a ``pyproject.toml `` file is not present.
57+
58+ Tools should not require the existence of the ``[build-system] `` table.
59+ A ``pyproject.toml `` file may be used to store configuration details
60+ other than build-related data and thus lack a ``[build-system] `` table
61+ legitimately. If the file exists but is lacking the ``[build-system] ``
62+ table then the default values as specified above should be used.
63+ If the table is specified but is missing required fields then the tool
64+ should consider it an error.
65+
66+
67+ .. TODO: move elsewhere
68+
69+ .. _pyproject-tool-table :
70+
71+ tool table
72+ ----------
73+
74+ The ``[tool] `` table is where any tool related to your Python
75+ project, not just build tools, can have users specify configuration
76+ data as long as they use a sub-table within ``[tool] ``, e.g. the
77+ `flit <https://pypi.python.org/pypi/flit >`_ tool would store its
78+ configuration in ``[tool.flit] ``.
79+
80+ A mechanism is needed to allocate names within the ``tool.* ``
81+ namespace, to make sure that different projects do not attempt to use
82+ the same sub-table and collide. Our rule is that a project can use
83+ the subtable ``tool.$NAME `` if, and only if, they own the entry for
84+ ``$NAME `` in the Cheeseshop/PyPI.
85+
86+ JSON Schema
87+ -----------
88+
89+ To provide a type-specific representation of the resulting data from
90+ the TOML file for illustrative purposes only, the following
91+ `JSON Schema <https://json-schema.org >`_ would match the data format:
92+
93+ .. code-block :: json
94+
95+ {
96+ "$schema" : " http://json-schema.org/schema#" ,
97+
98+ "type" : " object" ,
99+ "additionalProperties" : false ,
100+
101+ "properties" : {
102+ "build-system" : {
103+ "type" : " object" ,
104+ "additionalProperties" : false ,
105+
106+ "properties" : {
107+ "requires" : {
108+ "type" : " array" ,
109+ "items" : {
110+ "type" : " string"
111+ }
112+ }
113+ },
114+ "required" : [" requires" ]
115+ },
116+
117+ "tool" : {
118+ "type" : " object"
119+ }
120+ }
121+ }
122+
19123 Specification
20124=============
21125
0 commit comments