Fix Python deprecation warnings during build
Summary
Eliminates Python deprecation warnings that appear during the build process by modernizing the Python packaging approach.
Changes
- Replace deprecated
setup.py installwithpip installin the build system - Remove deprecated
codecs.open()import from setup.py - Add
python3-pipto QA package manifest for all supported platforms (CI build dependency)
Why These Changes Are Safe
codecs.open() removal:
The codecs.open() import was added in 2016 when PCP supported Python 2, where the built-in open() function lacked an encoding parameter. In Python 3 (the only version PCP now supports), the built-in open() natively supports encoding and is the recommended approach. Both functions behave identically for UTF-8 files.
pip install migration:
The setup.py install command has been deprecated by setuptools in favor of standards-based tools like pip. The new approach uses pip install with equivalent flags to achieve the same installation behavior.
python3-pip in manifest:
The pip module is now required for the build process but wasn't installed in most CI environments. Added python3-pip entries to qa/admin/other-packages/manifest for all package managers (dpkg, rpm, emerge, etc.) to ensure pip is available during builds. Verified availability on all supported platforms: Ubuntu 18.04+, Debian 11+, CentOS Stream 8+, Fedora 42+, and others.
Testing
- ✅ Build completes successfully with no deprecation warnings
- ✅ All Python extensions compile correctly
- ✅ No functional changes to the installation process
Fixes #2306
ok, this is working on the Mac because we include python3-pip as a dependency. To fix this we'd need to add that as a dependency to all operating systems. This probably needs discussion @natoscott .
@tallpsmith No --record for /usr/bin/python3 -m pip install on Ubuntu.
Yeah @kmcdonell this is looking hairier than Hairy Maclary right now as I dig in. I also have to solve the "how do I run the CI podman setup locally" so that I can easily iterate locally, however I ran into a container architecture mismatch with Apple Silicon that might be another rabbit hole.
I may end up resorting to an Option Claude Code suggested earlier - simply suppress the warnings! :)