Skip to content

Commit

Permalink
Stop injecting wheel as a build dep fallback
Browse files Browse the repository at this point in the history
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]: pypa/setuptools#3056
  • Loading branch information
webknjaz committed Dec 23, 2023
1 parent e88d39a commit 6ff621b
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion docs/html/reference/build-system/pyproject-toml.md
Original file line number Diff line number Diff line change
Expand Up @@ -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__"
```

Expand Down
2 changes: 2 additions & 0 deletions news/12449.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Removed ``wheel`` from the ``[build-system].requires`` list fallback
that is used when ``pyproject.toml`` is absent.
2 changes: 1 addition & 1 deletion src/pip/_internal/pyproject.py
Original file line number Diff line number Diff line change
Expand Up @@ -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__",
}

Expand Down

0 comments on commit 6ff621b

Please sign in to comment.