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

Nick Coghlan ncoghlan at gmail.com
Wed Nov 21 04:27:01 CET 2012

On Wed, Nov 21, 2012 at 4:21 AM, Philipp Hagemeister <phihag at phihag.de>wrote:

> 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
> non-standard).
> · 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
> application.

Or install them all in a single directory, add a __main__.py file to that
directory and then just pass that directory name on the command line
instead of a script name. The directory will be added as sys.path[0] and
the __main__.py file will be executed as the main module (If your
additional application dependencies are all pure Python files, you can even
zip up that directory and pass that on the command line instead). This
approach has been supported since at least Python 2.6, but was missing from
the original What's New, and nobody ever goes back to read the "using"
documentation on the website because they assume they already know how
invoking the interpreter works.


Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20121121/04a61788/attachment.html>

More information about the Python-ideas mailing list