Skip to content
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

Support multiple Python versions in config's python_version #10747

Closed
jamesbraza opened this issue Jun 30, 2021 · 2 comments
Closed

Support multiple Python versions in config's python_version #10747

jamesbraza opened this issue Jun 30, 2021 · 2 comments
Labels
feature topic-configuration Configuration files and flags

Comments

@jamesbraza
Copy link
Contributor

Feature

The repo I work within support Python 3.7 - 3.9 right now. I use mypy to check the repo's typing.

Currently, in my pyproject.toml config, I have python_version = 3.7.

I would like to allow something like Tox's envlist, which allows one to call out multiple Python versions to check.

I don't care about checking bugfix versions of Python, only minor versions (e.g. 3.7, 3.8, 3.9).

Workaround

A workaround is to invoke mypy multiple times, passing the Python version as a command line arg on each invocation:

mypy --python-version 3.7 -p foo
mypy --python-version 3.8 -p foo
mypy --python-version 3.9 -p foo

Pitch

This would be a convenience feature for developers using mypy in repos that support multiple versions of Python.

I imagine the config looking something like this:

# For backwards compatibility
python_version = 3.7

# Proposing adding this as an alternate option
python_version = [3.7, 3.8, 3.9]

I am not familiar with mypy's internals, I imagine this could be a difficult feature to add. Just thought I would throw in my two cents.

@emmeowzing
Copy link

This would be very useful in CI pipelines while spinning up matrices of tests against multiple Python versions. aka, having the benefit of using one config file vs. specifying the version to check against in every job.

@hauntsaninja
Copy link
Collaborator

Closing as a duplicate of #12286 , since that has more discussion

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature topic-configuration Configuration files and flags
Projects
None yet
Development

No branches or pull requests

4 participants