[Distutils] Adding entry points into Distutils ?

Ian Bicking ianb at colorstudy.com
Wed May 6 21:51:25 CEST 2009

On Wed, May 6, 2009 at 1:32 PM, Tres Seaver <tseaver at palladion.com> wrote:

>  > I'd be tempted to call this an edge-case. You should be able to expose
> > the internal detail you'd need via a module scope alias for the
> > particular case. That seems easier than providing a whole new notion.
> I'm actually a big fan of the ':', because it makes explicit the
> difference between the "import" and the "named thing", even for
> module-scoped names.

Yeah, I also like it primarily for clarity.  Also you can provide better
error messages when it fails, matching up the error against the intention.

In some contexts I also extend this syntax to do something like:

  module, path = name.split(':', 1)
  obj = eval(path, load_module(module).__dict__)

I don't propose that we do eval for plugins, but it's a nice side-effect of
the syntax that it's possible to add in other contexts.  Also I don't think
there's any strong precedence for purely dot notation, loading objects from
strings is something that's always done ad hoc, and the only widely used
library I know of that people use for this is Setuptools (indirectly through
entry points).

Ian Bicking  |  http://blog.ianbicking.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/distutils-sig/attachments/20090506/02942c7d/attachment-0001.htm>

More information about the Distutils-SIG mailing list