Hello. I have just learned about PEP 610. As Fedora Python maintainers, when we designed our “modern” (read PEP 517/518 instead of setup.py build
and setup.py install
) RPM packaging, we have chosen pip
as the tool we use. In practice, we do basically 2 steps after fetching and installing the dependencies to the build chroot:
Build:
$ python -m pip wheel --wheel-dir pyproject-wheeldir --no-deps --use-pep517 --no-build-isolation --disable-pip-version-check --no-clean --progress-bar off --verbose .
Install:
python -m pip install --root $RPM_BUILD_ROOT --no-deps --disable-pip-version-check --progress-bar off --verbose --ignore-installed --no-warn-script-location pyproject-wheeldir/*.whl
sed -i 's/pip/rpm/' $RPM_BUILD_ROOT/usr/lib*/python*/*.dist-info/INSTALLER
Up until now, this was working fine. With PEP 610, we now have a *.dist-info/direct_url.json
file created. As a result, packages built that way show up in pip freeze
as follows (only pluggy
was built this way in the example):
...
packaging==20.3
pluggy @ file:///builddir/build/BUILD/pluggy-0.13.0/pyproject-wheeldir/pluggy-0.13.0-py2.py3-none-any.whl
py==1.8.0
...
For our users, this information is not useful. The /builddir/build/BUILD/pluggy-0.13.0/pyproject-wheeldir/
directory, neither the pluggy-0.13.0-py2.py3-none-any.whl
file exist on user systems, they merely exist in the build chroot during the RPM build (and are discarded after the build is finished).
What is the best practice for Linux distributors who build RPM (DEB, etc.) packages with pip
? I am inclined to “simply” stick:
rf -vf $RPM_BUILD_ROOT/usr/lib*/python*/*.dist-info/direct_url.json
…into the proces, to rollback to “previous behavior”. Is it the best practice? Should this be documented?
Crazy (not well thought) long term idea: Should we propose a new extension to PEP 610 to be able to say "this package is installed from an RPM package of xyz? Something like:
{
"url": "rpm://python3-pluggy-0.13.0-1.fc33.noarch",
"archive_info": {
"name": "python3-pluggy",
"epoch": "0",
"version": "0.13.0",
"release": "1.fc33",
"arch": "noarch"
}
}
(I know rpm://
is not a valid URL schema, please don’t bike-shed the data, just the high level idea.)
PS Sorry to pitch in after the whole thing got approved an implemented, I wasn’t aware of this before Given this is provisional, I think we are still good to define best practices for Linux packaging.
cc @encukou @torsava @vstinner @pradyunsg @sbidoul @cjerdonek @ncoghlan