Skip to content

Clarify + validate python_version #19729

@brandonchinn178

Description

@brandonchinn178

The Python docs for python_version say:

Specifies the Python version used to parse and check the target program. The string should be in the format MAJOR.MINOR – for example 3.9. The default is the version of the Python interpreter used to run mypy.

My understanding was that you could even target a newer version of Python than the one that installed mypy, and that mypy implemented its own Python parser or something. But it seems like python_version only supports specifying older Python versions; i.e. only enables restricting syntax, not enabling syntax.

But what was even more confusing was that specifying --python-version 3.100 didn't show any errors.

I think the following changes would be good:

  1. Clarify the documentation to say that python_version is upper bounded to the version of Python running mypy
  2. Error if python_version is greater than the version of Python running mypy

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions