Skip to content

3.6 stubs used even though interpreter is 3.5 #3250

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
daviskirk opened this issue Apr 26, 2017 · 9 comments
Closed

3.6 stubs used even though interpreter is 3.5 #3250

daviskirk opened this issue Apr 26, 2017 · 9 comments

Comments

@daviskirk
Copy link

The 3rd party click package defines its stubs as lib/mypy/typeshed/third_party/3.6/click/core.pyi . However, when using python 3.5 it still tries to read the stubs resulting in a error: Parse error before : because of the 3.6 syntax used.

Is there a way to exclude the inclusion of 3.6 stubs?

@JelleZijlstra
Copy link
Member

I can't reproduce this with mypy master. What mypy version are you using?

@daviskirk
Copy link
Author

mypy --version
mypy 0.501

@ilevkivskyi
Copy link
Member

Just tried this on master with Python 3.4 and I cannot reproduce. This code

from click import core

core.BaseCommand('test')

passes mypy without errors.

@daviskirk Could you please try to reproduce your error on current GitHub master?

@gvanrossum
Copy link
Member

My suspicion is that the OP somehow manually added lib/mypy/typeshed/third_party/3.6 to their MYPYPATH. That's not supported and I'm just going to close this.

Also, IIRC @ambv owns the click stubs.

@ambv
Copy link
Contributor

ambv commented Apr 28, 2017

Cannot reproduce either. The point of putting Click in 3.6 was that those were our first stubs that used variable annotations and at that point Mypy only enabled parsing this syntax if the corresponding Python version matched. It's since fixed so I think we could move Click stubs to 3/.

@gvanrossum
Copy link
Member

If you want that to happen either submit a PR or an issue to typeshed.

@daviskirk
Copy link
Author

In case anyone ends up here with the same problem.
MYPYPATH wasn't set manually. But I did figure out that the problem was that I had fast_parser option set to False. As this is deprecated as far as I know, I don't think this should be a problem for anyone else. Setting it back to True fixes the problem.
I can't figure out exactly why this would be an issue or how it relates to the paths or versions being mismatched.

@JelleZijlstra
Copy link
Member

That explains the syntax error; the old parser wasn't updated to support PEP 526 syntax. Do you specify in your configuration to use --python-version 3.5? Otherwise mypy will by default run in Python 3.6 mode (#2915), regardless of the Python version used to run mypy itself.

@daviskirk
Copy link
Author

No I don't ... ok so that should explain everything, thanks for the explanation!

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

5 participants