adafruit / Adafruit_CircuitPython_PIOASM

Simple assembler to convert pioasm to bytes
MIT License
27 stars 17 forks source link

Run mypy during pre-commit to verify typing information #51

Closed jepler closed 5 months ago

jepler commented 2 years ago

This is a proof of concept and request for comments: When libraries are fully typed, we can and should make sure that stays true by running mypy in pre-commit.

The script automatically detects the packages and/or modules to run on.

A package may opt into non-strict mypy mode with a stanza in pyproject.toml:

[tool.adafruit]
    mypy-strict = false

I tested it also on Adafruit_CircuitPython_LED_Animation and that package is just a few changes away from passing mypy in non-strict mode.

This is based on the ideas from https://jaredkhan.com/blog/mypy-pre-commit

kbsriram commented 5 months ago

Hi @jepler - is this something you're still looking at?

If it might be on the back-burner for a while longer, would you find it useful - maybe as an incremental step - to add some simpler changes to the pre-commit file to run mypy with --strict checks on this repository for now? (And replace later with the more 'automatic' approach you have in mind.)

Maybe a small update like this? https://github.com/adafruit/Adafruit_CircuitPython_PIOASM/commit/d067d01464e218458c7ea4bef8582c547b41d51f (run logs here).

jepler commented 5 months ago

I haven't touched this in quite some time, and I'm not likely to do so anytime soon.

jepler commented 5 months ago

I'm not sure what path will get us to running mypy across libraries. making bespoke changes to the pre-commit file in each repo is undesirable, as it makes it harder to bulk update pre-commit across libraries with an adabot patch .. both my approach and yours do this. But mostly I just haven't had the time to devote to trying to figure out how to do it.

kbsriram commented 4 months ago

:ok_hand: - thank you for your feedback around this!