On Tue, Dec 15, 2009 at 1:41 PM, Ian Bicking <[email protected]> wrote: > On Tue, Dec 15, 2009 at 3:11 PM, Tom Davis <[email protected]> wrote: >> documenting libcloud with sphinx isn't so automatic when interfaces are >>> being used >> >> >> A trivial fix; a Sphinx extension for documenting interfaces already exists. >> See: this >> ticket<http://bitbucket.org/birkenfeld/sphinx/issue/85/minimal-support-for-zopeinterface>(specifically >> the finished extension: >> autointerface_.py <http://bitbucket.org/m//attch/2009/02/autointerface_.py>) >> >> I can't argue that now isn't a good time, but I still feel they are (and can >> be made more) useful. For one, they can assist in getting rid of the * >> providers.py* file entirely. A simple metaclass which functions as a mount >> coupled with interface verification (we don't want to provide a driver that >> doesn't yet implement the API) fixes the need for manually listing / >> commenting drivers, not to mention the ugly static paths / names that are >> going on there. > > This seems like it can be resolved anyway, and interfaces don't seem > like a particularly easy easy way to solve the problem. > > First, you could just import the drivers directly instead of the > get_driver indirection. The only thing get_driver gives you is the > ability to lazy-load something based on fixed symbols. > > Second, you could have a simple reflection API, like: > > def drivers(): > """Returns a list of drivers (by name)""" > return [ > os.path.splitext(name)[0] > for name in os.listdir(os.path.join(os.path.dirname(__file__), > 'drivers'))) > if name.endswith('.py') and name != '__init__.py']
Would this interface work on google app engine or similiar enviroments? I ddin't think things like os.listdir etc would be expected to work? Thanks, Paul
