[Grok-dev] the grok package becoming an "import hub"

Martijn Faassen faassen at startifact.com
Sun Feb 20 05:35:47 EST 2011


On 02/14/2011 12:39 PM, Jan-Wijbrand Kolman wrote:
> We've been discussing how the grok package could become an import hub of
> some sort, to make it easy to import components in your application. At
> the same time the grok package should not force dependencies on you, so
> we've been thinking about making the imports conditional somehow.

try .. except ImportError is your friend, right?

> I'd also like to add the following "feature": the grok package should
> somehow "know" what components to import and expose from the various
> grokcore.* packages. This prevents having to release a new grok package
> just because some grokcore.package was released with new components.
>
> Or would this be too magic?

If the underlying packages have an __all__ defined in their __init__ 
that could be done with a 'from import *'. I'm not a big fan of those, 
as it leads to the reader of the code to having to follow the trail to 
yet another package, but I think in this case it's probably worth it.

Regards,

Martijn



More information about the Grok-dev mailing list