From Fedora Project Wiki
(Scope)
m (No more automagic pybytecompilation was done)
 
(12 intermediate revisions by 2 users not shown)
Line 69: Line 69:
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=1585626 #1585626]
* Release Notes tracking: [https://pagure.io/fedora-docs/release-notes/issue/177 #177]
 


== Detailed Description ==
== Detailed Description ==
Line 110: Line 112:
=== Effect on automatic bytecompilation ===
=== Effect on automatic bytecompilation ===


When [[Changes/No_more_automagic_Python_bytecompilation|"No more automagic Python bytecompilation" change]] is done, packages that byte-compile files outside of Python directories should switch to the new behavior described in that change, and should not be impacted by this change.
[[Changes/No_more_automagic_Python_bytecompilation|"No more automagic Python bytecompilation" change]] is done, packages that byte-compile files outside of Python directories should switch to the new behavior described in that change, and should not be impacted by this change.
However, if that change is delayed or reverted, packagers that rely on the old behavior when byte compiling files will need to set <code>%__python</code> to <code>python2</code> or <code>python3</code> explicitly.
<del>However, if that change is delayed or reverted, packagers that rely on the old behavior when byte compiling files will need to set <code>%__python</code> to <code>python2</code> or <code>python3</code> explicitly.</del>


=== Effect on %__python and other ambiguous RPM macros ===
=== Effect on %__python and other ambiguous RPM macros ===


Using ambiguous Python macros (<code>%{__python}</code>, <code>%{python_sitelib}</code>...) is [[Packaging:Python#Macros|forbidden]] and your package will fail to build if you still use those without redefining <code>%__python</code>. Either switch to explicitly versioned macros (<code>%{__python2}</code>, <code>%{python2_sitelib}</code>, <code>%{__python3}</code>...) or set <code>__python</code> to an explicit Python version.
Using ambiguous Python macros (<code>%{__python}</code>, <code>%{python_sitelib}</code>...) is [[Packaging:Python#Macros|forbidden]] and your package will fail to build if you still use those without redefining <code>%__python</code>. Either switch to explicitly versioned macros (<code>%{__python2}</code>, <code>%{python2_sitelib}</code>, <code>%{__python3}</code>...) or set <code>__python</code> to an explicit Python version.
=== Don't (Build)Require python-unversioned-command, but /usr/bin/python ===
If this change ever gets obsoleted, or for older Fedoras support, we ask the maintainers who fallback to (Build)Requiring <code>/usr/bin/python</code>, not to use the package name for the dependency, but the executable path instead.


== Benefit to Fedora ==
== Benefit to Fedora ==
Line 164: Line 170:
<!-- What work do other developers 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 other developers 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?-->


* Release engineering: [https://pagure.io/releng/issues #Releng issue number] (a check of an impact with Release Engineering is needed) <!-- REQUIRED FOR SYSTEM WIDE AS WELL AS FOR SELF CONTAINED CHANGES -->
* Release engineering: [https://pagure.io/releng/issue/7511 #7511] (a check of an impact with Release Engineering is needed) <!-- REQUIRED FOR SYSTEM WIDE AS WELL AS FOR SELF CONTAINED CHANGES -->
<!-- Does this feature require coordination with release engineering (e.g. changes to installer image generation or update package delivery)?  Is a mass rebuild required?  include a link to the releng issue.  
<!-- Does this feature require coordination with release engineering (e.g. changes to installer image generation or update package delivery)?  Is a mass rebuild required?  include a link to the releng issue.  
The issue is required to be filed prior to feature submission, to ensure that someone is on board to do any process development work and testing, and that all changes make it into the pipeline; a bullet point in a change is not sufficient communication -->
The issue is required to be filed prior to feature submission, to ensure that someone is on board to do any process development work and testing, and that all changes make it into the pipeline; a bullet point in a change is not sufficient communication -->
Line 181: Line 187:


<!-- REQUIRED FOR SYSTEM WIDE CHANGES -->
<!-- REQUIRED FOR SYSTEM WIDE CHANGES -->
N/A (not a System Wide Change)
All packages that rely on <code>/usr/bin/python</code> need to change to <code>/usr/bin/python2</code>, or add explicit (Build)Requires.
 
Advanced users that don't install recommended packages by default will either have to install <code>/usr/bin/python</code> manually or live without it. Generally, the users should not be affected by this change.


== How To Test ==
== How To Test ==
Line 199: Line 207:


<!-- REQUIRED FOR SYSTEM WIDE CHANGES -->
<!-- REQUIRED FOR SYSTEM WIDE CHANGES -->
N/A (not a System Wide Change)
TBD


== User Experience ==
== User Experience ==
Line 212: Line 220:
  - Green has been scientifically proven to be the most relaxing color. The move to a default background color of green with green text will result in Fedora users being the most relaxed users of any operating system.
  - Green has been scientifically proven to be the most relaxing color. The move to a default background color of green with green text will result in Fedora users being the most relaxed users of any operating system.
-->
-->
Advanced users might uninstall the <code>/usr/bin/python</code> link if they want to. Others don't need to deal with this change.


== Dependencies ==
== Dependencies ==
Line 217: Line 226:


<!-- REQUIRED FOR SYSTEM WIDE CHANGES -->
<!-- REQUIRED FOR SYSTEM WIDE CHANGES -->
N/A (not a System Wide Change)  
 
We expect packages to FTBFS because of this. Packagers need to fix them (with help from ''Change owners'' if requested). If they don't fix them, the [[Fails_to_build_from_source|usual FTBFS policy]] applies.
 
This change will be done after the [[Changes/Python3.7|switch to Python 3.7]] to avoid work on one change from interfering with work on the other.


== Contingency Plan ==
== Contingency Plan ==


<!-- If you cannot complete your feature by the final development freeze, what is the backup plan?  This might be as simple as "Revert the shipped configuration".  Or it might not (e.g. rebuilding a number of dependent packages).  If you feature is not completed in time we want to assure others that other parts of Fedora will not be in jeopardy.  -->
<!-- If you cannot complete your feature by the final development freeze, what is the backup plan?  This might be as simple as "Revert the shipped configuration".  Or it might not (e.g. rebuilding a number of dependent packages).  If you feature is not completed in time we want to assure others that other parts of Fedora will not be in jeopardy.  -->
* Contingency mechanism: (What to do?  Who will do it?) N/A (not a System Wide Change) <!-- REQUIRED FOR SYSTEM WIDE CHANGES -->
* Contingency mechanism: If this proves problematic, we will make {{package|python2}} require <code>/usr/bin/python</code> (instead of just recommending it). <!-- REQUIRED FOR SYSTEM WIDE CHANGES -->
<!-- When is the last time the contingency mechanism can be put in place?  This will typically be the beta freeze. -->
<!-- When is the last time the contingency mechanism can be put in place?  This will typically be the beta freeze. -->
* Contingency deadline: N/A (not a System Wide Change) <!-- REQUIRED FOR SYSTEM WIDE CHANGES -->
* Contingency deadline: beta freeze <!-- REQUIRED FOR SYSTEM WIDE CHANGES -->
<!-- Does finishing this feature block the release, or can we ship with the feature in incomplete state? -->
<!-- Does finishing this feature block the release, or can we ship with the feature in incomplete state? -->
* Blocks release? N/A (not a System Wide Change), Yes/No <!-- REQUIRED FOR SYSTEM WIDE CHANGES -->
* Blocks release? No <!-- REQUIRED FOR SYSTEM WIDE CHANGES -->
* Blocks product? product <!-- Applicable for Changes that blocks specific product release/Fedora.next -->
* Blocks product? No <!-- Applicable for Changes that blocks specific product release/Fedora.next -->


== Documentation ==
== Documentation ==
Line 233: Line 245:


<!-- REQUIRED FOR SYSTEM WIDE CHANGES -->
<!-- REQUIRED FOR SYSTEM WIDE CHANGES -->
N/A (not a System Wide Change)
TBD


== Release Notes ==
== Release Notes ==
Line 241: Line 253:
Release Notes are not required for initial draft of the Change Proposal but has to be completed by the Change Freeze.  
Release Notes are not required for initial draft of the Change Proposal but has to be completed by the Change Freeze.  
-->
-->
TBD


[[Category:ChangePageIncomplete]]
[[Category:ChangeAcceptedF29]]
<!-- When your change proposal page is completed and ready for review and announcement -->
<!-- When your change proposal page is completed and ready for review and announcement -->
<!-- remove Category:ChangePageIncomplete and change it to Category:ChangeReadyForWrangler -->
<!-- remove Category:ChangePageIncomplete and change it to Category:ChangeReadyForWrangler -->

Latest revision as of 16:54, 3 July 2018



Move /usr/bin/python into a separate package

Summary

Reflecting the recent changes of PEP 394 -- The "python" Command on Unix-Like Systems, we are moving /usr/bin/python from the Package-x-generic-16.pngpython2 package into a separate package called Package-x-generic-16.pngpython-unversioned-command. Package-x-generic-16.pngpython2 will recommend this package.

This means Fedora users will get it automatically with Package-x-generic-16.pngpython2, but they might opt-out and remove it. In Fedora's build system, only packages explicitly buildrequiring /usr/bin/python will get it.

This change obsoletes "Avoid /usr/bin/python in RPM build" change.


Owner

  • Release notes owner:

Current status


Detailed Description

Motivation

The meaning of the python command is ambiguous: it might mean either Python 2 or Python 3, depending on context. The upstream recommendation (PEP 394), which we try to follow in Fedora, is that users -- not distros, and not sysadmins -- should be in control of the python command.

Specifically, this means distro-packaged software should use python2 or python3 explicitly. Fedora's Python packaging guidelines have suggested this since February 2015, and demand it since August 2017. However, enforcing this guideline (which we will need to actually allow users to safely change their python command) is problematic. "Avoid /usr/bin/python in RPM_Build" change didn't work: most of the packagers didn't change anything and too many packages still use the python command.

Instead of developing custom hacks, we are now utilizing a more systematic solution: If your package still needs /usr/bin/python to build, explicitly BuildRequire it. If your package needs /usr/bin/python to run, explicitly Require it. (In both cases, try to use /usr/bin/python2 or /usr/bin/python3 instead if possible.)

We are also expecting some buildsystems (autools, cmake, etc.) to automatically use /usr/bin/python2 if /usr/bin/python is unavailable, so the problem might go away more naturally.

PEP 394 and how it is mapped to this change

Upstream PEP 394 -- The "python" Command on Unix-Like Systems describes how the python command should behave. In Fedora, that's /usr/bin/python. The PEP was recently updated to reflect upstream's evolving views on the situation. Notable new information from the PEP is:

In controlled environments aimed at expert users, where being explicit is valued over user experience (for example, in test environments and package build systems), distributions may choose to not provide the python command even if python2 is available. (All software in such a controlled environment must use python3 or python2 rather than python, which means scripts that deliberately use python need to be modified for such environments.)

We consider Fedora's build machinery a controlled environments aimed at expert users.

What's changing

"Avoid /usr/bin/python in RPM_Build" change is reverted. Packages that follow its Quick Opt-Out section (i.e. set PYTHON_DISALLOW_AMBIGUOUS_VERSION) will be fixed by the owners of this change.

/usr/bin/python remains a symbolic link to /usr/bin/python2. However, it is moved to a new Package-x-generic-16.pngpython-unversioned-command package (technically a subpackage of Package-x-generic-16.pngpython2). Package-x-generic-16.pngpython2 package will only recommend /usr/bin/python.

Packages that need /usr/bin/python to build will need to BuildRequire it. Packages that need /usr/bin/python to be used by users will need to Require it. In both cases, the packager should avoid the need and only fallback to (Build)Requiring /usr/bin/python as a temporary workaround.

The new package will virtually provide python, ensuring that dnf install python will make the python command available.

Effect on automatic bytecompilation

"No more automagic Python bytecompilation" change is done, packages that byte-compile files outside of Python directories should switch to the new behavior described in that change, and should not be impacted by this change. However, if that change is delayed or reverted, packagers that rely on the old behavior when byte compiling files will need to set %__python to python2 or python3 explicitly.

Effect on %__python and other ambiguous RPM macros

Using ambiguous Python macros (%{__python}, %{python_sitelib}...) is forbidden and your package will fail to build if you still use those without redefining %__python. Either switch to explicitly versioned macros (%{__python2}, %{python2_sitelib}, %{__python3}...) or set __python to an explicit Python version.

Don't (Build)Require python-unversioned-command, but /usr/bin/python

If this change ever gets obsoleted, or for older Fedoras support, we ask the maintainers who fallback to (Build)Requiring /usr/bin/python, not to use the package name for the dependency, but the executable path instead.

Benefit to Fedora

This change brings us one step closer to a seamless transition to Python 3, while following upstream recommendations.

This change allows experienced users to remove /usr/bin/python in a supported way.

Scope

  • Proposal owners:
    • Split the packages as described in Detailed Description.
    • Fix packages that use PYTHON_DISALLOW_AMBIGUOUS_VERSION to BuildRequire /usr/bin/python instead.
  • Other developers:
    • Maintainers of packages that use /usr/bin/python need to switch to using /usr/bin/python3 or /usr/bin/python2 explicitly (with help from Proposal owners if needed).
      • While doing that, consider switching your package to Python 3 only, if the Python 2 bits are unused in Fedora. (This is not necessarily required for this change, however it will make your packaging job easier.)
      • If that can't be done in a timely manner, fallback to (Build)Requiring /usr/bin/python as a temporary workaround.
  • Release engineering: #7511 (a check of an impact with Release Engineering is needed)
  • Policies and guidelines:
    • Already existing: "packages in Fedora ... MUST call the proper executable for the needed python major version directly, either /usr/bin/python2 or /usr/bin/python3 as appropriate" from Packaging:Python#Multiple_Python_Runtimes.
  • Trademark approval: N/A (not needed for this Change)

Upgrade/compatibility impact

All packages that rely on /usr/bin/python need to change to /usr/bin/python2, or add explicit (Build)Requires.

Advanced users that don't install recommended packages by default will either have to install /usr/bin/python manually or live without it. Generally, the users should not be affected by this change.

How To Test

TBD

User Experience

Advanced users might uninstall the /usr/bin/python link if they want to. Others don't need to deal with this change.

Dependencies

We expect packages to FTBFS because of this. Packagers need to fix them (with help from Change owners if requested). If they don't fix them, the usual FTBFS policy applies.

This change will be done after the switch to Python 3.7 to avoid work on one change from interfering with work on the other.

Contingency Plan

  • Contingency mechanism: If this proves problematic, we will make Package-x-generic-16.pngpython2 require /usr/bin/python (instead of just recommending it).
  • Contingency deadline: beta freeze
  • Blocks release? No
  • Blocks product? No

Documentation

TBD

Release Notes

TBD