Skip to content

Commit b85c164

Browse files
committed
Fix in-tree PEP 517 backend wrapper example (#3893)
2 parents 90d6fc8 + 296cb45 commit b85c164

File tree

2 files changed

+13
-7
lines changed

2 files changed

+13
-7
lines changed

changelog.d/3893.doc.rst

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Improved the documentation example regarding making a thin :pep:`517` in-tree
2+
backend wrapper of ``setuptools.build_meta`` that is future-proof and supports
3+
:pep:`660` hook too -- by :user:`webknjaz`.

docs/build_meta.rst

+10-7
Original file line numberDiff line numberDiff line change
@@ -137,10 +137,7 @@ the ``_custom_build/backend.py`` file, as shown in the following example:
137137
.. code-block:: python
138138
139139
from setuptools import build_meta as _orig
140-
141-
prepare_metadata_for_build_wheel = _orig.prepare_metadata_for_build_wheel
142-
build_wheel = _orig.build_wheel
143-
build_sdist = _orig.build_sdist
140+
from setuptools.build_meta import *
144141
145142
146143
def get_requires_for_build_wheel(config_settings=None):
@@ -151,9 +148,15 @@ the ``_custom_build/backend.py`` file, as shown in the following example:
151148
return _orig.get_requires_for_build_sdist(config_settings) + [...]
152149
153150
154-
Note that you can override any of the functions specified in :pep:`PEP 517
155-
<517#build-backend-interface>`, not only the ones responsible for gathering
156-
requirements.
151+
.. note::
152+
153+
You can override any of the functions specified in :pep:`PEP 517
154+
<517#build-backend-interface>`, not only the ones responsible for gathering
155+
requirements. It is important to ``import *`` so that the hooks that you
156+
choose not to reimplement would be inherited from the setuptools' backend
157+
automatically. This will also cover hooks that might be added in the future
158+
like the ones that :pep:`660` declares.
159+
157160

158161
.. important:: Make sure your backend script is included in the :doc:`source
159162
distribution </userguide/distribution>`, otherwise the build will fail.

0 commit comments

Comments
 (0)