Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide get-pip.py versions for all python versions #88

Open
xavfernandez opened this issue Jan 26, 2021 · 12 comments
Open

Provide get-pip.py versions for all python versions #88

xavfernandez opened this issue Jan 26, 2021 · 12 comments

Comments

@xavfernandez
Copy link
Member

Each time pip drops the support for some version of python, users need to update their script from https://bootstrap.pypa.io/get-pip.py to https://bootstrap.pypa.io/X.Y/get-pip.py.

I'm wondering if we shouldn't directly provide https://bootstrap.pypa.io/X.Y/get-pip.py for all existing (and recent) python versions.

That would currently mean to provide https://bootstrap.pypa.io/3.6/get-pip.py, https://bootstrap.pypa.io/3.7/get-pip.py, https://bootstrap.pypa.io/3.8/get-pip.py, https://bootstrap.pypa.io/3.9/get-pip.py & https://bootstrap.pypa.io/3.10/get-pip.py that would be copies of https://bootstrap.pypa.io/get-pip.py.

Users would then be able to directly use the get-pip.py script version matching their python version.

@pfmoore
Copy link
Member

pfmoore commented Jan 26, 2021

As an alternative, get-pip.py could check the Python version, and if it's not a supported version, print a message directing the user to download the appropriate https://bootstrap.pypa.io/X.Y/get-pip.py script and use that, and then exit.

@bsiegel
Copy link

bsiegel commented Jan 26, 2021

Perhaps get-pip.py could redirect to the version that works for whichever version if Python is requesting it, that way users and build systems would not all need to code in the logic to select the correct URL for the correct Python version.

@pradyunsg
Copy link
Member

We can't have redirects, since a common mechanism is using curl, which won't be happy with redirects.

@webknjaz
Copy link
Member

@pradyunsg curl -L can follow redirects just fine.

@pfmoore
Copy link
Member

pfmoore commented Jan 27, 2021

But the suggestion was "redirect to the version that works for whichever version if Python is requesting it" and if you're requesting it with curl, the server has no way to know which version of Python is requesting it (because it's not being requested by Python!)

@bsiegel
Copy link

bsiegel commented Jan 27, 2021

Yep, sure - I should have been more clear, I don't think HTTP redirects specifically are the mechanism to achieve this. Just that in concept, if the initial script could function as a sort of stub, determine the Python version that is executing it, and then load the appropriate full version of the get-pip script, that would provide significant value. However, I realize even that may not be viable because the get-pip script is intentionally kept simple (e.g. it doesn't attempt to do any network operations for example, and adding such a mechanism would add new complexity, failure modes, etc).

An alternative that might provide similar value would be to provide versioned copies of the script not by their interpreter version, but by the version of pip they install (e.g. https://bootstrap.pypa.io/21.0/get-pip.py). Extending this idea, there is prior art we can look at from Javascript CDNs which allow the requester to include a version specifier in the URL. For example, this is how jsDelivr handles versioned URLs:

// load the specific version v3.2.1
https://cdn.jsdelivr.net/npm/[email protected]/dist/jquery.min.js

// load the latest v3.2.x version
https://cdn.jsdelivr.net/npm/[email protected]/dist/jquery.min.js

// load the latest v3.x version
https://cdn.jsdelivr.net/npm/jquery@3/dist/jquery.min.js

// omit the version completely to get the latest one
https://cdn.jsdelivr.net/npm/jquery/dist/jquery.min.js

This can be pretty easily managed by simply populating the appropriate directory structure with copies of the scripts, and publishing updates to the right places. It's only marginally more complex than the current approach, and the "deployment" could be done in a couple lines of shell script. But it would provide a lot of value for e.g. reproducible builds, CI maintainers, etc.

@pradyunsg
Copy link
Member

pradyunsg commented Feb 21, 2021

I don't think jsDelivr's model works for us -- we don't follow SemVer and, realistically, "get me something for my Python version" is much easier to support than get-me-a-specific-version.


Now that the script for handling generation has been modernised in #85 and #100, this should be significantly easier to do. :)

@uranusjr
Copy link
Member

uranusjr commented Mar 7, 2021

I think it’s a good idea to provide scripts for all versions, even if they are just duplicates to the main get-pip.py. Provision projects currently need to always refer to the versionless get-pip.py, which creates problems when the user provision with an old version of the tool after a Python version is dropped by pip, and the tool has no way to address this in a forward-compatible way.

If we provide scripts to all Python versions, tools can instead have something like

versioned_url = "https://bootstrap.pypa.io/{v.major}.{v.minor}/get-pip.py".format(v=sys.version_info)
script_path = _download_script(versioned_url)
subprocess.run([sys.executable, str(script_path)], check=True)

that’s guaranteed to work no matter in the future.

@pradyunsg
Copy link
Member

Yup yup. That's why I've been making all the changes in this repository recently. ;)

