python / python/mypy

python_version should default to the interpreter for python_executable

Open
#15,341 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Feature

If python_version is omitted and python_executable is set, the Python version is determined by running python_executable.

Currently python_version defaults to the version of Python that is running mypy.

Pitch

This reduces the amount of duplicate configuration needed in some cases.

For example, if mypy is installed with pipx then to run it against a venv you would need

python_executable = ".venv/bin/python3.10"
python_version = "3.10"

We particularly have a desire to avoid duplicating the Python version into lots of places. The target state would be

python_executable = ".venv/bin/python3"

This means that changing the version of Python in use in a project just involves smashing and recreating the venv, instead of configuration changes in 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 by tracing mypy's configuration handling for python_version and python_executable, then identify where the current interpreter version is selected. Verify the behavior with configurations that omit python_version and set python_executable, including the .venv/bin/python3 example; done means the executable's interpreter version is used.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.