[Distutils] [Python-Dev] PEP 365 (Adding the pkg_resources module)

Guido van Rossum guido at python.org
Wed Mar 19 18:25:22 CET 2008

On Mon, Mar 17, 2008 at 2:19 PM, zooko <zooko at zooko.com> wrote:
>  4.  The standard Python library includes a tool to find and read
>  resources (other than Python modules) that came bundled in a Python
>  package.
>  Consider, for example, this snippets of code in Nevow:
>  http://divmod.org/trac/browser/trunk/Nevow/setup.py?rev=13786#L10
>  http://divmod.org/trac/browser/trunk/Nevow/setup.py?rev=13786
>  http://divmod.org/trac/browser/trunk/Nevow/setup_egg.py?rev=2406
>  When Nevow uses pkg_resources to import its files such as
>  "default.css", then it is able to find at runtime, even if is being
>  imported from a py2exe or py2app zip, or on other platforms where its
>  homegrown setup script and homegrown "find my file" function fail.
>  So using pkg_resources (and setuptools to install it) makes
>  "test_nevow" pass on all of the allmydata.org buildslaves:
>  http://allmydata.org/buildbot/waterfall?show_events=false

I think we're pretty close to this already. PEP 302 defines a
getdata() method. Hopefully most PEP 302 implementations support it.
The only thing missing IMO is a little function that does what
getdata() does when there is no __loader__ object (i.e. when the
default "import-from-filesystem" import method is used).

--Guido van Rossum (home page: http://www.python.org/~guido/)

More information about the Distutils-SIG mailing list