@pradyunsg
Copy link
Member

Alrighty, we can now do this. It's a matter of updating the following dictionary:

SCRIPT_CONSTRAINTS = {
"default": {
"pip": "",
"setuptools": "",
"wheel": "",
},
"2.6": {
"pip": "<10",
"setuptools": "<37",
"wheel": "<0.30",
},
"2.7": {
"pip": "<21.0",
"setuptools": "<45",
"wheel": "",
},
"3.2": {
"pip": "<8",
"setuptools": "<30",
"wheel": "<0.30",
},
"3.3": {
"pip": "<18",
"setuptools": "",
"wheel": "<0.30",
},
"3.4": {
"pip": "<19.2",
"setuptools": "",
"wheel": "",
},
"3.5": {
"pip": "<21.0",
"setuptools": "",
"wheel": "",
},
}

And updating the logic for how we determine the "minimum supported version" for the "default" get-pip.py script:

major, minor = map(int, sorted_python_versions[-1].split("."))


The open question here is: how do we want to handle constraints for the versions of Python where we haven't dropped support yet? We do however need to care about the pip version, since that determines whether the script can run on the Python interpreter.

It's not a big deal for setuptools and wheel pins, since the newer versions of pip are Python-Requires aware -- so keeping them as empty strings is fine.

@pradyunsg
Copy link
Member

Oh, I just realized... we do get the requires_python key in the JSON from PyPI -- we can use that information to populate the pip pin! We can probably remove the pip key from this mapping if we use this information!

Given that we don't need a setuptools/wheel pin anymore, that whole hard-coded-bits-of-information can be removed too, making this much easier to use as well.

