hauntsaninja / mypy_primer

Run mypy and pyright over millions of lines of code
MIT License
55 stars 29 forks source link

Add three mypy-checked projects from CPython #97

Closed AlexWaygood closed 10 months ago

AlexWaygood commented 10 months ago

Argument Clinic, the cases generator, and the peg generator are now all checked with mypy in CI. All have very strict settings enabled in their mypy configs (including the new possibly-undefined error code for the cases generator). The cases generator and Argument Clinic also make heavy use of pattern-matching; and the peg generator makes some use of relatively obscure parts of setuptools (which is useful for typeshed).

AlexWaygood commented 10 months ago

The changes in model.py were required to avoid tripping this assertion here, since this adds three projects from the same repo:

https://github.com/hauntsaninja/mypy_primer/blob/cd38346c2e231d4ec015d4b57416426cff692ab2/mypy_primer/projects.py#L863

(Very happy to go with a different fix if you don't like this one!)

AlexWaygood commented 10 months ago

Note: although these projects live in the CPython repo, they're guaranteed to not use any syntax newer than Python 3.10. That's because these projects are used to build CPython itself, and CPython 3.13 can't rely on features new-in-py312 in its build scripts, or it would run into bootstrapping issues. As such, all three projects have python_version = 3.10 in their mypy config files.

AlexWaygood commented 10 months ago

Okay cool, I think I've fixed the final nits!

hauntsaninja commented 10 months ago

Thank you!

hauntsaninja commented 10 months ago

Temporarily reverted in https://github.com/hauntsaninja/mypy_primer/commit/3fe90cf5c76de767ac4f1e46c9893a0dde0376cd in case it's causing issues