Skip to content

New option --python-version. - #883

Merged
JukkaL merged 1 commit into
python:masterfrom
matthiaskramm:master
Oct 12, 2015
Merged

JukkaL merged 1 commit into
python:masterfrom
matthiaskramm:master

Conversation

@matthiaskramm

Copy link
Copy Markdown
Contributor

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

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

o11c commented Sep 29, 2015

Copy link
Copy Markdown
Contributor

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
Copy Markdown
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

o11c commented Oct 10, 2015

Copy link
Copy Markdown
Contributor

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

JukkaL commented Oct 12, 2015

Copy link
Copy Markdown
Collaborator

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

o11c commented Oct 12, 2015

Copy link
Copy Markdown
Contributor

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