(🎁) multiple platform/version compatible mode
Personne n'a encore pris cette issue.
Évaluation
- Difficulté
- 5/5
- Temps estimé
- Plus d'une semaine
- Accessibilité débutants
- 25/100
Piste de recherche
Commencez par les options de ligne de commande existantes de mypy, --python-version et --platform, ainsi que par les exemples de configuration [tool.mypy] dans l’issue. Définissez le comportement de la matrice des versions/plateformes prises en charge et l’agrégation des diagnostics avant de localiser l’implémentation et les tests ; c’est terminé lorsqu’une seule invocation signale les erreurs provenant de chemins divergents sans exécutions manuelles répétées.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
Feature
I want mypy to show errors for all platforms and versions, not just the current/selected one
import sys
if sys.version_info < (3, 11):
print(21 + "sus") # very funny, but is a type error 😢
if sys.platorm == "win32":
print(21 + "sus") # very funny, but is a type error 😢
actual:
> mypy test.py
no errors 😳
Instead I have to run mypy many times to get a comprehensive output:
> mypy --python-version 3.11 --platform lignux test.py
no errors 😳
> mypy --python-version 3.11 --platform darwin test.py
no errors 😳
> mypy --python-version 3.11 --platform win32 test.py
test.py:5: error: very funny, but that's a type error [😳]
Found 1 error in 1 file (checked 1 source file)
> mypy --python-version 3.10 --platform lignux test.py
test.py:3: error: very funny, but that's a type error [😳]
Found 1 error in 1 file (checked 1 source file)
> mypy --python-version 3.10 --platform win32 test.py
test.py:3: error: very funny, but that's a type error [😳]
test.py:5: error: very funny, but that's a type error [😳]
Found 2 errors in 1 file (checked 1 source file)
... etc, etc, etc ...
+ additional steps to curate the output into a readable format. (+ ratio?)
I would imagine that most libraries would want type checking applied for their supported python versions and platforms, and most python applications would probably want multiple platforms supported.
So almost everyone using mypy would want some level of cross support, and the current workaround includes manually building a solution involving running mypy concurrently and collecting / filtering the results. I would much rather this very common use-case be supported natively.
Perhaps some way of specifying a list of desired selections, and mypy could pass over the code with a matrix of those options. Perhaps mypy could run multiple processes to improve performance, or alternatively incorporate some complicated logic where it only does one run over the code but analyses the different paths/types correctly. The latter is the preferred solution in my mind, as it would be a lot more efficient and allow some additional benefits (#8823/#5940 comes to mind)
I would also expect mypy to show a note when an error is only detected under a diverging path, to make resolution easier.
pyproject.toml:
[tool.mypy]
platforms = ["lignux", "darwin", "win32"]
python_versions = [3.11, 3.10, 3.9, 3.8, 3.7]
> mypy test.py
test.py:3: error: very funny, but that's a type error [😳]
test.py:3: note: error found with python-version < 3.11
test.py:5: error: very funny, but that's a type error [😳]
test.py:5: note: error found with platform "win32"
Found 2 errors in 1 file (checked 1 source file)
- Langage dominant
- Python
- Étoiles
- 20.6k
- Forks
- 3.3k
- Merge moyen
- 1 j 18 h
- PR mergées (30 j)
- 54
Guide de contribution
Ouvrir le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de python/mypy
-
bug
Difficulté 2/5 1-3 heures Accessibilité débutants 75/100
-
bug
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
-
bug
Difficulté 2/5 1-3 heures Accessibilité débutants 76/100
-
documentation
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100
-
bug topic-configuration topic-error-reporting
Difficulté 2/5 1-3 heures Accessibilité débutants 68/100
Toutes les issues de python/mypy
Issues similaires
-
Difficulté 2/5 1-3 heures Accessibilité débutants 74/100
bancolombia/sentinel#23 ·
-
test md OuverteCI
Difficulté 2/5 1-3 heures Accessibilité débutants 74/100
-
integration:quickjs org:external priority:backlog topic:code-interpreter topic:middleware type:feature
Difficulté 2/5 1-3 heures Accessibilité débutants 74/100
langchain-ai/deepagents#6450 ·
-
bug client
Difficulté 2/5 1-3 heures Accessibilité débutants 88/100
-
Difficulté 2/5 1-3 heures Accessibilité débutants 74/100