[wingide-users] Working with frameworks that dynamically import

Joshua J. Kugler joshua at eeinternet.com
Tue Dec 16 18:04:58 EST 2014

This may be a more general Python problem, but using Flask is the first time 
I've run into it. And yes, I read the new "Using Wing IDE with Flask" section 
in the docs. It didn't address this. :)

Flask uses a convention for extensions, such that you would do this:

from flask.ext.login import login_user

What that really ends up doing (via the flask.ext module) is this:

from flask_login import login_user

So this means a few things:

1) Objects imported this way have *NO* type information when coding
2) Since this is at run time, even when the Flask app is active, this type 
information is not available, even after 'from flask.ext.login import ...' has 
run in the file being edited.
3) There is *no* completion information when typing something such as:

from flask.ext.login import ...

Yes, I could "fall back" and do

from flask_login import login_user

instead (and in other cases too) but this breaks convention, and may be 
slightly jarring to others who have coded other flask apps where convention is 

I know there are ways to give Wing hints about types (asserts, etc) but I 
don't want to do that for every object I use in every file I create.

Is there a way to convince Wing to discover these dynamic imports?


Joshua Kugler
Part-Time System Admin/Programmer
http://www.eeinternet.com - Fairbanks, AK
PGP Key: http://pgp.mit.edu/  ID 0x73B13B6A

More information about the wingide-users mailing list