Ian Bicking: the old part of his blog

Re: site-packages Considered Harmful

I have multiple versions of the same Python packages on my machine and I want installations of these things to remain separate in most cases, but I also want it to be easy to use one of them when I need to, and when I need to install them, I want them to be easy to install. To get there now, I create a virtual python for each "context" and just use "setup.py install" that puts the package in the virtual python's site packages dir. I have maybe five or six of these littering one project directory right now (slightly different versions of the same codebase combining different versions of different packages), mostly because it's the simplest thing that works. I can also just delete the virtual python directory and the things that happened to get installed to them just go away, which is nice, because it means I don't need to clean up the "master" site-packages.

One simple thing that could be done that might prevent vpython from being the simplest thing that can work is to have another distutils setup script flag that would just install packages to a particular place. The --home arg to distutils setup scripts is typically a bit confusing because it doesn't work on Windows, and it also appends "lib/python" to the path I give it (IIRC, in older versions, I think it used to do "lib/pythonX.X", which was even worse; I think I stopped using it then). Presumably it appends lib/python to the path because the package might need to install something in a "bin" directory, but that's quite rare in practice.

If there was some flag to a distutils setup script that just said "install all the packages/modules in this distribution exactly where I tell you to on the filesystem and don't guess anything else and don't worry about scripts and non-package data files", that would be helpful in some circumstances.

Comment on site-packages Considered Harmful
by Chris McDonough


"If there was some flag to a distutils setup script that just said ..."

+1. My method is basically the same.

# Chad Whitacre