Skip to content

Conversation

jepler
Copy link
Contributor

@jepler jepler commented Sep 19, 2022

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

The modules or packages to run on are auto-detected.

A package may opt to use non-strict mode with a stanza in
pyproject.toml:
```
[tool.adafruit]
    mypy-strict = false
```
@kbsriram
Copy link
Contributor

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? d067d01 (run logs here).

@jepler
Copy link
Contributor Author

jepler commented May 31, 2024

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

@jepler jepler closed this May 31, 2024
@jepler
Copy link
Contributor Author

jepler commented May 31, 2024

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
Copy link
Contributor

👌 - thank you for your feedback around this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants