You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
ensurepip: add configure --with-wheel-pkg-dir=PATH to get wheel packages from a system directory #87022
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
assignee=Noneclosed_at=<Date2021-01-21.09:50:21.117>created_at=<Date2021-01-07.11:21:06.475>labels= ['library', '3.10']
title='ensurepip: add configure --with-wheel-pkg-dir=PATH to get wheel packages from a system directory'updated_at=<Date2021-01-21.09:50:21.117>user='https://github.com/vstinner'
Having a separated package for wheel packages allows us to upgrade a single package (python-pip-wheel) for setuptools/pip bugfix or security vulnerability.
--
I propose to add a new --with-wheel-pkg-dir=PATH option to the ./configure script. If used, ensurepip will only use wheel packages from this directory. Otherwise, the existing code is unchanged. In short, the behavior is unchanged, unless the option is used explicitly.
If a directory is specified but wheel packages are missing, ensurepip fails.
If the directory contains multiple wheel packages of different versions, the most recent version is used of each package.
Note: In practice, the Fedora package only provides a single wheel package of each Python module. But I propose to make the Python upstream code as generic as possible.
bpo-38662: ensurepip invokes pip via runpy (GH-18901)
The ensurepip module now invokes pip via the runpy module.
Hence it is no longer tightly coupled with the internal API of the bundled
pip version, allowing easier updates to a newer pip version both
internally and for distributors.
This way, any changes to the internal pip API won't mean ensurepip needs to be
changed as well. Also, distributors can update their pip wheels independent on
CPython release schedule.
Co-Authored-By: Pradyun Gedam <pradyunsg@gmail.com>
Co-Authored-By: Miro Hrončok <miro@hroncok.cz>
This change was already related to Fedora downstream change to get wheel packages from a different directory. Fedora can use a different pip version (older or more recent) than ensurepip._bundled.
A bit of manual work required, but it doesn't lead to so incredible convoluted constructs as I see in Fedora (nothing against it, but our build system is already convoluted enough).
hroncok commented on Jan 13, 2021
hroncokmannequin
Mannequin
More actions
In Fedora, we update the wheels independently without rebuilding Python.
What incredible convoluted constructs do you have in mind in particular?
Activity
vstinner commentedon Jan 7, 2021
The Fedora packaging policy recommends to "unbundle" bundled dependencies.
"Fedora packages SHOULD make every effort to avoid having multiple, separate, upstream projects bundled together in a single package."
https://docs.fedoraproject.org/en-US/packaging-guidelines/#bundling
The main motivation is to ease updates when fix serious vulnerabilities (less packaging work).
The ensurepip package contains bundled wheel packages of setuptools and pip:
The Fedora python3 package doesn't contain the ensurepip._bundled package:
$ python3 Python 3.9.1 (default, Dec 8 2020, 00:00:00) >>> import ensurepip._bundled ModuleNotFoundError: No module named 'ensurepip._bundled'Instead, a separated RPM package python-pip-wheel provides wheel packages in /usr/share/python-wheels/ directory:
Fedora has a downstream patch on ensurepip (written by Miro Hrončok) to always use /usr/share/python-wheels/:
https://src.fedoraproject.org/rpms/python3.10/blob/master/f/00189-use-rpm-wheels.patch
Fedora has packages of 9 CPython versions: 2.6, 2.7, 3.4, 3.5, 3.6, 3.7, 3.8, 3.9, 3.10.
https://developer.fedoraproject.org/tech/languages/python/multiple-pythons.html
Having a separated package for wheel packages allows us to upgrade a single package (python-pip-wheel) for setuptools/pip bugfix or security vulnerability.
--
I propose to add a new --with-wheel-pkg-dir=PATH option to the ./configure script. If used, ensurepip will only use wheel packages from this directory. Otherwise, the existing code is unchanged. In short, the behavior is unchanged, unless the option is used explicitly.
If a directory is specified but wheel packages are missing, ensurepip fails.
If the directory contains multiple wheel packages of different versions, the most recent version is used of each package.
Note: In practice, the Fedora package only provides a single wheel package of each Python module. But I propose to make the Python upstream code as generic as possible.
I'm working on a pull request to implement this.
Downstream Fedora issue: https://bugzilla.redhat.com/show_bug.cgi?id=1874803
--
Fedora (Miro) already contributed to ensurepip to make ensurepip less dependent on pip internals:
commit 88f82b2
Author: Miro Hrončok <miro@hroncok.cz>
Date: Tue Mar 10 22:16:28 2020 +0100
This change was already related to Fedora downstream change to get wheel packages from a different directory. Fedora can use a different pip version (older or more recent) than ensurepip._bundled.
vstinner commentedon Jan 7, 2021
An alternative is to find packages in all directories and pick the most recent version.
Example with a specified directory *and* ensurepip._bundled is available:
wheel package directory:
ensurepip._bundled
Most recent versions:
Problem: I'm not sure that pip is fully compatible with any setuptools version.
hroncok commentedon Jan 7, 2021
For simplicity, I would avoid mixing wheels from 2 different directories.
vstinner commentedon Jan 13, 2021
Right. I wrote PR 24210 which is simpler. It either uses bundled wheels, or wheels from the directory.
mcepl commentedon Jan 13, 2021
We (SUSE) have updated versions of the wheels as special Sources, and then this in the %prep stage of our SPEC file:
A bit of manual work required, but it doesn't lead to so incredible convoluted constructs as I see in Fedora (nothing against it, but our build system is already convoluted enough).
hroncok commentedon Jan 13, 2021
In Fedora, we update the wheels independently without rebuilding Python.
What incredible convoluted constructs do you have in mind in particular?
vstinner commentedon Jan 20, 2021
New changeset 75e59a9 by Victor Stinner in branch 'master':
bpo-42856: Add --with-wheel-pkg-dir=PATH configure option (GH-24210)
75e59a9