Understanding .pth files

Josh English Joshua.R.English at gmail.com
Sat Aug 27 12:42:44 EDT 2011


I am developing a library for Python 2.7. I'm on Windows XP. I am also learning the "proper" way to do this (per PyPi) but not in a linear fashion: I've built  a prototype for the library, created my setup script, and run the install to make sure I had that bit working properly.

Now I'm continuing to develop the library alongside my examples and applications that use this library.

The source is at c:\Dev\XmlDB.
The installed package in in c:\Python27\lib\site-packages\xmldb\

According to the docs, I should be able to put a file in the site-packages directory called xmldb.pth pointing anywhere else on my drive to include the package. I'd like to use this to direct Python to include the version in the dev folder and not the site-packages folder.

(Otherwise I have my dev folder, but end up doing actual library development in the site-packages folder)

So my C:\Python27\lib\site-packages\xmldb.pth file has one line:

c:\dev\XmlDB\xmldb

(I've tried the slashes the other way, too, but it doesn't seem to work).

Is the only solution to delete the installed library and add the dev folder to my site.py file?

Josh



More information about the Python-list mailing list