You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
3.6 stubs used even though interpreter is 3.5 #3250
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?
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.
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/.
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.
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.
Activity
JelleZijlstra commentedon Apr 26, 2017
I can't reproduce this with mypy master. What mypy version are you using?
daviskirk commentedon Apr 26, 2017
mypy --version
mypy 0.501
ilevkivskyi commentedon Apr 26, 2017
Just tried this on master with Python 3.4 and I cannot reproduce. This code
passes mypy without errors.
@daviskirk Could you please try to reproduce your error on current GitHub master?
gvanrossum commentedon Apr 28, 2017
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 commentedon 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 commentedon Apr 28, 2017
If you want that to happen either submit a PR or an issue to typeshed.
daviskirk commentedon May 1, 2017
In case anyone ends up here with the same problem.
MYPYPATHwasn't set manually. But I did figure out that the problem was that I hadfast_parseroption set toFalse. As this is deprecated as far as I know, I don't think this should be a problem for anyone else. Setting it back toTruefixes 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 commentedon May 1, 2017
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 commentedon May 1, 2017
No I don't ... ok so that should explain everything, thanks for the explanation!