Skip to content

Resolving indirect and direct (ciruclar) dependencies between extensions #5145

Answered by ThiefMaster
eganma-umich asked this question in Q&A
Discussion options

You must be logged in to vote

TBH, my first impression there is "over-engineered"... ;)

My approach would be to keep core stuff in your core app, and then create plugins for your application (e.g. using setup.cfg entry points, and there's also flask-pluginengine (disclaimer: I'm the author)). Those plugins then import stuff directly from the core app, e.g. from yourapp.flaskstuff import db to get the SQLAlchemy object; same for the rest.

When a plugin depends on another one it declares that dependency so the other one gets loaded first; and so far I never had to deal w/ circular dependencies but I'd simply do the imports locally within a function if it otherwise creates problems - but again, try to avoid having circul…

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@eganma-umich
Comment options

@ThiefMaster
Comment options

@eganma-umich
Comment options

Answer selected by eganma-umich
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants