1
+ .. _build-system-interface :
2
+
1
3
======================
2
4
Build system interface
3
5
======================
@@ -6,6 +8,11 @@ This specifications describes a standardized interface for installation
6
8
tools like ``pip `` to interact with package source trees and source
7
9
distributions.
8
10
11
+ The project's chosen build system is read from the :ref: `[build-system]
12
+ table <pyproject-build-system-table>` of the ``pyproject.toml `` file.
13
+ The ``requires `` key defines the build requirements and the
14
+ ``build-backend `` key specifies a build backend object to use.
15
+
9
16
10
17
Terminology
11
18
===========
@@ -27,9 +34,10 @@ lxml==2.4.0``, pip is acting as an integration frontend.
27
34
Build requirements
28
35
==================
29
36
30
- This PEP places a number of additional requirements on the "build requirements"
31
- section of ``pyproject.toml ``. These are intended to ensure that projects do
32
- not create impossible to satisfy conditions with their build requirements.
37
+ This specification places a number of requirements on the ``requires ``
38
+ key from the ``[build-system] `` section of ``pyproject.toml ``. These are
39
+ intended to ensure that projects do not create impossible to satisfy
40
+ conditions with their build requirements.
33
41
34
42
- Project build requirements will define a directed graph of requirements
35
43
(project A needs B to build, B needs C and D, etc.) This graph MUST NOT
@@ -53,9 +61,11 @@ avoiding external build dependencies (usually by vendoring them).
53
61
Build backend interface
54
62
========================
55
63
56
- The build backend object is expected to have attributes which provide
57
- some or all of the following hooks. The common ``config_settings ``
58
- argument is described after the individual hooks.
64
+ The build backend object is looked up according to the ``build-backend ``
65
+ field of the ``[build-system] `` table. It is expected to have attributes
66
+ which provide some or all of the following hooks. The common
67
+ ``config_settings `` argument is described after the individual hooks.
68
+
59
69
60
70
Mandatory hooks
61
71
---------------
@@ -124,6 +134,8 @@ for a wheel, it should fall back to building a wheel directly.
124
134
The backend does not need to define this exception type if it would never raise
125
135
it.
126
136
137
+
138
+
127
139
Optional hooks
128
140
--------------
129
141
@@ -135,9 +147,10 @@ get_requires_for_build_wheel
135
147
def get_requires_for_build_wheel(config_settings=None):
136
148
...
137
149
138
- This hook MUST return an additional list of strings containing :pep: `508 `
139
- dependency specifications, above and beyond those specified in the
140
- ``pyproject.toml `` file, to be installed when calling the ``build_wheel `` or
150
+ This hook MUST return an additional list of strings containing
151
+ :ref: `dependency specifiers <dependency-specifiers >`, above and
152
+ beyond those specified in the ``pyproject.toml `` file, to be
153
+ installed when calling the ``build_wheel `` or
141
154
``prepare_metadata_for_build_wheel `` hooks.
142
155
143
156
Example::
@@ -165,7 +178,7 @@ directory, and a build frontend MUST preserve, but otherwise ignore, such files;
165
178
the intention
166
179
here is that in cases where the metadata depends on build-time
167
180
decisions, the build backend may need to record these decisions in
168
- some convenient format for re-use by the actual wheel-building step.
181
+ some convenient format for reuse by the actual wheel-building step.
169
182
170
183
This must return the basename (not the full path) of the ``.dist-info ``
171
184
directory it creates, as a unicode string.
@@ -190,16 +203,8 @@ dependency specifications, above and beyond those specified in the
190
203
If not defined, the default implementation is equivalent to ``return [] ``.
191
204
192
205
193
- .. note :: Editable installs
206
+ .. todo :: Import :pep:`660` (editable installs) here.
194
207
195
- This PEP originally specified another hook, ``install_editable ``, to do an
196
- editable install (as with ``pip install -e ``). It was removed due to the
197
- complexity of the topic, but may be specified in a later PEP.
198
-
199
- Briefly, the questions to be answered include: what reasonable ways existing
200
- of implementing an 'editable install'? Should the backend or the frontend
201
- pick how to make an editable install? And if the frontend does, what does it
202
- need from the backend to do so.
203
208
204
209
Config settings
205
210
---------------
@@ -327,7 +332,7 @@ environment that meets the above criteria. For example, simply
327
332
installing all build-requirements into the global environment would be
328
333
sufficient to build any compliant package -- but this would be
329
334
sub-optimal for a number of reasons. This section contains
330
- non-normative advice to frontend implementors .
335
+ non-normative advice to frontend implementers .
331
336
332
337
A build frontend SHOULD, by default, create an isolated environment
333
338
for each build, containing only the standard library and any
@@ -421,13 +426,16 @@ the locations in ``backend-path``.
421
426
History
422
427
=======
423
428
424
- The following changes were made to this PEP after the initial reference
429
+ This specification was originally proposed and approved as :pep: `517 `.
430
+
431
+ The following changes were made to this specification after the initial reference
425
432
implementation was released in pip 19.0.
426
433
427
434
* Cycles in build requirements were explicitly prohibited.
428
435
* Support for in-tree backends and self-hosting of backends was added by
429
436
the introduction of the ``backend-path `` key in the ``[build-system] ``
430
437
table.
431
- * Clarified that the ``setuptools.build_meta:__legacy__ `` :pep: ` 517 ` backend is
438
+ * Clarified that the ``setuptools.build_meta:__legacy__ `` backend is
432
439
an acceptable alternative to directly invoking ``setup.py `` for source trees
433
- that don't specify ``build-backend `` explicitly.
440
+ that don't specify ``build-backend `` explicitly. (This clarification
441
+ is now in the :ref: `pyproject.toml specification <pyproject-toml-spec >`.)
0 commit comments