From Fedora Project Wiki
(Postponing this Change as suggested in https://bugzilla.redhat.com/show_bug.cgi?id=1357407#c6 and approved by FESCo in https://fedorahosted.org/fesco/ticket/1630#comment:3)
 
(16 intermediate revisions by 4 users not shown)
Line 1: Line 1:
= Automatic PyPI Provides for Python RPM Packages =
= Automatic Provides for Python RPM Packages =


== Summary ==
== Summary ==
Upon building Python packages containing packaging metadata, RPM will automatically detect the canonical name<ref name="canonical" /> of the software on PyPI (Python Package Index) and create a virtual Provides tag with the value <code>pythonX.Ydist(PYPI_CANONICAL_NAME)</code>, where <code>X.Y</code> is the used Python version. RPM may also detect dependencies of the software from the metadata and automatically require them using the same syntax.
Upon building Python packages containing packaging metadata, RPM will automatically detect the standardized name of the software (i.e. dist name, name on PyPI) in the canonical format<ref name="canonical" /> and create a virtual Provides tag with the value <code>pythonX.Ydist(CANONICAL_NAME)</code>, where <code>X.Y</code> is the used Python version.
<!-- A sentence or two summarizing what this change is and what it will do. This information is used for the overall changeset summary page for each release. -->
<!-- A sentence or two summarizing what this change is and what it will do. This information is used for the overall changeset summary page for each release. -->


Line 10: Line 10:
This should link to your home wiki page so we know who you are.
This should link to your home wiki page so we know who you are.
-->
-->
* Name: [[User:Pviktori| Petr Viktorin]]
* Name: [[User:torsava| Tomas Orsava]]
* Name: [[User:torsava| Tomas Orsava]]
* Name: [[User:Churchyard| Miro Hroncok]]
* Name: [[User:Churchyard| Miro Hroncok]]
Line 34: Line 35:
CLOSED as NEXTRELEASE -> change is completed and verified and will be delivered in next release under development
CLOSED as NEXTRELEASE -> change is completed and verified and will be delivered in next release under development
-->
-->
* Tracker bug: <will be assigned by the Wrangler>
* Tracker bug: [https://bugzilla.redhat.com/show_bug.cgi?id=1357407 #1357407]


== Detailed Description ==
== Detailed Description ==


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.
If during the building of a Python package RPM encounters <code>.egg-info, .egg-link</code> or <code>.dist-info</code> files (provided in Python Wheels and Eggs), it will read the standardized name of the software (i.e. dist name, name on PyPI) in the canonical format and create a virtual Provides tag with the value <code>pythonX.Ydist(CANONICAL_NAME)</code>, where <code>X.Y</code> is the used Python version.
Note that the canonical format can differ slightly from the name displayed, for example, on PyPI.<ref name="canonical">The canonical name is obtained by switching the standardized name to lower case and converting all non-alphanumeric runs to single “-” characters. Example: “The $$$ Tree” becomes “the-tree”.</ref>


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.<ref name="canonical">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”.</ref>
All Python packages will need to be rebuilt so that the virtual Provides tags are generated and can be used by users, scripts and the requires generator.
 
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 ==
== Benefit to Fedora ==
Line 48: Line 48:


== Scope ==
== Scope ==
* Proposal owners: Prepare a draft for the Fedora Packaging Guidelines for Python
* Proposal owners: Prepare a draft for the Fedora Packaging Guidelines for Python. Ticket [https://fedorahosted.org/fpc/ticket/635]
<!-- What work do the feature owners have to accomplish to complete the feature in time for release?  Is it a large change affecting many parts of the distribution or is it a very isolated change? What are those changes?-->
<!-- What work do the feature owners have to accomplish to complete the feature in time for release?  Is it a large change affecting many parts of the distribution or is it a very isolated change? What are those changes?-->


* Maintainers of the RPM package: Backport the functionality from upsteram to Fedora. — Already done thanks to [[User:ffesti| Florian Festi]] [https://bugzilla.redhat.com/show_bug.cgi?id=1340885]
* Maintainers of the RPM package: Backport the functionality from upsteram to Fedora. — Already done thanks to [[User:ffesti| Florian Festi]] [https://bugzilla.redhat.com/show_bug.cgi?id=1340885]


* Release engineering: Targeted rebuild of Python packages. Ticket [https://fedorahosted.org/rel-eng/ticket/6432].
* Release engineering: Targeted rebuild of Python packages. Ticket [https://fedorahosted.org/rel-eng/ticket/6432]
<!-- Does this feature require coordination with release engineering (e.g. changes to installer image generation or update package delivery)?  Is a mass rebuid required?  If a rel-eng ticket exists, add a link here.
<!-- Does this feature require coordination with release engineering (e.g. changes to installer image generation or update package delivery)?  Is a mass rebuid required?  If a rel-eng ticket exists, add a link here.
Please work with releng prior to feature submission, and ensure that someone is on board to do any process development work and testing; don't just assume that a bullet point in a change puts someone else on the hook.-->
Please work with releng prior to feature submission, and ensure that someone is on board to do any process development work and testing; don't just assume that a bullet point in a change puts someone else on the hook.-->
Line 89: Line 89:
0. Pick any Python software that is both packaged for Fedora and present on PyPI.
0. Pick any Python software that is both packaged for Fedora and present on PyPI.


1. <code>dnf install pythonX.Ydist(PYPI_CANONICAL_NAME)</code> 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.<ref name="canonical" />
1. <code>dnf install pythonX.Ydist(CANONICAL_NAME)</code> 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 standardized name of the software (dist name, name on PyPI) in its canonical format.<ref name="canonical" />


Expected results: The correct package is installed.
Expected results: The correct package is installed.
Line 96: Line 96:
<!-- If this change proposal is noticeable by its target audience, how will their experiences change as a result?  Describe what they will see or notice. -->
<!-- If this change proposal is noticeable by its target audience, how will their experiences change as a result?  Describe what they will see or notice. -->
<!-- REQUIRED FOR SYSTEM WIDE CHANGES -->
<!-- REQUIRED FOR SYSTEM WIDE CHANGES -->
Users will be able to use dnf to install software from PyPI without knowing under what name the software is packaged in Fedora.
Users will be able to use dnf to install software from PyPI without knowing under what name the software is packaged in Fedora. In the future, tools that mimic pip installation using dnf may be evolved.


== Dependencies ==
== Dependencies ==

Latest revision as of 08:16, 3 October 2016

Automatic Provides for Python RPM Packages

Summary

Upon building Python packages containing packaging metadata, RPM will automatically detect the standardized name of the software (i.e. dist name, name on PyPI) in the canonical format[1] and create a virtual Provides tag with the value pythonX.Ydist(CANONICAL_NAME), where X.Y is the used Python version.

Owner

Current status

Detailed Description

If during the building of a Python package RPM encounters .egg-info, .egg-link or .dist-info files (provided in Python Wheels and Eggs), it will read the standardized name of the software (i.e. dist name, name on PyPI) in the canonical format and create a virtual Provides tag with the value pythonX.Ydist(CANONICAL_NAME), where X.Y is the used Python version. Note that the canonical format can differ slightly from the name displayed, for example, on PyPI.[1]

All Python packages will need to be rebuilt so that the virtual Provides tags are generated and can be used by users, scripts and the requires generator.

Benefit to Fedora

Packaging Python software will become easier, and (semi-)automatic tools for creating Python packages like pyp2rpm [1] will be significantly more effective due to this change.

Scope

  • Proposal owners: Prepare a draft for the Fedora Packaging Guidelines for Python. Ticket [2]
  • Maintainers of the RPM package: Backport the functionality from upsteram to Fedora. — Already done thanks to Florian Festi [3]
  • Release engineering: Targeted rebuild of Python packages. Ticket [4]
    • 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

Upgrade/compatibility impact

No issues expected of any kind.

How To Test

0. Pick any Python software that is both packaged for Fedora and present on PyPI.

1. dnf install pythonX.Ydist(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 standardized name of the software (dist name, name on PyPI) in its canonical format.[1]

Expected results: The correct package is installed.

User Experience

Users will be able to use dnf to install software from PyPI without knowing under what name the software is packaged in Fedora. In the future, tools that mimic pip installation using dnf may be evolved.

Dependencies

None

Contingency Plan

  • Contingency mechanism: Do not update the Fedora Packaging Guidelines
  • Contingency deadline: Alpha Freeze
  • Blocks release? No
  • Blocks product? None

Documentation

  • Information about the backport of this feature on Bugzilla. [5]
  • Descriptive commit message on RPM upstream: [6]
  • Python-devel mailing list discussion: [7]

Release Notes

Notes

  1. 1.0 1.1 1.2 The canonical name is obtained by switching the standardized name to lower case and converting all non-alphanumeric runs to single “-” characters. Example: “The $$$ Tree” becomes “the-tree”.