Skip to content

New option --python-version. #883

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

Merged
merged 1 commit into from
Oct 12, 2015
Merged

New option --python-version. #883

merged 1 commit into from
Oct 12, 2015

Conversation

matthiaskramm
Copy link
Contributor

Store Python version as (major, minor) internally.
This is needed for #882 (and also #874).

Store Python version as (major, minor) internally.
@o11c
Copy link
Contributor

o11c commented Sep 29, 2015

I suggest you use mypy.syntax.dialect.Dialect from #880 instead. Of course, @JukkaL is inactive so making PRs is kind of pointless.

Instead of only a linear version, it computes the set of actual features, and can create variations. So, you would create one base version (e.g. Dialect(sys.version[:3])), and then from that create a version to allow stub-specific syntax in .pyi files but not .py files (currently just stub_dialect = dialect.add_future('mypy-codec') to allow annotations). Finally, as each file is parsed, it grows its own sub-dialect depending on the __future__ statements in effect.

@matthiaskramm
Copy link
Contributor Author

Yes, your work in #880 looks highly relevant.
I primarily use pyversion to figure out which file to pull in, though. See the work in progress at matthiaskramm@bdaeea0 .
But of course applying the version to parsing is a secondary concern.

@matthiaskramm matthiaskramm mentioned this pull request Sep 30, 2015
@o11c
Copy link
Contributor

o11c commented Oct 10, 2015

Note, #887 is cherry-picked from syntax, and also updated version to keep the patchlevel, and also support getting sys.path etc from an inferior.

@JukkaL
Copy link
Collaborator

JukkaL commented Oct 12, 2015

This looks reasonable for now, and unblocks work on typeshed integration. #880 is probably some way off from being merged, it doesn't make sense to wait for that.

@JukkaL JukkaL merged commit b3bc75c into python:master Oct 12, 2015
@o11c
Copy link
Contributor

o11c commented Oct 12, 2015

Note that I really am serious about #887 being ready even though #880 is not. It will almost certainly be needed for #732.

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

Successfully merging this pull request may close these issues.

3 participants