hurry.resource is a module that provides a simple API to specify resource libraries, inclusion and inclusion requirements.
A resource library
We define a library foo. It takes two arguments, the name of the library as it should be published under in a URL and uniquely identify it, and a path to the root of the resources (rootpath) that this library publishes:
>>> from hurry.resource import Library
>>> foo = Library('foo', 'dummy')
The full path to the directory with the resources is reconstructed from the package that the Library is defined in:
>>> foo.path #doctest: +ELLIPSIS
Libraries can be exposed for registration by whatever web framework that hurry.resource is integrated with. This web framework can then expose the library path on a URL somewhere. This is done using the hurry.resource.libraries entry point. To register Library instances foo and bar in your package as entry points include a section like this in your setup.py:
'foo = mypackage.foomodule:foo',
'bar = mypackage.barmodule:bar',
There is an API to help you obtain all registered libraries:
>>> from hurry.resource import libraries
Nothing is registered however:
It would be nice to now have some tests that see whether entry points actually get picked up so, but that would require an involved test setup that we find difficult to construct.
· hurry.resource has been superseded by the Fanstatic project!
What's New in This Release: [ read full changelog ]
· The WSGI Middleware depends on WebOb, which is an optional dependency. Don't expose it into the __init__.py therefore, as that needs to be independent of WebOb. To use the middleware import it directly from hurry.resource.wsgi.
· The Library factory now has to be called with a rootpath argument as the second argument. This is a path to the actual resource directory that the library represents, relative to the directory of the package. This is needed to make `` hurry.resource`` useful for frameworks not based on zope.configuration.
· This breaks backwards compatibility with previous versions of hurry.resource; all code that uses Library should be adjusted. Please also update their setup.py to depend on hurry.resource >= 0.10.
· Packages should register their Library instances with hurry.resource using the hurry.resource.libraries entry point.