[Python-ideas] Changing the name of __pycache__

M.-A. Lemburg mal at egenix.com
Wed Feb 9 10:07:08 CET 2011


Raymond Hettinger wrote:
> It would be great if there was some way to change the name to .pycache so that it doesn't pollute directory listings.
> 
> The dot-naming convention seems to be widely used (.bashrc, .emacs, .hgignore, etc.).  Ideally, we should follow that convention also or at least provide a way to make the change locally (perhaps an environment variable).

While I don't the like name either, I think it's important that this
particular aspect is not configurable: there are tools relying on
finding the .pyc files based on the location of the .py files
and those don't necessarily run in the same environment as the
application, e.g. think of all the freeze tools, or situations
where the application itself runs as daemon under a different
user account than the one used to administer the application.

Another use case is shipping precompiled packages. If the user
changes the pyc cache dir name, the precompiled versions won't
get used.

BTW: I wonder how PEP 3147 will support source-less distributions.

With previous versions of Python, this was easy: you just remove the
.py files. With Python 3.2, removing the .py files and leaving
just the files in the pyc cache will cause ImportErrors (see
http://www.python.org/dev/peps/pep-3147/#id59).

It seems that the only way to "build" a working source-less
package is by running a special tool that moves the pyc
files to where the source files lived.

In addition, this mechanism does not appear to work with the new
<magic> names, so distribution of packages with pycs for multiple
Python versions is not possible.

I'm not sure why this was done. It looks like an unnecessary
limitation of the PEP.

-- 
Marc-Andre Lemburg
eGenix.com

Professional Python Services directly from the Source  (#1, Feb 09 2011)
>>> Python/Zope Consulting and Support ...        http://www.egenix.com/
>>> mxODBC.Zope.Database.Adapter ...             http://zope.egenix.com/
>>> mxODBC, mxDateTime, mxTextTools ...        http://python.egenix.com/
________________________________________________________________________

::: Try our new mxODBC.Connect Python Database Interface for free ! ::::


   eGenix.com Software, Skills and Services GmbH  Pastor-Loeh-Str.48
    D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg
           Registered at Amtsgericht Duesseldorf: HRB 46611
               http://www.egenix.com/company/contact/



More information about the Python-ideas mailing list