Skip to content

3.6 stubs used even though interpreter is 3.5 #3250

Closed

Description

@daviskirk

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?

Activity

  1. JelleZijlstra commented on Apr 26, 2017

    @JelleZijlstra
    Member

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

  2. daviskirk commented on Apr 26, 2017

    @daviskirk
    Author

    mypy --version
    mypy 0.501

  3. ilevkivskyi commented on Apr 26, 2017

    @ilevkivskyi
    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?

  4. gvanrossum commented on Apr 28, 2017

    @gvanrossum
    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.

  5. ambv commented on Apr 28, 2017

    @ambv
    Contributor

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

  6. gvanrossum commented on Apr 28, 2017

    @gvanrossum
    Member

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

  7. daviskirk commented on May 1, 2017

    @daviskirk
    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.

  8. JelleZijlstra commented on May 1, 2017

    @JelleZijlstra
    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.

  9. daviskirk commented on May 1, 2017

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions