https://fedoraproject.org/wiki/User:Churchyard/Packaging:Python
https://fedoraproject.org/w/index.php?title=User%3AChurchyard%2FPackaging%3APython&diff=498285&oldid=498137
However, packages in Fedora must (instead of should) not depend on where /usr/bin/python happens to point but instead must (instead of should) call the proper executable for the needed python major version directly, either /usr/bin/python2 or /usr/bin/python3 as appropriate. As a result of that /usr/bin/python (as well as /usr/bin/env python and similar) is also explicitly forbidden in shebangs and as a dependency of a package.
/usr/bin/python
/usr/bin/python2
/usr/bin/python3
/usr/bin/env python
Previously this was added as a SHOULD rule in #327, however the time when we switch /usr/bin/python to Python 3 is getting closer and closer. We need a strict guideline that forbids the usage of /usr/bin/python, so we can start filling bugs, fixing packages, etc. This guidelines change is a part of Finalizing Fedora's Switch to Python 3.
Should the explanation also mention that in advance of Fedora changing the default, we'd like to allow admins to change their local default without breaking any system packages?
They would also benefit form this change, yes. However, it is IMO not our primary reason, nor we will encourage that. Also, I don't think there will be much time in between getting rid of /usr/bin/python usage in packages and changing the default. Nevertheless the sysadmins might want to change the default after the switch (i.e. back to Python 2) and if nothing in Fedora uses /usr/bin/python any more, it should be safe for them to do so.
@churchyard That second part sounds like a good thing to make an explicit design goal then: when the default changes, we want to provide a supported way for admins to change it back (at least for a couple more releases after the default changes)
@ncoghlan I'll make a note at https://fedoraproject.org/wiki/FinalizingFedoraSwitchtoPython3
EDIT: Done in https://fedoraproject.org/wiki/FinalizingFedoraSwitchtoPython3#Phase_2:_Switch_python_to_refer_to_python3
Metadata Update from @tibbs: - Issue tagged with: meeting
+1 to the concept to me. As to the draft itself, well, the ban on use of env doesn't really follow from the ban on use of /usr/bin/python so the language is a little confusing.
env
I note that the problem with env isn't really Python-specific, so I filed #700 regarding a global ban. But anyway, for cleaner language I propose just using this text for the relevant section:
Each Python runtime corresponds to a binary of the form /usr/bin/python$MAJOR.$MINOR. /usr/bin/python$MAJOR is also provided. In addition, for end user convenience one of these python runtimes is designated as the "system runtime" and is run when /usr/bin/python is called.
/usr/bin/python$MAJOR.$MINOR
/usr/bin/python$MAJOR
The following restrictions apply:
Packaged software MUST NOT on which version of Python is provided by the system runtime, or even that it exists on the system.
There's a verb missing.
Note that firstly, I didn't include anything about /usr/bin/env python, because I was confident it is already forbidden:
https://fedoraproject.org/w/index.php?title=User%3AChurchyard%2FPackaging%3APython&diff=498138&oldid=498137
Later I found out that /usr/bin/env ... is not actually forbidden, so I've added that as well. Given #700, we can revert back to https://fedoraproject.org/w/index.php?title=User:Churchyard/Packaging:Python&oldid=498138 or use your text.
/usr/bin/env ...
I think I just had hopes that people would realize how bad an idea env is and... not use it in their packages. 1277 packages prove me wrong.
And yeah, the missing verb there is "rely". I am trying to avoid "depend" unless specifically referring to a package dependency.
I think I prefer the original text.
We discussed this at this weeks meeting (https://meetbot-raw.fedoraproject.org/fedora-meeting-2/2017-08-09/fpc.2017-08-09-17.00.txt):
Metadata Update from @james: - Issue untagged with: meeting - Issue assigned to tibbs - Issue tagged with: writeup
Announcement text:
The python guidelines were modified to forbid the use of /usr/bin/python in shebang lines or as a dependency of a package.
Metadata Update from @tibbs: - Issue untagged with: writeup - Issue tagged with: announce
Metadata Update from @tibbs: - Issue untagged with: announce - Issue close_status updated to: accepted - Issue status updated to: Closed (was: Open)
Log in to comment on this ticket.