PEP 3147 - new .pyc format

MRAB python at mrabarnett.plus.com
Sat Jan 30 17:57:57 EST 2010


John Roth wrote:
> PEP 3147 has just been posted, proposing that, beginning in release
> 3.2 (and possibly 2.7) compiled .pyc and .pyo files be placed in a
> directory with a .pyr extension. The reason is so that compiled
> versions of a program can coexist, which isn't possible now.
> 
> Frankly, I think this is a really good idea, although I've got a few
> comments.
> 
> 1. Apple's MAC OS X should be mentioned, since 10.5 (and presumably
> 10.6) ship with both Python release 2.3 and 2.5 installed.
> 
> 2. I think the proposed logic is too complex. If this is installed in
> 3.2, then that release should simply store its .pyc file in the .pyr
> directory, without the need for either a command line switch or an
> environment variable (both are mentioned in the PEP.)
> 
> 3. Tool support. There are tools that look for the .pyc files; these
> need to be upgraded somehow. The ones that ship with Python should, of
> course, be fixed with the PEP, but there are others.
> 
> 4. I'm in favor of putting the source in the .pyr directory as well,
> but that's got a couple more issues. One is tool support, which is
> likely to be worse for source, and the other is some kind of algorithm
> for identifying which source goes with which object.
> 
> Summary: I like it, but I think it needs a bit more work.
> 
The PEP has a .pyr directory for each .py file:

     foo.py
     foo.pyr/
         f2b30a0d.pyc # Python 2.5
         f2d10a0d.pyc # Python 2.6
         f2d10a0d.pyo # Python 2.6 -O
         f2d20a0d.pyc # Python 2.6 -U
         0c4f0a0d.pyc # Python 3.1

Other possibilities are:

1. A single pyr directory:

     foo.py
     pyr/
         foo.f2b30a0d.pyc # Python 2.5
         foo.f2d10a0d.pyc # Python 2.6
         foo.f2d10a0d.pyo # Python 2.6 -O
         foo.f2d20a0d.pyc # Python 2.6 -U
         foo.0c4f0a0d.pyc # Python 3.1

2. A .pyr directory for each version of Python:

     foo.py
     f2b30a0d.pyr/ # Python 2.5
         foo.pyc
     f2d10a0d.pyr/ # Python 2.6/Python 2.6 -O
         foo.pyc
         foo.pyo
     f2d20a0d.pyr/ # Python 2.6 -U
         foo.pyc
     0c4f0a0d.pyr/ # Python 3.1
         foo.pyc



More information about the Python-list mailing list