Bob Ippolito (@etrepum) on Haskell, Python, Erlang, JavaScript, etc.

pth files are your friend


Why is it that many Python packages insist on littering your site-packages folder? It's not very hard to make a that has its own little microcosm referenced by a pth file, and it makes the user's life so much better. See Numeric, PIL, or PyObjC for decent examples.

Bonus: the user can easily uninstall, cleanly upgrade, or even move the package to an alternate location simply by moving it and changing the path in the pth.

Update: It looks like this is done with the extra_path argument to setup(...). I would've mentioned it, but I didn't realize that it wasn't documented outside of the source, mailing lists, and files in an old CVS attic!

blog comments powered by Disqus