[Python-Dev] .pth files are evil

Scott David Daniels Scott.Daniels at Acm.Org
Fri May 1 12:48:54 EDT 2009


Chris Withers wrote:
> M.-A. Lemburg wrote:
>> """
>> If the package really requires adding one or more directories on 
>> sys.path (e.g. because it has not yet been structured to support
>> dotted-name import), a "path configuration file" named package.pth
>> can be placed in either the site-python or site-packages directory....
> I'll say! I think .pth files are absolute evil and I wish they could 
> just be banned.
> +1 on anything that makes them closer to going away or reduces the 
> possibility of yet another similar feature from hurting the 
> comprehensibility of a python setup.

".pth" files are great when used in moderation. Especially when used
with the new per-user location searched when setting up sys.path.
I can move my current project's directory name into a .pth file that
I change as I switch projects.  I can also throw in a reference to
my convenience tools (dinky little functions and classes that I would
otherwise waste time scratching together each time I needed them).
They obviate the need to fiddle with site.py.

--Scott David Daniels
Scott.Daniels at Acm.Org




More information about the Python-list mailing list