From Fedora Project Wiki
mNo edit summary
mNo edit summary
Line 66: Line 66:


* all files named <code>*.py</code> are Python modules that need to be bytecompiled
* all files named <code>*.py</code> are Python modules that need to be bytecompiled
* when a file is not in <code>/usr/lib(64)?/pythonX.Y/</code> it is intended for the <code>/usr/bin/python</code> interpreter (currently Python 2, but may be removed or changed to Python 3 at any point in the future) if <code>%__python</code> is not set explicitly set to python3 (that currently happens in various packages and is docuemnted in the guidelines) or python2 (nobody does that, because the magic "just works" for this use case - relying on the fact that <code>/usr/bin/python</code> is currently python2 (that assumption is forbidden by the Python packaging guidelines, yet here it is heavily used))
* when a file is not in <code>/usr/lib(64)?/pythonX.Y/</code> it is intended for the <code>/usr/bin/python</code> interpreter
** That is currently Python 2, but may be removed or changed to Python 3 at any point in the future.
** This is only the default behavior, it can be changed by redefining <code>%__python</code> to:
*** python3: that currently happens in various packages and is documented in the guidelines as a way to do it
*** python2: nobody does that, because the magic "just works" for this use case - relying on the fact that <code>/usr/bin/python</code> is currently python2
**** that assumption is forbidden by the Python packaging guidelines, yet here it is heavily used


See [https://fedoraproject.org/w/index.php?title=Packaging:Python_Appendix&oldid=419140#Manual_byte_compilation Packaging:Python Appendix] for more information (this links to specific revision because this change will change it).
See [https://fedoraproject.org/w/index.php?title=Packaging:Python_Appendix&oldid=419140#Manual_byte_compilation Packaging:Python Appendix] for more information (this links to specific revision because this change will change it).

Revision as of 14:24, 1 February 2018

Important.png
Incomplete
This page is incomplete!


No more automagic Python bytecompilation

Summary

Owner

  • Name: Miro Hrončok
  • Email: mhroncok@redhat.com
  • Release notes owner:

Current status

  • Targeted release: Fedora 29
  • Last updated: 2018-02-01
  • Tracker bug: <will be assigned by the Wrangler>

Detailed Description

As for Fedora 28, all *.py files outside of the /usr/lib(64)?/pythonX.Y/ directories are bytecompiled by /usr/bin/python. This is overly magical and assumes several things (not always right):

  • all files named *.py are Python modules that need to be bytecompiled
  • when a file is not in /usr/lib(64)?/pythonX.Y/ it is intended for the /usr/bin/python interpreter
    • That is currently Python 2, but may be removed or changed to Python 3 at any point in the future.
    • This is only the default behavior, it can be changed by redefining %__python to:
      • python3: that currently happens in various packages and is documented in the guidelines as a way to do it
      • python2: nobody does that, because the magic "just works" for this use case - relying on the fact that /usr/bin/python is currently python2
        • that assumption is forbidden by the Python packaging guidelines, yet here it is heavily used

See Packaging:Python Appendix for more information (this links to specific revision because this change will change it).

Benefit to Fedora

Scope

  • Proposal owners:
  • Other developers: N/A (not a System Wide Change)
  • Policies and guidelines: N/A (not a System Wide Change)
  • Trademark approval: N/A (not needed for this Change)

Upgrade/compatibility impact

N/A (not a System Wide Change)

How To Test

N/A (not a System Wide Change)

User Experience

N/A (not a System Wide Change)

Dependencies

N/A (not a System Wide Change)

Contingency Plan

  • Contingency mechanism: (What to do? Who will do it?) N/A (not a System Wide Change)
  • Contingency deadline: N/A (not a System Wide Change)
  • Blocks release? N/A (not a System Wide Change), Yes/No
  • Blocks product? product

Documentation

N/A (not a System Wide Change)

Release Notes