Running mypy on doctests
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- Python
- Sterne
- 20.6k
- Forks
- 3.3k
- PR-Merge-Kennzahlen
- PR-Kennzahlen ausstehend
Beschreibung
Hi!
I am trying to make a custom tool to run mypy on doctests inside my project.
Because I want to be sure that my examples are correct. And since pytest / doctest modules do it with ease I am seeking the similar solution but for types. Examples, where I need this:
- https://github.com/dry-python/classes/blob/master/docs/pages/concept.rst
- https://github.com/dry-python/returns/blob/master/returns/result.py#L135
So, I have started with using api. It works fine, but requires to create temp files with extracted doctest code contents. This is a working solution, but the only ugly part is that it is based on temporary files. And reports incorrect filenames, locations, etc.
I have tried to go deeper and pass just the source code / ast parts. But, it does not look like it works this way. Is there a way to make it work without touching a lot of protected / private APIs?
Maybe this can be implemented in mypy itself at sometime?
Thanks!
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Beginne mit mypy/api.py und überprüfe, wie dessen öffentliche API Quelltext akzeptiert und Dateinamen sowie Positionen meldet. Vergleiche dieses Verhalten mit dem im Issue beschriebenen Ansatz mit temporären Dateien; die Arbeit ist abgeschlossen, wenn doctest-Code ohne temporäre Dateien geprüft werden kann und dabei genaue Dateinamen und Positionen erhalten bleiben.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- python
- Bereich
- devtools
- Issue-Typ
- Feature
- Schwierigkeit
- 5/5
- Geschätzter Aufwand
- Über eine Woche
- Aktivitätsstatus
- Veraltet
- Klarheit
- Muss geklärt werden
- Anfängerfreundlichkeit
- 25/100