librelist archives

« back to archive

Requirement (?) to use flask.ext?

Requirement (?) to use flask.ext?

From:
Joshua J. Kugler
Date:
2014-12-18 @ 19:52
Howdy!

I'm just getting started with Flask, and liking it so far (after reading 
through the amazing Flask Mega-Tutorial[1]).

I have read [2] and [3], so understand the usage and purpose of "from 
flask.ext.foo import bar."  However, this does not-nice things to code 
completion and source assistant/code introspection in my IDE. Since all the 
objects are imported at run time, the IDE (WingIDE in this case) does not know 
what objects are available and cannot introspect them for argument completion, 
etc.

But, if I do, for example:

from flask_login import login_required

I get both a drop down for the objects available to import, as well as code 
completion/object type when I go to use "login_required."

So, seeing that the flask.ext module does straight import-rewriting (and 
doesn't wrap the modules or anything), besides upsetting a "Flask purist" who 
may look at my code in the future, is there anything wrong with using

from flask_foo import bar

instead of using the flask.ext method?

j

[1] http://goo.gl/a71y07
[2] http://flask.pocoo.org/docs/0.10/extensions/#using-extensions
[3] http://flask.pocoo.org/docs/0.10/api/#extensions
-- 
Joshua J. Kugler - Fairbanks, Alaska
Azariah Enterprises - Programming and Website Design
joshua@azariah.com - Jabber: pedahzur@gmail.com
PGP Key: http://pgp.mit.edu/  ID 0x73B13B6A

Re: [flask] Requirement (?) to use flask.ext?

From:
Joshua J. Kugler
Date:
2014-12-31 @ 16:30
Bump?

j

On Thursday, December 18, 2014 10:52:12 Joshua J. Kugler wrote:
> Howdy!
> 
> I'm just getting started with Flask, and liking it so far (after reading
> through the amazing Flask Mega-Tutorial[1]).
> 
> I have read [2] and [3], so understand the usage and purpose of "from
> flask.ext.foo import bar."  However, this does not-nice things to code
> completion and source assistant/code introspection in my IDE. Since all the
> objects are imported at run time, the IDE (WingIDE in this case) does not
> know what objects are available and cannot introspect them for argument
> completion, etc.
> 
> But, if I do, for example:
> 
> from flask_login import login_required
> 
> I get both a drop down for the objects available to import, as well as code
> completion/object type when I go to use "login_required."
> 
> So, seeing that the flask.ext module does straight import-rewriting (and
> doesn't wrap the modules or anything), besides upsetting a "Flask purist"
> who may look at my code in the future, is there anything wrong with using
> 
> from flask_foo import bar
> 
> instead of using the flask.ext method?
> 
> j
> 
> [1] http://goo.gl/a71y07
> [2] http://flask.pocoo.org/docs/0.10/extensions/#using-extensions
> [3] http://flask.pocoo.org/docs/0.10/api/#extensions

-- 
Joshua J. Kugler - Fairbanks, Alaska
Azariah Enterprises - Programming and Website Design
joshua@azariah.com - Jabber: pedahzur@gmail.com
PGP Key: http://pgp.mit.edu/  ID 0x73B13B6A

Re: [flask] Requirement (?) to use flask.ext?

From:
Aleksey Kholovchuk
Date:
2014-12-31 @ 17:36
And what IDE are you using?
On Dec 31, 2014 6:35 PM, "Joshua J. Kugler" <joshua@azariah.com> wrote:

> Bump?
>
> j
>
> On Thursday, December 18, 2014 10:52:12 Joshua J. Kugler wrote:
> > Howdy!
> >
> > I'm just getting started with Flask, and liking it so far (after reading
> > through the amazing Flask Mega-Tutorial[1]).
> >
> > I have read [2] and [3], so understand the usage and purpose of "from
> > flask.ext.foo import bar."  However, this does not-nice things to code
> > completion and source assistant/code introspection in my IDE. Since all
> the
> > objects are imported at run time, the IDE (WingIDE in this case) does not
> > know what objects are available and cannot introspect them for argument
> > completion, etc.
> >
> > But, if I do, for example:
> >
> > from flask_login import login_required
> >
> > I get both a drop down for the objects available to import, as well as
> code
> > completion/object type when I go to use "login_required."
> >
> > So, seeing that the flask.ext module does straight import-rewriting (and
> > doesn't wrap the modules or anything), besides upsetting a "Flask purist"
> > who may look at my code in the future, is there anything wrong with using
> >
> > from flask_foo import bar
> >
> > instead of using the flask.ext method?
> >
> > j
> >
> > [1] http://goo.gl/a71y07
> > [2] http://flask.pocoo.org/docs/0.10/extensions/#using-extensions
> > [3] http://flask.pocoo.org/docs/0.10/api/#extensions
>
> --
> Joshua J. Kugler - Fairbanks, Alaska
> Azariah Enterprises - Programming and Website Design
> joshua@azariah.com - Jabber: pedahzur@gmail.com
> PGP Key: http://pgp.mit.edu/  ID 0x73B13B6A
>

Re: [flask] Requirement (?) to use flask.ext?

From:
Jan Benes
Date:
2014-12-31 @ 17:43
I use PyCharm and keep getting unresolved import "errors".

On 31 December 2014 at 18:36, Aleksey Kholovchuk <vortexxx192@gmail.com>
wrote:

> And what IDE are you using?
> On Dec 31, 2014 6:35 PM, "Joshua J. Kugler" <joshua@azariah.com> wrote:
>
>> Bump?
>>
>> j
>>
>> On Thursday, December 18, 2014 10:52:12 Joshua J. Kugler wrote:
>> > Howdy!
>> >
>> > I'm just getting started with Flask, and liking it so far (after reading
>> > through the amazing Flask Mega-Tutorial[1]).
>> >
>> > I have read [2] and [3], so understand the usage and purpose of "from
>> > flask.ext.foo import bar."  However, this does not-nice things to code
>> > completion and source assistant/code introspection in my IDE. Since all
>> the
>> > objects are imported at run time, the IDE (WingIDE in this case) does
>> not
>> > know what objects are available and cannot introspect them for argument
>> > completion, etc.
>> >
>> > But, if I do, for example:
>> >
>> > from flask_login import login_required
>> >
>> > I get both a drop down for the objects available to import, as well as
>> code
>> > completion/object type when I go to use "login_required."
>> >
>> > So, seeing that the flask.ext module does straight import-rewriting (and
>> > doesn't wrap the modules or anything), besides upsetting a "Flask
>> purist"
>> > who may look at my code in the future, is there anything wrong with
>> using
>> >
>> > from flask_foo import bar
>> >
>> > instead of using the flask.ext method?
>> >
>> > j
>> >
>> > [1] http://goo.gl/a71y07
>> > [2] http://flask.pocoo.org/docs/0.10/extensions/#using-extensions
>> > [3] http://flask.pocoo.org/docs/0.10/api/#extensions
>>
>> --
>> Joshua J. Kugler - Fairbanks, Alaska
>> Azariah Enterprises - Programming and Website Design
>> joshua@azariah.com - Jabber: pedahzur@gmail.com
>> PGP Key: http://pgp.mit.edu/  ID 0x73B13B6A
>>
>

Re: [flask] Requirement (?) to use flask.ext?

From:
Reza ShalbafZadeh
Date:
2014-12-31 @ 22:06
Are You Using Virtualenv?
If you using a virtualenv you should set that as default python in your IDE
Happy Coding
On Dec 31, 2014 9:18 PM, "Jan Benes" <jbenes@gmail.com> wrote:

> I use PyCharm and keep getting unresolved import "errors".
>
> On 31 December 2014 at 18:36, Aleksey Kholovchuk <vortexxx192@gmail.com>
> wrote:
>
>> And what IDE are you using?
>> On Dec 31, 2014 6:35 PM, "Joshua J. Kugler" <joshua@azariah.com> wrote:
>>
>>> Bump?
>>>
>>> j
>>>
>>> On Thursday, December 18, 2014 10:52:12 Joshua J. Kugler wrote:
>>> > Howdy!
>>> >
>>> > I'm just getting started with Flask, and liking it so far (after
>>> reading
>>> > through the amazing Flask Mega-Tutorial[1]).
>>> >
>>> > I have read [2] and [3], so understand the usage and purpose of "from
>>> > flask.ext.foo import bar."  However, this does not-nice things to code
>>> > completion and source assistant/code introspection in my IDE. Since
>>> all the
>>> > objects are imported at run time, the IDE (WingIDE in this case) does
>>> not
>>> > know what objects are available and cannot introspect them for argument
>>> > completion, etc.
>>> >
>>> > But, if I do, for example:
>>> >
>>> > from flask_login import login_required
>>> >
>>> > I get both a drop down for the objects available to import, as well as
>>> code
>>> > completion/object type when I go to use "login_required."
>>> >
>>> > So, seeing that the flask.ext module does straight import-rewriting
>>> (and
>>> > doesn't wrap the modules or anything), besides upsetting a "Flask
>>> purist"
>>> > who may look at my code in the future, is there anything wrong with
>>> using
>>> >
>>> > from flask_foo import bar
>>> >
>>> > instead of using the flask.ext method?
>>> >
>>> > j
>>> >
>>> > [1] http://goo.gl/a71y07
>>> > [2] http://flask.pocoo.org/docs/0.10/extensions/#using-extensions
>>> > [3] http://flask.pocoo.org/docs/0.10/api/#extensions
>>>
>>> --
>>> Joshua J. Kugler - Fairbanks, Alaska
>>> Azariah Enterprises - Programming and Website Design
>>> joshua@azariah.com - Jabber: pedahzur@gmail.com
>>> PGP Key: http://pgp.mit.edu/  ID 0x73B13B6A
>>>
>>
>

Re: [flask] Requirement (?) to use flask.ext?

From:
Joshua J. Kugler
Date:
2015-01-01 @ 21:35
On Wednesday, December 31, 2014 19:36:23 Aleksey Kholovchuk wrote:
> And what IDE are you using?
> > > objects are imported at run time, the IDE (WingIDE in this case) does

I am using a virtual environment, and the IDE is pointed to this virtual 
environment.  However, the flask.ext method is a run-time import system, so it 
cannot resolve the objects since it doesn't know what objects are available. 
Not I said that

from flask_foo import bar

works fine, even pointing at the virtualenv.

j

-- 
Joshua J. Kugler - Fairbanks, Alaska
Azariah Enterprises - Programming and Website Design
joshua@azariah.com - Jabber: pedahzur@gmail.com
PGP Key: http://pgp.mit.edu/  ID 0x73B13B6A

Re: [flask] Requirement (?) to use flask.ext?

From:
Jan Benes
Date:
2014-12-31 @ 17:33
I'd love some guidelines on that too.

Nicely formulated question. Thanks for asking it.

On 31 December 2014 at 17:30, Joshua J. Kugler <joshua@azariah.com> wrote:

> Bump?
>
> j
>
> On Thursday, December 18, 2014 10:52:12 Joshua J. Kugler wrote:
> > Howdy!
> >
> > I'm just getting started with Flask, and liking it so far (after reading
> > through the amazing Flask Mega-Tutorial[1]).
> >
> > I have read [2] and [3], so understand the usage and purpose of "from
> > flask.ext.foo import bar."  However, this does not-nice things to code
> > completion and source assistant/code introspection in my IDE. Since all
> the
> > objects are imported at run time, the IDE (WingIDE in this case) does not
> > know what objects are available and cannot introspect them for argument
> > completion, etc.
> >
> > But, if I do, for example:
> >
> > from flask_login import login_required
> >
> > I get both a drop down for the objects available to import, as well as
> code
> > completion/object type when I go to use "login_required."
> >
> > So, seeing that the flask.ext module does straight import-rewriting (and
> > doesn't wrap the modules or anything), besides upsetting a "Flask purist"
> > who may look at my code in the future, is there anything wrong with using
> >
> > from flask_foo import bar
> >
> > instead of using the flask.ext method?
> >
> > j
> >
> > [1] http://goo.gl/a71y07
> > [2] http://flask.pocoo.org/docs/0.10/extensions/#using-extensions
> > [3] http://flask.pocoo.org/docs/0.10/api/#extensions
>
> --
> Joshua J. Kugler - Fairbanks, Alaska
> Azariah Enterprises - Programming and Website Design
> joshua@azariah.com - Jabber: pedahzur@gmail.com
> PGP Key: http://pgp.mit.edu/  ID 0x73B13B6A
>