@@ -72,14 +72,16 @@ Build System Interface
72
72
======================
73
73
74
74
Pip builds packages by invoking the build system. Presently, the only supported
75
- build system is ``setuptools ``, but future developments to the Python packaging
76
- infrastructure are expected to include support for other build systems. As
77
- well as package building, the build system is also invoked to install packages
78
- direct from source.
75
+ build system is ``setuptools ``, but in the future, pip will support `PEP517 `_
76
+ which allows projects to specify an alternative build system in a
77
+ ``pyproject.toml `` file. As well as package building, the build system is also
78
+ invoked to install packages direct from source. This is handled by invoking
79
+ the build system to build a wheel, and then installing from that wheel. The
80
+ built wheel is cached locally by pip to avoid repeated identical builds.
79
81
80
- The interface to the build system is via the ``setup.py `` command line script -
81
- all build actions are defined in terms of the specific ``setup.py `` command
82
- line that will be run to invoke the required action.
82
+ The current interface to the build system is via the ``setup.py `` command line
83
+ script - all build actions are defined in terms of the specific ``setup.py ``
84
+ command line that will be run to invoke the required action.
83
85
84
86
Setuptools Injection
85
87
~~~~~~~~~~~~~~~~~~~~
@@ -111,6 +113,54 @@ unexpected byte sequences to Python-style hexadecimal escape sequences
111
113
(``"\x80\xff" ``, etc). However, it is still possible for output to be displayed
112
114
using an incorrect encoding (mojibake).
113
115
116
+ PEP 518 Support
117
+ ~~~~~~~~~~~~~~~
118
+
119
+ Pip supports projects declaring dependencies that are required at install time
120
+ using a ``pyproject.toml `` file, in the form described in `PEP518 `_. When
121
+ building a project, pip will install the required dependencies locally, and
122
+ make them available to the build process.
123
+
124
+ As noted in the PEP, the minimum requirements for pip to be able to build a
125
+ project are::
126
+
127
+ [build-system]
128
+ # Minimum requirements for the build system to execute.
129
+ requires = ["setuptools", "wheel"]
130
+
131
+ ``setuptools `` and ``wheel `` **must ** be included in any ``pyproject.toml ``
132
+ provided by a project - pip will assume these as a default, but will not add
133
+ them to an explicitly supplied list in a project supplied ``pyproject.toml ``
134
+ file. Once `PEP517 `_ support is added, this restriction will be lifted and
135
+ alternative build tools will be allowed.
136
+
137
+ When making build requirements available, pip does so in an *isolated
138
+ environment *. That is, pip does not install those requirements into the user's
139
+ ``site-packages ``, but rather installs them in a temporary directory which it
140
+ adds to the user's ``sys.path `` for the duration of the build. This ensures
141
+ that build requirements are handled independently of the user's runtime
142
+ environment. For example, a project that needs a recent version of setuptools
143
+ to build can still be installed, even if the user has an older version
144
+ installed (and without silently replacing that version).
145
+
146
+ In certain cases, projects (or redistributors) may have workflows that
147
+ explicitly manage the build environment. For such workflows, build isolation
148
+ can be problematic. If this is the case, pip provides a
149
+ ``--no-build-isolation `` flag to disable build isolation. Users supplying this
150
+ flag are responsible for ensuring the build environment is managed
151
+ appropriately.
152
+
153
+ The current implementation of `PEP518 `_ in pip requires that any dependencies
154
+ specified in ``pyproject.toml `` are available as wheels. This is a technical
155
+ limitation of the implementation - dependencies only available as source would
156
+ require a build step of their own, which would recursively invoke the `PEP518 `_
157
+ dependency installation process. The potentially unbounded recursion involved
158
+ was not considered acceptable, and so installation of build dependencies from
159
+ source has been disabled until a safe resolution of this issue has been found.
160
+
161
+ .. _PEP517 : http://www.python.org/dev/peps/pep-0517/
162
+ .. _PEP518 : http://www.python.org/dev/peps/pep-0518/
163
+
114
164
Future Developments
115
165
~~~~~~~~~~~~~~~~~~~
116
166
0 commit comments