- 1 Automatic PyPI Provides for Python RPM Packages
Automatic PyPI Provides for Python RPM Packages
Upon building Python packages containing packaging metadata, RPM will automatically detect the canonical name of the software on PyPI (Python Package Index) and create a virtual Provides tag with the value
X.Y is the used Python version. RPM may also detect dependencies of the software from the metadata and automatically require them using the same syntax.
- Targeted release: Fedora 25
- Last updated: 2016-06-24
- Tracker bug: <will be assigned by the Wrangler>
The metadata needed for the provides/dependency generator are standard Python metadata in .egg-info/.egg-link/.dist-info files that are provided in Python Wheels and Eggs. Because these files don't always contain the full list of requirements (which are either in setup.py or requirements.txt), the dependency generator will not be conclusive.
Note that the virtual Provides tags as well as the dependencies will be generated using the PyPI canonical name, which can differ slightly from the name displayed on PyPI.
All Python packages will need to be rebuilt so that the virtual Provides tags are generated for them so that the dependency generator can start working.
Benefit to Fedora
Packaging Python software will become easier, and (semi-)automatic tools for creating Python packages like pyp2rpm  will be significantly more effective due to this change.
- Proposal owners: Prepare a draft for the Fedora Packaging Guidelines for Python
- Maintainers of the RPM package: Backport the functionality from upsteram to Fedora. — Already done thanks to Florian Festi 
- Release engineering: Targeted rebuild of Python packages. Ticket .
- List of deliverables: All Fedora deliverables will be affected, but only in a very minor way that in no way jeopardizes their delivery.
- Policies and guidelines: Fedora Packaging Guidelines for Python need to be updated after the implementation so users know how to take advantage of the change.
- Trademark approval: Not needed for this Change
No issues expected of any kind.
How To Test
0. Pick any Python software that is both packaged for Fedora and present on PyPI.
dnf install pythonX.Ydist(PYPI_CANONICAL_NAME) where X.Y is one of the Python versions for which the software is packaged in Fedora (for Fedora 24 it is most likely 3.5 and/or 2.7) and inside the parentheses is the name of the software on PyPI in its canonical format.
Expected results: The correct package is installed.
Users will be able to use dnf to install software from PyPI without knowing under what name the software is packaged in Fedora.
- Contingency mechanism: Do not update the Fedora Packaging Guidelines
- Contingency deadline: Alpha Freeze
- Blocks release? No
- Blocks product? None
- Information about the backport of this feature on Bugzilla. 
- Descriptive commit message on RPM upstream: 
- Python-devel mailing list discussion: 
- The canonical name is obtained by switching the PyPI name to lower case and converting all non-alphanumeric runs to single “-” characters. Example: “The $$$ Tree” becomes “the-tree”.