lguohan pushed a commit to sonic-net/sonic-buildimage that referenced this issue Apr 28, 2021
Issue is get_pip.py is moved to pip 21.1 (https://github.com/pypa/get-pip/commits/main) which is not compatible with 3.6.
Issue of pip itself is fixed as part of 21.1.1 in pip community (pypa/pip#9835).
However get-pip.py is still not updated to latest pip. Also get.pip.py does not support python 3.6 version explicitly (pypa/get-pip#88)

Step 15/29 : RUN curl https://bootstrap.pypa.io/get-pip.py | python3.6
 ---> Running in bece31f49267
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
100 1891k  100 1891k    0     0  9564k      0 --:--:-- --:--:-- --:--:-- 9600k
Traceback (most recent call last):
  File "<stdin>", line 24298, in <module>
  File "<stdin>", line 139, in main
  File "<stdin>", line 115, in bootstrap
  File "<stdin>", line 96, in monkeypatch_for_cert
  File "/tmp/tmp5fnxrz0a/pip.zip/pip/_internal/commands/__init__.py", line 9, in <module>
  File "/tmp/tmp5fnxrz0a/pip.zip/pip/_internal/cli/base_command.py", line 12, in <module>
  File "/tmp/tmp5fnxrz0a/pip.zip/pip/_internal/cli/cmdoptions.py", line 30, in <module>
  File "/tmp/tmp5fnxrz0a/pip.zip/pip/_internal/utils/hashes.py", line 2, in <module>
ImportError: cannot import name 'NoReturn'
The command '/bin/sh -c curl https://bootstrap.pypa.io/get-pip.py | python3.6' returned a non-zero code: 1
How I did:

Got the file from https://github.com/pypa/get-pip/tree/21.0 and added to the buildimage
pin pip to the previous release 21.0.1. (Similar is done in other public repos eg: grpc/grpc-java#8115)

Signed-off-by: Abhishek Dosi <[email protected]>
lguohan pushed a commit to lguohan/sonic-buildimage that referenced this issue Apr 28, 2021
Issue is get_pip.py is moved to pip 21.1 (https://github.com/pypa/get-pip/commits/main) which is not compatible with 3.6.
Issue of pip itself is fixed as part of 21.1.1 in pip community (pypa/pip#9835).
However get-pip.py is still not updated to latest pip. Also get.pip.py does not support python 3.6 version explicitly (pypa/get-pip#88)

Step 15/29 : RUN curl https://bootstrap.pypa.io/get-pip.py | python3.6
 ---> Running in bece31f49267
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
100 1891k  100 1891k    0     0  9564k      0 --:--:-- --:--:-- --:--:-- 9600k
Traceback (most recent call last):
  File "<stdin>", line 24298, in <module>
  File "<stdin>", line 139, in main
  File "<stdin>", line 115, in bootstrap
  File "<stdin>", line 96, in monkeypatch_for_cert
  File "/tmp/tmp5fnxrz0a/pip.zip/pip/_internal/commands/__init__.py", line 9, in <module>
  File "/tmp/tmp5fnxrz0a/pip.zip/pip/_internal/cli/base_command.py", line 12, in <module>
  File "/tmp/tmp5fnxrz0a/pip.zip/pip/_internal/cli/cmdoptions.py", line 30, in <module>
  File "/tmp/tmp5fnxrz0a/pip.zip/pip/_internal/utils/hashes.py", line 2, in <module>
ImportError: cannot import name 'NoReturn'
The command '/bin/sh -c curl https://bootstrap.pypa.io/get-pip.py | python3.6' returned a non-zero code: 1
How I did:

Got the file from https://github.com/pypa/get-pip/tree/21.0 and added to the buildimage
pin pip to the previous release 21.0.1. (Similar is done in other public repos eg: grpc/grpc-java#8115)

Signed-off-by: Abhishek Dosi <[email protected]>
yxieca pushed a commit to sonic-net/sonic-buildimage that referenced this issue Apr 29, 2021
* [build] Fix the snmp docker build error. (#7452)

Issue is get_pip.py is moved to pip 21.1 (https://github.com/pypa/get-pip/commits/main) which is not compatible with 3.6.
Issue of pip itself is fixed as part of 21.1.1 in pip community (pypa/pip#9835).
However get-pip.py is still not updated to latest pip. Also get.pip.py does not support python 3.6 version explicitly (pypa/get-pip#88)

Step 15/29 : RUN curl https://bootstrap.pypa.io/get-pip.py | python3.6
 ---> Running in bece31f49267
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
100 1891k  100 1891k    0     0  9564k      0 --:--:-- --:--:-- --:--:-- 9600k
Traceback (most recent call last):
  File "<stdin>", line 24298, in <module>
  File "<stdin>", line 139, in main
  File "<stdin>", line 115, in bootstrap
  File "<stdin>", line 96, in monkeypatch_for_cert
  File "/tmp/tmp5fnxrz0a/pip.zip/pip/_internal/commands/__init__.py", line 9, in <module>
  File "/tmp/tmp5fnxrz0a/pip.zip/pip/_internal/cli/base_command.py", line 12, in <module>
  File "/tmp/tmp5fnxrz0a/pip.zip/pip/_internal/cli/cmdoptions.py", line 30, in <module>
  File "/tmp/tmp5fnxrz0a/pip.zip/pip/_internal/utils/hashes.py", line 2, in <module>
ImportError: cannot import name 'NoReturn'
The command '/bin/sh -c curl https://bootstrap.pypa.io/get-pip.py | python3.6' returned a non-zero code: 1
How I did:

Got the file from https://github.com/pypa/get-pip/tree/21.0 and added to the buildimage
pin pip to the previous release 21.0.1. (Similar is done in other public repos eg: grpc/grpc-java#8115)

Signed-off-by: Abhishek Dosi <[email protected]>
LuiSzee pushed a commit to CentecNetworks/sonic-buildimage that referenced this issue Aug 10, 2021
Issue is get_pip.py is moved to pip 21.1 (https://github.com/pypa/get-pip/commits/main) which is not compatible with 3.6.
Issue of pip itself is fixed as part of 21.1.1 in pip community (pypa/pip#9835).
However get-pip.py is still not updated to latest pip. Also get.pip.py does not support python 3.6 version explicitly (pypa/get-pip#88)

Step 15/29 : RUN curl https://bootstrap.pypa.io/get-pip.py | python3.6
 ---> Running in bece31f49267
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
100 1891k  100 1891k    0     0  9564k      0 --:--:-- --:--:-- --:--:-- 9600k
Traceback (most recent call last):
  File "<stdin>", line 24298, in <module>
  File "<stdin>", line 139, in main
  File "<stdin>", line 115, in bootstrap
  File "<stdin>", line 96, in monkeypatch_for_cert
  File "/tmp/tmp5fnxrz0a/pip.zip/pip/_internal/commands/__init__.py", line 9, in <module>
  File "/tmp/tmp5fnxrz0a/pip.zip/pip/_internal/cli/base_command.py", line 12, in <module>
  File "/tmp/tmp5fnxrz0a/pip.zip/pip/_internal/cli/cmdoptions.py", line 30, in <module>
  File "/tmp/tmp5fnxrz0a/pip.zip/pip/_internal/utils/hashes.py", line 2, in <module>
ImportError: cannot import name 'NoReturn'
The command '/bin/sh -c curl https://bootstrap.pypa.io/get-pip.py | python3.6' returned a non-zero code: 1
How I did:

Got the file from https://github.com/pypa/get-pip/tree/21.0 and added to the buildimage
pin pip to the previous release 21.0.1. (Similar is done in other public repos eg: grpc/grpc-java#8115)

Signed-off-by: Abhishek Dosi <[email protected]>
@pradyunsg
Copy link
Member

PRs to do this would be welcome!

edmorley added a commit to edmorley/get-pip that referenced this issue Apr 14, 2024
Modern Pip (v9.0.0+) supports `Requires-Python` and so automatically
takes the current Python version into account, when determining the
latest version of packages that can be installed.

As such, for modern Pip we don't need to specify version range constraints
for the pip/setuptools/wheel versions.

This is the first step towards being able to remove `SCRIPT_CONSTRAINTS`
and rely purely on `Requires-Python` metadata, per:
pypa#88 (comment)

I've intentionally left the "figure out what Pip version to embed in the
template" part of template generation alone for now to keep the PR
smaller, and for now only changed the run-time `pip install` parts.

I had to add a new `pre-9.py` template file (created as a copy of
`pre-10.py`), since it's only pip<9 that needs the various version
constraint references in the template. The `pre-9.py` template
is only used for Python 3.2.
edmorley added a commit to edmorley/get-pip that referenced this issue Apr 14, 2024
Modern Pip (v9.0.0+) supports `Requires-Python` and so automatically
takes the current Python version into account, when determining the
latest version of packages that can be installed.

As such, for modern Pip we don't need to specify version range
constraints for the pip/setuptools/wheel versions passed to the
`pip install` at `get-pip.py` run-time.

This is the first step towards being able to remove `SCRIPT_CONSTRAINTS`
and rely purely on `Requires-Python` metadata, per:
pypa#88 (comment)

I've intentionally left the "figure out what Pip version to embed in the
template" part of template generation alone for now to keep the PR
smaller, and have only changed the run-time `pip install` parts.

I had to add a new `pre-9.py` template file (created as a copy of
`pre-10.py`), since it's only pip<9 that needs the various version
constraint references in the template (and otherwise anything else that
used `pre-10.py`, such as Python 2.6, would have had redundant version
constraints). The new `pre-9.py` template is only used for Python 3.2.
edmorley added a commit to edmorley/get-pip that referenced this issue Apr 14, 2024
Modern Pip (v9.0.0+) supports `Requires-Python` and so automatically
takes the current Python version into account, when determining the
latest version of packages that can be installed.

As such, for modern Pip we don't need to specify version range
constraints for the pip/setuptools/wheel versions passed to the
`pip install` at `get-pip.py` run-time.

This is the first step towards being able to remove `SCRIPT_CONSTRAINTS`
and rely purely on `Requires-Python` metadata, per:
pypa#88 (comment)

I've intentionally left the "figure out what Pip version to embed in the
template" part of template generation alone for now to keep the PR
smaller, and have only changed the run-time `pip install` parts.

I had to add a new `pre-9.py` template file (created as a copy of
`pre-10.py`), since it's only pip<9 that needs the various version
constraint references in the template (and otherwise anything else that
used `pre-10.py`, such as Python 2.6, would have had redundant version
constraints). The new `pre-9.py` template is only used for Python 3.2.
edmorley added a commit to edmorley/get-pip that referenced this issue Jun 21, 2024
Modern Pip (v9.0.0+) supports `Requires-Python` and so automatically
takes the current Python version into account, when determining the
latest version of packages that can be installed.

As such, for modern Pip we don't need to specify version range
constraints for the pip/setuptools/wheel versions passed to the
`pip install` at `get-pip.py` run-time.

This is the first step towards being able to remove `SCRIPT_CONSTRAINTS`
and rely purely on `Requires-Python` metadata, per:
pypa#88 (comment)

I've intentionally left the "figure out what Pip version to embed in the
template" part of template generation alone for now to keep the PR
smaller, and have only changed the run-time `pip install` parts.

I had to add a new `pre-9.py` template file (created as a copy of
`pre-10.py`), since it's only pip<9 that needs the various version
constraint references in the template (and otherwise anything else that
used `pre-10.py`, such as Python 2.6, would have had redundant version
constraints). The new `pre-9.py` template is only used for Python 3.2.
edmorley added a commit to edmorley/get-pip that referenced this issue Jun 21, 2024
Modern Pip (v9.0.0+) supports `Requires-Python` and so automatically
takes the current Python version into account, when determining the
latest version of packages that can be installed.

As such, for modern Pip we don't need to specify version range
constraints for the pip/setuptools/wheel versions passed to the
`pip install` at `get-pip.py` run-time.

This is the first step towards being able to remove `SCRIPT_CONSTRAINTS`
and rely purely on `Requires-Python` metadata, per:
pypa#88 (comment)

I've intentionally left the "figure out what Pip version to embed in the
template" part of template generation alone for now to keep the PR
smaller, and have only changed the run-time `pip install` parts.

I had to add a new `pre-9.py` template file (created as a copy of
`pre-10.py`), since it's only pip<9 that needs the various version
constraint references in the template (and otherwise anything else that
used `pre-10.py`, such as Python 2.6, would have had redundant version
constraints). The new `pre-9.py` template is only used for Python 3.2.
edmorley added a commit to edmorley/get-pip that referenced this issue Jun 26, 2024
Modern Pip (v9.0.0+) supports `Requires-Python` and so automatically
takes the current Python version into account, when determining the
latest version of packages that can be installed.

As such, for modern Pip we don't need to specify version range
constraints for the pip/setuptools/wheel versions passed to the
`pip install` at `get-pip.py` run-time.

This is the first step towards being able to remove `SCRIPT_CONSTRAINTS`
and rely purely on `Requires-Python` metadata, per:
pypa#88 (comment)

I've intentionally left the "figure out what Pip version to embed in the
template" part of template generation alone for now to keep the PR
smaller, and have only changed the run-time `pip install` parts.

I had to add a new `pre-9.py` template file (created as a copy of
`pre-10.py`), since it's only pip<9 that needs the various version
constraint references in the template (and otherwise anything else that
used `pre-10.py`, such as Python 2.6, would have had redundant version
constraints). The new `pre-9.py` template is only used for Python 3.2.
edmorley added a commit to edmorley/get-pip that referenced this issue Jun 27, 2024
Modern Pip (v9.0.0+) supports `Requires-Python` and so automatically
takes the current Python version into account, when determining the
latest version of packages that can be installed.

As such, for modern Pip we don't need to specify version range
constraints for the pip/setuptools/wheel versions passed to the
`pip install` at `get-pip.py` run-time.

This is the first step towards being able to remove `SCRIPT_CONSTRAINTS`
and rely purely on `Requires-Python` metadata, per:
pypa#88 (comment)

I've intentionally left the "figure out what Pip version to embed in the
template" part of template generation alone for now to keep the PR
smaller, and have only changed the run-time `pip install` parts.

I had to add a new `pre-9.py` template file (created as a copy of
`pre-10.py`), since it's only pip<9 that needs the various version
constraint references in the template (and otherwise anything else that
used `pre-10.py`, such as Python 2.6, would have had redundant version
constraints). The new `pre-9.py` template is only used for Python 3.2.
edmorley added a commit to edmorley/get-pip that referenced this issue Jul 7, 2024
Modern Pip (v9.0.0+) supports `Requires-Python` and so automatically
takes the current Python version into account, when determining the
latest version of packages that can be installed.

As such, for modern Pip we don't need to specify version range
constraints for the pip/setuptools/wheel versions passed to the
`pip install` at `get-pip.py` run-time.

This is the first step towards being able to remove `SCRIPT_CONSTRAINTS`
and rely purely on `Requires-Python` metadata, per:
pypa#88 (comment)

I've intentionally left the "figure out what Pip version to embed in the
template" part of template generation alone for now to keep the PR
smaller, and have only changed the run-time `pip install` parts.

I had to add a new `pre-9.py` template file (created as a copy of
`pre-10.py`), since it's only pip<9 that needs the various version
constraint references in the template (and otherwise anything else that
used `pre-10.py`, such as Python 2.6, would have had redundant version
constraints). The new `pre-9.py` template is only used for Python 3.2.
edmorley added a commit to edmorley/get-pip that referenced this issue Jul 29, 2024
Modern Pip (v9.0.0+) supports `Requires-Python` and so automatically
takes the current Python version into account, when determining the
latest version of packages that can be installed.

As such, for modern Pip we don't need to specify version range
constraints for the pip/setuptools/wheel versions passed to the
`pip install` at `get-pip.py` run-time.

This is the first step towards being able to remove `SCRIPT_CONSTRAINTS`
and rely purely on `Requires-Python` metadata, per:
pypa#88 (comment)

I've intentionally left the "figure out what Pip version to embed in the
template" part of template generation alone for now to keep the PR
smaller, and have only changed the run-time `pip install` parts.

I had to add a new `pre-9.py` template file (created as a copy of
`pre-10.py`), since it's only pip<9 that needs the various version
constraint references in the template (and otherwise anything else that
used `pre-10.py`, such as Python 2.6, would have had redundant version
constraints). The new `pre-9.py` template is only used for Python 3.2.
edmorley added a commit to edmorley/get-pip that referenced this issue Aug 26, 2024
Modern Pip (v9.0.0+) supports `Requires-Python` and so automatically
takes the current Python version into account, when determining the
latest version of packages that can be installed.

As such, for modern Pip we don't need to specify version range
constraints for the pip/setuptools/wheel versions passed to the
`pip install` at `get-pip.py` run-time.

This is the first step towards being able to remove `SCRIPT_CONSTRAINTS`
and rely purely on `Requires-Python` metadata, per:
pypa#88 (comment)

I've intentionally left the "figure out what Pip version to embed in the
template" part of template generation alone for now to keep the PR
smaller, and have only changed the run-time `pip install` parts.

I had to add a new `pre-9.py` template file (created as a copy of
`pre-10.py`), since it's only pip<9 that needs the various version
constraint references in the template (and otherwise anything else that
used `pre-10.py`, such as Python 2.6, would have had redundant version
constraints). The new `pre-9.py` template is only used for Python 3.2.
edmorley added a commit to edmorley/get-pip that referenced this issue Aug 26, 2024
Modern pip (v9.0.0+) supports `Requires-Python` and so automatically
takes the current Python version into account, when determining the
latest version of packages that can be installed.

As such, for modern pip we don't need to specify version range
constraints for the pip/setuptools/wheel versions passed to the
`pip install` at `get-pip.py` run-time.

This is the first step towards being able to remove `SCRIPT_CONSTRAINTS`
and rely purely on `Requires-Python` metadata, per:
pypa#88 (comment)

I've intentionally left the "figure out what pip version to embed in the
template" part of template generation alone for now to keep the PR
smaller, and have only changed the run-time `pip install` parts.

I had to add a new `pre-9.py` template file (created as a copy of
`pre-10.py`), since it's only pip<9 that needs the various version
constraint references in the template (and otherwise anything else that
used `pre-10.py`, such as Python 2.6, would have had redundant version
constraints). The new `pre-9.py` template is only used for Python 3.2.
edmorley added a commit to edmorley/get-pip that referenced this issue Oct 27, 2024
Modern pip (v9.0.0+) supports `Requires-Python` and so automatically
takes the current Python version into account, when determining the
latest version of packages that can be installed.

As such, for modern pip we don't need to specify version range
constraints for the pip/setuptools/wheel versions passed to the
`pip install` at `get-pip.py` run-time.

This is the first step towards being able to remove `SCRIPT_CONSTRAINTS`
and rely purely on `Requires-Python` metadata, per:
pypa#88 (comment)

I've intentionally left the "figure out what pip version to embed in the
template" part of template generation alone for now to keep the PR
smaller, and have only changed the run-time `pip install` parts.

I had to add a new `pre-9.py` template file (created as a copy of
`pre-10.py`), since it's only pip<9 that needs the various version
constraint references in the template (and otherwise anything else that
used `pre-10.py`, such as Python 2.6, would have had redundant version
constraints). The new `pre-9.py` template is only used for Python 3.2.
edmorley added a commit to edmorley/get-pip that referenced this issue Nov 17, 2024
Modern pip (v9.0.0+) supports `Requires-Python` and so automatically
takes the current Python version into account, when determining the
latest version of packages that can be installed.

As such, for modern pip we don't need to specify version range
constraints for the pip/setuptools/wheel versions passed to the
`pip install` at `get-pip.py` run-time.

This is the first step towards being able to remove `SCRIPT_CONSTRAINTS`
and rely purely on `Requires-Python` metadata, per:
pypa#88 (comment)

I've intentionally left the "figure out what pip version to embed in the
template" part of template generation alone for now to keep the PR
smaller, and have only changed the run-time `pip install` parts.

I had to add a new `pre-9.py` template file (created as a copy of
`pre-10.py`), since it's only pip<9 that needs the various version
constraint references in the template (and otherwise anything else that
used `pre-10.py`, such as Python 2.6, would have had redundant version
constraints). The new `pre-9.py` template is only used for Python 3.2.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants