Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 2f463eb

Browse filesBrowse files
committed
Stop installing setuptools and wheel on Python 3.12+
Currently `get-pip.py` installs not only pip, but also setuptools and wheel by default, unless the `--no-setuptools` / `--no-wheel` (or `PIP_NO_SETUPTOOLS` / `PIP_NO_WHEEL` env vars) are used. This has historically been necessary, however, modern versions of pip will now fallback to `pyproject.toml` (PEP 517: [1]) based builds (which will default to a setuptools backend, and thus automatically install setuptools and wheel in the isolated build environment) if either setuptools is not installed (as of pip 22.1: [2]), or if wheel is not installed (as of pip 23.1: [3]). In addition, as of Python 3.12, the stdlib's `ensurepip` and `venv` modules no longer install setuptools, and only install pip ([4]). As such, it is now time for `get-pip.py` to stop installing setuptools and wheel by default on Python 3.12+, in order to: - Act as another small step towards `pyproject.toml` / PEP 517 based builds eventually becoming the pip default. - Improve parity with the behaviour of `ensurepip` / `venv` on Python 3.12+. - Allow `get-pip.py` to focus on its primary responsibility: bootstrapping Pip. Closes pypa#200. [1]: https://peps.python.org/pep-0517/ [2]: pypa/pip#10717 [3]: pypa/pip#11871 [4]: python/cpython#101039
1 parent ac92537 commit 2f463eb
Copy full SHA for 2f463eb

File tree

5 files changed

+49
-29
lines changed
Filter options

5 files changed

+49
-29
lines changed

‎README.md

Copy file name to clipboardExpand all lines: README.md
+17-9Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# get-pip.py
22

33
`get-pip.py` is a bootstrapping script that enables users to install pip,
4-
setuptools, and wheel in Python environments that don't already have them. You
4+
in Python environments that don't already have it installed. You
55
should not directly reference the files located in this repository and instead
66
use the versions located at <https://bootstrap.pypa.io/>.
77

