[Distutils] pkg_resources: import string

Phillip J. Eby pje at telecommunity.com
Tue Aug 2 02:16:54 CEST 2005

At 05:09 PM 8/1/2005 -0500, Ian Bicking wrote:
>I was thinking some more about WSGI configuration, and much
>configuration involves some "import a string" routing, that looks like
>importstring("os.path:sep") or somesuch.  But we implement it slightly
>differently.  And maybe there could be a PEP and whatnot, but I don't
>even know what module that would go into, and it would just have to be
>backported for a long time anyway... but then it seemed like it would
>fit nicely into pkg_resources, and just about anywhere I want to import
>strings I expect pkg_resources to be around as well.

     from pkg_resources import EntryPoint

     def import_string(s):
         return EntryPoint.parse("x="+s).load(False)

More information about the Distutils-SIG mailing list