At 11:27 PM 3/26/2009 +0000, Paul Moore wrote:
What I'd really like is essentially some form of "virtual filesystem" access to stuff addressed relative to a Python package name,
Note that relative to a *Python package name* isn't quite as useful, due to namespace packages. To be unambiguous as to the targeted resource, one needs to be able to reference a specific project, and that requires you to go off the name of a module *within* a package. For example, 'zope.somemodule' rather than just 'zope'. To put it another way, you don't want to use a module that comes from an __init__.py as your origin point, but rather, some other .py file within the package. Then you can talk to that module's loader without fear of ambiguity.
rather than to a filesystem path. How much filesystem functionality is required is somewhat up for debate, but the basic listdir, get (text/binary) contents, open (text/binary) stream would be a good start (as Guido pointed out).
"isdir" and "exists" would also be nice; pkg_resources provides those, plus listdir and string/stream.