@@ -12,26 +12,34 @@ $ curl -sSL https://bootstrap.pypa.io/get-pip.py -o get-pip.py
1212
$ python get-pip.py
1313
```
1414

15-
Upon execution, `get-pip.py` will install `pip`, `setuptools` and `wheel` in
16-
the current Python environment.
15+
Upon execution, `get-pip.py` will install the latest version of `pip` into the
16+
current Python environment. When using Python 3.11 or older, by default the
17+
packages `setuptools` and `wheel` will also be installed if an existing version
18+
of them was not found.
1719

1820
It is possible to provide additional arguments to the underlying script. These
1921
are passed through to the underlying `pip install` command, and can thus be
20-
used to constraint the versions of the packages, or to pass other pip options
21-
such as `--no-index`.
22+
used to constrain the versions of the packages, install additional packages,
23+
or to pass other pip options such as `--no-index`.
2224

2325
```console
24-
$ python get-pip.py "pip < 21.0" "setuptools < 50.0" "wheel < 1.0"
26+
# Constrain the Pip version
27+
$ python get-pip.py "pip < 21.0"
28+
29+
# Force the installation of `setuptools` and `wheel` on newer Python versions.
30+
$ python get-pip.py setuptools wheel
31+
32+
# Install packages from a local directory instead of PyPI.
2533
$ python get-pip.py --no-index --find-links=/local/copies
2634
```
2735

2836
### get-pip.py options
2937

30-
This script also has it's own options, which control which packages it will
38+
This script also has its own options, which control which packages it will
3139
install.
3240

33-
- `--no-setuptools`: do not attempt to install `setuptools`.
34-
- `--no-wheel`: do not attempt to install `wheel`.
41+
- `--no-setuptools`: Do not attempt to install `setuptools`. This is a no-op on Python 3.12+.
42+
- `--no-wheel`: do not attempt to install `wheel`. This is a no-op on Python 3.12+.
3543

3644
## Development
3745

‎public/3.6/get-pip.py

Copy file name to clipboardExpand all lines: public/3.6/get-pip.py
+8-5Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -71,11 +71,14 @@ def determine_pip_install_arguments():
7171

7272
args.append("pip<22.0")
7373

74-
if include_setuptools(pre):
75-
args.append("setuptools")
74+
# We no longer install setuptools and wheel by default on Python 3.12+
75+
# for parity with the `ensurepip` and `venv` modules.
76+
if this_python < (3, 12):
77+
if include_setuptools(pre):
78+
args.append("setuptools")
7679

77-
if include_wheel(pre):
78-
args.append("wheel")
80+
if include_wheel(pre):
81+
args.append("wheel")
7982

8083
return ["install", "--upgrade", "--force-reinstall"] + args
8184

@@ -111,7 +114,7 @@ def bootstrap(tmpdir):
111114
monkeypatch_for_cert(tmpdir)
112115

113116
# Execute the included pip and use it to install the latest pip and
114-
# setuptools from PyPI
117+
# any user-requested packages from PyPI.
115118
from pip._internal.cli.main import main as pip_entry_point
116119
args = determine_pip_install_arguments()
117120
sys.exit(pip_entry_point(args))

‎public/3.7/get-pip.py

Copy file name to clipboardExpand all lines: public/3.7/get-pip.py
+8-5Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -71,11 +71,14 @@ def determine_pip_install_arguments():
7171

7272
args.append("pip<24.1")
7373

74-
if include_setuptools(pre):
75-
args.append("setuptools")
74+
# We no longer install setuptools and wheel by default on Python 3.12+
75+
# for parity with the `ensurepip` and `venv` modules.
76+
if this_python < (3, 12):
77+
if include_setuptools(pre):
78+
args.append("setuptools")
7679

77-
if include_wheel(pre):
78-
args.append("wheel")
80+
if include_wheel(pre):
81+
args.append("wheel")
7982

8083
return ["install", "--upgrade", "--force-reinstall"] + args
8184

@@ -111,7 +114,7 @@ def bootstrap(tmpdir):
111114
monkeypatch_for_cert(tmpdir)
112115

113116
# Execute the included pip and use it to install the latest pip and
114-
# setuptools from PyPI
117+
# any user-requested packages from PyPI.
115118
from pip._internal.cli.main import main as pip_entry_point
116119
args = determine_pip_install_arguments()
117120
sys.exit(pip_entry_point(args))

‎public/get-pip.py

Copy file name to clipboardExpand all lines: public/get-pip.py
+8-5Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -71,11 +71,14 @@ def determine_pip_install_arguments():
7171

7272
args.append("pip")
7373

74-
if include_setuptools(pre):
75-
args.append("setuptools")
74+
# We no longer install setuptools and wheel by default on Python 3.12+
75+
# for parity with the `ensurepip` and `venv` modules.
76+
if this_python < (3, 12):
77+
if include_setuptools(pre):
78+
args.append("setuptools")
7679

77-
if include_wheel(pre):
78-
args.append("wheel")
80+
if include_wheel(pre):
81+
args.append("wheel")
7982

8083
return ["install", "--upgrade", "--force-reinstall"] + args
8184

@@ -111,7 +114,7 @@ def bootstrap(tmpdir):
111114
monkeypatch_for_cert(tmpdir)
112115

113116
# Execute the included pip and use it to install the latest pip and
114-
# setuptools from PyPI
117+
# any user-requested packages from PyPI.
115118
from pip._internal.cli.main import main as pip_entry_point
116119
args = determine_pip_install_arguments()
117120
sys.exit(pip_entry_point(args))

‎templates/default.py

Copy file name to clipboardExpand all lines: templates/default.py
+8-5Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -71,11 +71,14 @@ def determine_pip_install_arguments():
7171

7272
args.append("pip{pip_version}")
7373

74-
if include_setuptools(pre):
75-
args.append("setuptools{setuptools_version}")
74+
# We no longer install setuptools and wheel by default on Python 3.12+
75+
# for parity with the `ensurepip` and `venv` modules.
76+
if this_python < (3, 12):
77+
if include_setuptools(pre):
78+
args.append("setuptools{setuptools_version}")
7679

77-
if include_wheel(pre):
78-
args.append("wheel{wheel_version}")
80+
if include_wheel(pre):
81+
args.append("wheel{wheel_version}")
7982

8083
return ["install", "--upgrade", "--force-reinstall"] + args
8184

@@ -111,7 +114,7 @@ def bootstrap(tmpdir):
111114
monkeypatch_for_cert(tmpdir)
112115

113116
# Execute the included pip and use it to install the latest pip and
114-
# setuptools from PyPI
117+
# any user-requested packages from PyPI.
115118
from pip._internal.cli.main import main as pip_entry_point
116119
args = determine_pip_install_arguments()
117120
sys.exit(pip_entry_point(args))

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.