Skip to content

Failing type check with mypy #488

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
decaz opened this issue Jul 25, 2022 · 5 comments
Closed

Failing type check with mypy #488

decaz opened this issue Jul 25, 2022 · 5 comments

Comments

@decaz
Copy link
Contributor

decaz commented Jul 25, 2022

Environment:

flask-jwt-extended==4.4.2
mypy==0.971

Example listing of check.py:

from flask_jwt_extended import current_user

current_user.id

Type checking error:

$ mypy check.py 
check.py:3: error: "LocalProxy[Any]" has no attribute "id"
Found 1 error in 1 file (checked 1 source file)

There is usually a lot of accessing attributes of the current_user variable so I've started to see a huge number of these errors in my codebase. Version 4.4.1 leads to the same errors but there is no such errors with version 4.4.0 so I guess it relates to #480. Also when I removed py.typed file from my local installation then errors disappeared.

@vimalloc
Copy link
Owner

As I understand it, without the py.typed it wont actually use the types from this extension, so that's probably why the you see the errors in 4.4.1 onwards.

It sounds like I have a bug in the types for current_user. Any chance you could throw together a quick example that demonstrates this error? Also, what version of python are you using? I noticed over the weekend that 3.10 is having mypy failures, so I wonder if that's related? Something I'm hoping to dig into over the next few days.

Cheers!

@decaz
Copy link
Contributor Author

decaz commented Jul 25, 2022

Any chance you could throw together a quick example that demonstrates this error?

How can my example be even simpler? :)

Also, what version of python are you using?

Python 3.10.5

@vimalloc
Copy link
Owner

How can my example be even simpler? :)

Oops! It was so simple that I glossed right over it, sorry! 🙃

Python 3.10.5

Sounds like it could be related. I'll keep you updated.

@vimalloc
Copy link
Owner

Fixed in 4.4.3. Cheers

@decaz
Copy link
Contributor Author

decaz commented Jul 28, 2022

Great, thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants