Skip to content

Commit 1193d1e

Browse files
committed
docs: more caveats on setup_requires
1 parent 8fa70e7 commit 1193d1e

File tree

1 file changed

+18
-6
lines changed

1 file changed

+18
-6
lines changed

docs/compiling.rst

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -107,10 +107,11 @@ Classic ``setup_requires``
107107
--------------------------
108108

109109
If you want to support old versions of Pip with the classic
110-
``setup_requires=["pybind11"]`` keyword argument to setup, which triggers a
111-
two-phase ``setup.py`` run, then you will need to use something like this to
112-
ensure the first pass works (which has not yet installed the ``setup_requires``
113-
packages, since it can't install something it does not know about):
110+
``setup_requires=["pybind11"], install_requires=["pybind11"]`` keyword arguments
111+
to setup, which triggers a two-phase ``setup.py`` run, then you will need to
112+
use something like this to ensure the first pass works (which has not yet
113+
installed the ``setup_requires`` packages, since it can't install something it
114+
does not know about):
114115

115116
.. code-block:: python
116117
@@ -124,8 +125,19 @@ It doesn't matter that the Extension class is not the enhanced subclass for the
124125
first pass run; and the second pass will have the ``setup_requires``
125126
requirements.
126127

127-
This is obviously more of a hack than the PEP 518 method, but it supports
128-
ancient versions of Pip.
128+
.. note::
129+
130+
This is obviously more of a hack than the PEP 518 method. It requires that
131+
the package be listed in ``install_requires`` too, which means that users
132+
will also have pybind11 available after your package is installed,
133+
regardless of wether they had to build it, and makes it inadvisable to lock
134+
the version (especially with the late-2020 pip solver), while the PEP 518
135+
method only makes the dependency available during the build process, so the
136+
version can easily be pinned. This method also tends to not work in
137+
cibuildwheel, conda, and other build systems, since they build with
138+
``--no-deps`` active (which does not affect PEP 518).
139+
140+
Under most circumstances, PEP 518 is a much better solution.
129141

130142
.. _setup_helpers-copy-manually:
131143

0 commit comments

Comments
 (0)