From 6ff621bcfbfc38f4556ea8b843dc6d393186b6ee Mon Sep 17 00:00:00 2001 From: Sviatoslav Sydorenko Date: Sat, 23 Dec 2023 01:59:36 +0100 Subject: [PATCH 1/2] Stop injecting `wheel` as a build dep fallback PEP 517 doesn't mandate depending on `wheel` when a `__legacy__` setuptools fallback is used. Historically, it used to be assumed as necessary, but later it turned out to be wrong. The reason is that `setuptools`' `get_requires_for_build_wheel()` hook already injects this dependency when building wheels is requested [[1]]. It also used to have this hint in the docs, but it was corrected earlier [[2]]. It could be argued that this is an optimization as `pip` will request building wheels anyway. However, it also shows up in the docs, giving the readers a wrong impression of what to put into `[build-system].requires` when they start a new project using setuptools. This patch removes `wheel` from said `requires` list fallback in the docs and the actual runtime. [1]: https://github.com/pypa/setuptools/blob/v40.8.0/setuptools/build_meta.py#L130 [2]: https://github.com/pypa/setuptools/pull/3056 --- docs/html/reference/build-system/pyproject-toml.md | 2 +- news/12449.bugfix.rst | 2 ++ src/pip/_internal/pyproject.py | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) create mode 100644 news/12449.bugfix.rst diff --git a/docs/html/reference/build-system/pyproject-toml.md b/docs/html/reference/build-system/pyproject-toml.md index a42a3b8c484..c1e7a68c597 100644 --- a/docs/html/reference/build-system/pyproject-toml.md +++ b/docs/html/reference/build-system/pyproject-toml.md @@ -135,7 +135,7 @@ section, it will be assumed to have the following backend settings: ```toml [build-system] -requires = ["setuptools>=40.8.0", "wheel"] +requires = ["setuptools>=40.8.0"] build-backend = "setuptools.build_meta:__legacy__" ``` diff --git a/news/12449.bugfix.rst b/news/12449.bugfix.rst new file mode 100644 index 00000000000..19f1d9809ac --- /dev/null +++ b/news/12449.bugfix.rst @@ -0,0 +1,2 @@ +Removed ``wheel`` from the ``[build-system].requires`` list fallback +that is used when ``pyproject.toml`` is absent. diff --git a/src/pip/_internal/pyproject.py b/src/pip/_internal/pyproject.py index eb8e12b2dec..8de36b873ed 100644 --- a/src/pip/_internal/pyproject.py +++ b/src/pip/_internal/pyproject.py @@ -123,7 +123,7 @@ def load_pyproject_toml( # a version of setuptools that supports that backend. build_system = { - "requires": ["setuptools>=40.8.0", "wheel"], + "requires": ["setuptools>=40.8.0"], "build-backend": "setuptools.build_meta:__legacy__", } From 3769ad7e0c024952060d76528d64feaf25bc3f15 Mon Sep 17 00:00:00 2001 From: Sviatoslav Sydorenko Date: Sat, 23 Dec 2023 02:16:48 +0100 Subject: [PATCH 2/2] Stop telling users to use `wheel` as build dep --- docs/html/reference/build-system/pyproject-toml.md | 2 +- news/12449.doc.rst | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 news/12449.doc.rst diff --git a/docs/html/reference/build-system/pyproject-toml.md b/docs/html/reference/build-system/pyproject-toml.md index c1e7a68c597..9719023cced 100644 --- a/docs/html/reference/build-system/pyproject-toml.md +++ b/docs/html/reference/build-system/pyproject-toml.md @@ -141,7 +141,7 @@ build-backend = "setuptools.build_meta:__legacy__" If a project has a `build-system` section but no `build-backend`, then: -- It is expected to include `setuptools` and `wheel` as build requirements. An +- It is expected to include `setuptools` as a build requirement. An error is reported if the available version of `setuptools` is not recent enough. diff --git a/news/12449.doc.rst b/news/12449.doc.rst new file mode 100644 index 00000000000..431475f51eb --- /dev/null +++ b/news/12449.doc.rst @@ -0,0 +1,2 @@ +Updated the ``pyproject.toml`` document to stop suggesting +to depend on ``wheel`` as a build dependency directly.