◐ Shell
clean mode source ↗

GH-80789: Get rid of the ``ensurepip`` infra for many wheels by webknjaz · Pull Request #109245 · python/cpython

@webknjaz webknjaz changed the title Get rid of the ensurepip infra for many wheels GH-109245: Get rid of the ensurepip infra for many wheels

Sep 10, 2023

This was referenced

Sep 10, 2023

vstinner

@AA-Turner AA-Turner changed the title GH-109245: Get rid of the ensurepip infra for many wheels GH-80789: Get rid of the ensurepip infra for many wheels

Sep 16, 2023

vstinner

webknjaz

webknjaz

webknjaz

AA-Turner

webknjaz

This is a refactoring change that aims to simplify ``ensurepip``.
Before it, this module had legacy infrastructure that made an
assumption that ``ensurepip`` would be provisioning more then just a
single wheel. That assumption is no longer true since [[1]][[2]][[3]].

In this change, the improvement is done around removing unnecessary
loops and supporting structures to change the assumptions to expect
only the bundled or replacement ``pip`` wheel.

[1]: python@ece20db
[2]: python#101039
[3]: python#95299
This change is intended to make it clear that the helper now only
returns one package and no more.

Co-Authored-By: vstinner@python.org
- Exit early if there are no files in the directory
- Return a match early by iterating in reverse order
- Merge filename checks
- Inline the path variable
- Remove type annotations
- Return a dict with consistent fields
- Remove caching
- Remove type annotations
- Leverage the known wheel package dir value to calculate full paths
It provides us with the ability to write simpler high-level logic that
is easier to understand. As a side effect, it became possible to make
the code less branchy.
It was returning bytes on FreeBSD which was incorrectly injected into
the Python code snippet executed in a subprocess and had a b-preffix.
Some code comments and test function names were still referring to the
removed function name. Not anymore!
This script is separate and is only used in CI as opposed to runtime.
Co-authored-by: Pradyun Gedam <pradyunsg@gmail.com>
Co-authored-by: Pradyun Gedam <pradyunsg@gmail.com>
It was tripping the linters and became unnecessary after hardcoding
the pip wheel filename prefix in the string.

pradyunsg

pradyunsg

@pradyunsg

aisk pushed a commit to aisk/cpython that referenced this pull request

Feb 11, 2024
…ython#109245)

Co-authored-by: vstinner@python.org
Co-authored-by: Pradyun Gedam <pradyunsg@gmail.com>
Co-authored-by: Adam Turner <9087854+aa-turner@users.noreply.github.com>