python / python/mypy

Make type checking mypy more straightforward for new contributors

Aperta
#11,403 2 commenti 1 reazione 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

topic-developer topic-tests
Lingua principale
Python
Stelle
20.6k
Fork
3.3k
Metriche di merge delle PR
Metriche PR in attesa

Descrizione

There are a couple pitfalls relating to type checking mypy itself that don't seem to be documented anywhere:

  1. Specifying files: Running mypy . and mypy mypy mypyc both result in duplicate module errors that prevent further type checking. The correct way to run mypy is mypy -p mypy -p mypyc, which doesn't appear to be documented anywhere (I only found this by looking at the tox.ini config file).
  2. Specifying the config file: Failing to specify mypy_self_check.ini as the config file results in an error in mypy/bogus_type.py and means that people aren't using mypy's stricter type checking options.

I think the solution to 2 would be to rename mypy_self_check.ini to mypy.ini, because self checking mypy is significantly more common than compiling mypy with mypyc, so making mypy_self_check.ini the default config file seems reasonable.

For 1, we should at the very least document the command to run mypy in CONTRIBUTING.md. I think the ideal solution would involve changing the configuration file so that either mypy . or mypy mypy mypyc just works correctly, the latter of which seems to be possible from my experiments by turning on namespace_packages and excluding mypyc/test-data.

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Inizia da CONTRIBUTING.md e tox.ini per confrontare i comandi mypy documentati e configurati. Esamina mypy_self_check.ini e mypy/bogus_type.py, quindi verifica se le modifiche proposte alla denominazione della configurazione o ai namespace packages evitano gli errori relativi ai moduli duplicati mantenendo al contempo un controllo automatico rigoroso. Il lavoro è completato quando il workflow per i contributori documenta un comando e una configurazione affidabili.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
python
Ambito
build-system, developer-experience, documentation
Tipo di issue
Documentazione
Difficoltà
3/5
Tempo stimato
1-2 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
52/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.