GH-80789: Get rid of the ``ensurepip`` infra for many wheels by webknjaz · Pull Request #109245 · python/cpython
webknjaz
changed the title
Get rid of the
GH-109245: Get rid of the ensurepip infra for many wheelsensurepip infra for many wheels
This was referenced
AA-Turner
changed the title
GH-109245: Get rid of the
GH-80789: Get rid of the ensurepip infra for many wheelsensurepip infra for many wheels
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!
It was tripping the linters and became unnecessary after hardcoding the pip wheel filename prefix in the string.
aisk pushed a commit to aisk/cpython that referenced this pull request
…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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters