diff options
| author | Anderson Bravalheri <andersonbravalheri@gmail.com> | 2023-04-20 14:19:32 +0100 |
|---|---|---|
| committer | Anderson Bravalheri <andersonbravalheri@gmail.com> | 2023-04-20 14:19:32 +0100 |
| commit | b85c164f586f0cd5780661118fa46a422e9bcc4b (patch) | |
| tree | c983ef00ca2cc0fb27ffda18297adec0c961b4bb | |
| parent | 90d6fc852071ac5c662304281d1089ef37441be2 (diff) | |
| parent | 296cb45ea5ced4c6603d4360e18894ef87a7ca77 (diff) | |
| download | python-setuptools-git-b85c164f586f0cd5780661118fa46a422e9bcc4b.tar.gz | |
Fix in-tree PEP 517 backend wrapper example (#3893)
| -rw-r--r-- | changelog.d/3893.doc.rst | 3 | ||||
| -rw-r--r-- | docs/build_meta.rst | 17 |
2 files changed, 13 insertions, 7 deletions
diff --git a/changelog.d/3893.doc.rst b/changelog.d/3893.doc.rst new file mode 100644 index 00000000..f1a6ce79 --- /dev/null +++ b/changelog.d/3893.doc.rst @@ -0,0 +1,3 @@ +Improved the documentation example regarding making a thin :pep:`517` in-tree +backend wrapper of ``setuptools.build_meta`` that is future-proof and supports +:pep:`660` hook too -- by :user:`webknjaz`. diff --git a/docs/build_meta.rst b/docs/build_meta.rst index 197e5917..aa4f1907 100644 --- a/docs/build_meta.rst +++ b/docs/build_meta.rst @@ -137,10 +137,7 @@ the ``_custom_build/backend.py`` file, as shown in the following example: .. code-block:: python from setuptools import build_meta as _orig - - prepare_metadata_for_build_wheel = _orig.prepare_metadata_for_build_wheel - build_wheel = _orig.build_wheel - build_sdist = _orig.build_sdist + from setuptools.build_meta import * 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: return _orig.get_requires_for_build_sdist(config_settings) + [...] -Note that you can override any of the functions specified in :pep:`PEP 517 -<517#build-backend-interface>`, not only the ones responsible for gathering -requirements. +.. note:: + + You can override any of the functions specified in :pep:`PEP 517 + <517#build-backend-interface>`, not only the ones responsible for gathering + requirements. It is important to ``import *`` so that the hooks that you + choose not to reimplement would be inherited from the setuptools' backend + automatically. This will also cover hooks that might be added in the future + like the ones that :pep:`660` declares. + .. important:: Make sure your backend script is included in the :doc:`source distribution </userguide/distribution>`, otherwise the build will fail. |
