Miro Hrončok - Making sudo pip safe again
For many years, Fedora has deliberately adjusted Python to install Python packages system-wide (e.g. with sudo pip) to /usr/local/lib(64)/python3.X/site-packages. The Fedora's RPM packages install to /usr/lib(64)/python3.X/site-packages. This difference made the frowned-upon yet still heavily common sudo pip install command safer to use and less likely to brick the system.
Packages installed with pip should not negatively interfere with the software installed via the distribution package manager.
Fedora accomplished this by patching the Python standard library distutils module. Unfortunately, distutils are scheduled for removal from Python 3.12+, and that created a problem for Fedora. We cannot patch pip and setuptools because users who use sudo pip would update our patched version with a newer one directly from PyPI. We needed to keep the patch in the Python standard library. At the same time, we wanted to avoid downstream-only hacks that would make Fedora's Python significantly "different" from upstream.
In this talk, I'll explain our journey in the past, how we improved the Python sysconfig module and what challenges we had to solve. I'll also describe why our approach (initially thought to be less hacky and more proper) turned out to be a small UX disaster and how we needed to revert it and start from scratch.
Miro Hrončok
I work at Red Hat Czech in the Python Maintenance team. I teach advanced Python at the Czech Technical University and I teach beginners in the Czech PyLadies beginners courses. I’m a contributing member of the Python Software Foundation and a member of the Fedora Engineering Steering Committee, where I represent the technical leadership in Fedora.
Watch video Miro Hrončok - Making sudo pip safe again online without registration, duration hours minute second in high quality. This video was added by user PyCon PL 10 January 2023, don't forget to share it with your friends and acquaintances, it has been viewed on our site 56 once and liked it 0 people.