[wingide-users] Working with frameworks that dynamically import

Joshua J. Kugler joshua at eeinternet.com
Thu Dec 18 14:32:09 EST 2014


On Thursday, December 18, 2014 11:06:25 Wingware Support via wingide-users 
wrote:
> However, from
> http://flask.pocoo.org/docs/0.10/extensiondev/#ext-import-transition it
> sounds like the flask.ext form of import is a transitional hack to allow
> extensions to move away from the old namespace approach without
> affecting users (because those users may end up with a mix of old or new
> packaging for extensions on different installations).
> 
> This seems to imply that "from flask_foo import bar" is a valid way to
> import an extension that's completed the transition to the new model.

Possibly, but there is this paragraph:

"""
Flask extensions should urge users to import from flask.ext.foo instead of 
flask_foo or flaskext_foo so that extensions can transition to the new package 
name without affecting users.
"""

That would imply to me that "from flask.ext.foo import ..." is going to be the 
recommended way going forward. Maybe I'll ping the irc channel or mailing list 
and see what they say.
 
> For that reason I'd probably just use that and not go through all the
> trouble of working around the import hackery.
I may just bite the bullet and do that to make the source assistant work.

> The only case where you would run into trouble doing that would be if
> you distribute your code and some users end up having versions of the
> extensions that are still packaged in the old way.  But this seems
> unlikely since presumably you don't want people using your code with
> extensions older than the ones you developed with.

In my case, it's my own web app, and very unlikely to be run by anyone other 
than me, so I'll probably be OK. :)

Thanks for the tips!

j

-- 
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