[Python-ideas] python_modules as default directory for dependencies in distutils

Philipp Hagemeister phihag at phihag.de
Tue Nov 20 19:21:00 CET 2012

Currently, there are the following methods for installing dependencies:

· Use the distribution's packaging (ignored here, all further points
refer to setup.py/distutils)
· Install them system-wide (default). This requires superuser rights and
is basically guaranteed to conflict with some other application,
especially if applications are choosy about the versions of Python
packages they like.
· Install them user-wide (--user), with pretty much the same downsides,
plus that the application is now bound to the user installing it.
· Manually invoke distutils with another path (error-prone and
· Give up and use virtualenv. While this works fine, it's a little bit
heavy-handed to modify one's shell just to launch a potentially trivial

Therefore, I'd like to suggest a new alternative location (--here =
--root "./python_modules", intended to become default in Python 5),
modeled after node's packaging system (http://goo.gl/dMRTC).

The obvious advantage of installing all dependencies into a directory in
the application root is that the application will work for every user,
never conflict with any other application, and it is both easy to
package dependencies (say, for an sftp-only rollout) and to delete all
dependencies. Of course, this is not sufficient to replace virtualenv,
but I believe a large majority of applications will (or at least should)
run under any common python interpreter.

Aside from the new flag in distutils, the site module should
automatically look into ./python_modules , as if it were a second USER_SITE.

In node, this scheme works so well that virtually nobody bothers to use
system-wide installation, except when they want a binary to be available
in the PATH for all users.

This suggestion seems so obvious that it probably has been discussed
before, but my google-fu is too weak to find it. If it has, I'd be glad
to get a link to the old discussion. Thanks!

- Philipp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: OpenPGP digital signature
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20121120/63725c69/attachment.pgp>

More information about the Python-ideas mailing list