python3.2+ compiled files

Jakub Bogusz qboosh at
Sat Apr 2 20:11:18 CEST 2011

It seems that since python 3.2 upstream changed the default way
of creating compiled files: instead of *.pyc/*.pyo in the same
directory that .py file exists, the compiled files are created
in __pycache__ subdirectory.
According to some googled information, the "old method" (files created
in the same directory by compileall) still works in the same way.
In case of the "new method", compiled files are searched in __pycache__
subdirectory only if source file exists.

I'm not sure if the new method affects only (c)python 3.2 installation,
or all modules installed using distutils or so.

So we have to decide how to package python distribution (and possibly
all python3 modules, if distutils use __pycache__ too) - there are
two solutions:

- package all modules in source form together with __pycache__

- stick to "old way" - manually py_comp/py_ocomp all python files,
  package *.py[co] without using __pycache__ subdirectories

Jakub Bogusz

More information about the pld-devel-en mailing list