#475 Suggested Changes for Python Guidelines for F22
Closed: Fixed None Opened 4 years ago by bkabrda.

Hi,
in connection with the "Python 3 as Default" change submitted for F22 [1], I'd like to propose few changes to Python packaging guidelines. They were discussed with broader community at [2]:

  • In [3], it says "If the executables provide the same functionality independent of whether they are run on top of Python 2 or Python 3, then only one version of the executable should be packaged. Currently it will be the python 2 implementation, but once the Python 3 implementation is proven to work, the executable can be retired from the python 2 build and enabled in the python 3 package." - This should be changed to prefer Python 3 and only suggest Python 2 if upstream code doesn't yet run on Python 3.

  • As for binaries/scripts in /usr/bin (assuming there are both python2 and python3 versions), the unversioned files should point to python2 version. This aligns with /usr/bin/python still pointing to python2. This is sort of what guidelines say right now, but it should be explicitly pointed out.

  • (This is not really related to the switch, but more of a general remark) In [4], it says that "python 3 version of the executable gains a python3- prefix". This is IMO bad, since upstream projects tend to name the versioned binaries "foo-3.4, foo-3" or "foo3.4, foo3". We should accept one of these, preferably the one with dashes (e.g. foo-3.4).Prefixing with python3- doesn't make sense to me, because it's not similar to any upstream way and you don't find the binaries under their names using tab completion (e.g. foo<tab> doesn't tell you about python3-foo). As Nick Coghlan suggested in one of his responses in the thread, the guideline could say:

"For Python executables, also provide symlinks with a '-X' and '-X.Y' suffix, unless upstream already provides appropriately versioned executables without the dash. For compatibility packages, the Python version is appended after the specific package version".

Some things to point out about this example:
- Assuming the package provides versioned binaries, it should provide both foo-3 and foo-3.4.
- Assuming the upstream package already adopted some form of binaries versioning, this should be preferred even if it is different from the guidelined one (e.g. python-pip upstream uses the form pip3, pip3.4, so the packager should accept these instead of changing them).

Please note that Toshio suggested, that for compatibility packages Python version should be before the compat package version, hence giving sth. like

foo-3-v1.2 (compat package foo, version 1.2, Python 3 build)

As opposed to Nick's (and mine) suggestion:

foo-v1.2-3 (same as above, only Python version is after package version)

Toshio noted that using the "v1.2-3" version, it is not clear that "-3" relates to Python version, OTOH always putting the Python version at the very end seems (to me) to be a more systematic and consistent solution. It'd probably be good if FPC members could suggest their preferred choices for this.

I'll be happy to answer any questions or participate in a discussion about this.
Thanks!

[1] http://fedoraproject.org/wiki/Changes/Python_3_as_Default
[2] https://lists.fedoraproject.org/pipermail/packaging/2014-December/010360.html
[3] http://fedoraproject.org/wiki/Packaging:Python#Guidelines


We discussed this at today's meeting (http://meetbot.fedoraproject.org/fedora-meeting-1/2014-12-11/fpc.2014-12-11-17.01.txt) and we're mostly fine with it but had some comments and wanted a real diff to policy to officially vote:

  • 475 Suggested Changes for Python Guidelines for F22 (geppetto,


    17:39:58)
  • ACTION: Mostly approving but follow comments from IRC discussion and
    write a real policy change we can vote on. (geppetto, 18:01:44)

Thanks, I'll try to do that before the next meeting.

I've copied the current guidelines under my wiki namespace and did the changes, so consider this diff to be the proposal to vote on: https://fedoraproject.org/w/index.php?title=User%3ABkabrda%2FPy3Changes&diff=400088&oldid=400085

Thanks.

I was confused when reading this the unversioned executable must be the python 2 version as I'd have expected python 3 here. Yet this is in line with /usr/bin/python being python2 for now.

Could it be made clear, that only single executables should pick the python 3 version by default a few lines above:

if only one executable is to be shipped, then it owns its own slot -> if only one executable is to be shipped, then it owns its own slot and should use /usr/bin/python3 from Fedora 22 on ?

Replying to [comment:5 tomspur]:

I was confused when reading this the unversioned executable must be the python 2 version as I'd have expected python 3 here. Yet this is in line with /usr/bin/python being python2 for now.

Could it be made clear, that only single executables should pick the python 3 version by default a few lines above:

if only one executable is to be shipped, then it owns its own slot -> if only one executable is to be shipped, then it owns its own slot and should use /usr/bin/python3 from Fedora 22 on ?

Good point, done. The whole diff is now available at https://fedoraproject.org/w/index.php?title=User%3ABkabrda%2FPy3Changes&diff=400217&oldid=400085

I guess this is ready for discussion.

We discussed this at today's meeting (​http://meetbot.fedoraproject.org/fedora-meeting-1/2015-01-22/fpc.2015-01-22-17.01.txt), and it passed:

  • 475 Suggested Changes for Python Guidelines for F22 (geppetto,


    17:58:28)
  • LINK: https://fedorahosted.org/fpc/ticket/475 (geppetto, 17:58:34)
  • ACTION: Suggested Changes for Python Guidelines for F22, versioned
    binaries (+1:5, 0:0, -1:0) (geppetto, 18:31:21)

I've written this up, but while doing so I realized I don't understand the reasoning behind this statement: The unversioned executable must be the python 2 version.

If we're supposed to be switching to python 3 by default, should that not be "the python 3 version" instead?

Announcement text:

The Python guidelines relating to naming of executables in /usr/bin were updated to account for F22's "Python3 by default" feature: https://fedoraproject.org/wiki/Packaging:Python#Executables_in_.2Fusr.2Fbin

I believe what bkabrda proposed to python-sig was that the unversioned executable name should be tied to the unversioned /usr/bin/python. For now /usr/bin/python continues to point to /usr/bin/python2. He further proposed that we'd follow Python upstream's recommendation as to when to switch /usr/bin/python to point to /usr/bin/python3 (if ever). That upstream recommendation is here: http://legacy.python.org/dev/peps/pep-0394/#abstract

Replying to [comment:11 toshio]:

I believe what bkabrda proposed to python-sig was that the unversioned executable name should be tied to the unversioned /usr/bin/python. For now /usr/bin/python continues to point to /usr/bin/python2. He further proposed that we'd follow Python upstream's recommendation as to when to switch /usr/bin/python to point to /usr/bin/python3 (if ever). That upstream recommendation is here: http://legacy.python.org/dev/peps/pep-0394/#abstract

Yes, that's exactly the reason. Thanks :)

Metadata Update from @james:
- Issue assigned to tibbs

2 years ago

Login to comment on this ticket.

Metadata