python / python/mypy

Clarify + validate python_version

Open
#19,729 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

documentation feature topic-configuration
Dominant language
Python
Stars
20.6k
Forks
3.3k
PR merge metrics
PR metrics pending

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the documentation for python_version and the command-line handling of --python-version, then reproduce the lack of an error with --python-version 3.100. Done means the documentation states the upper bound and an out-of-range version is rejected.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
devtools
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.