Open sea-bass opened 2 months ago
I think the first order of business is to add mypy to the pre-commit check so it runs on CI: https://github.com/pre-commit/mirrors-mypy
Unless this has a way to filter by folder, we may have to do the entire repo at once in order for CI to pass.
But if there is a way to filter this check by folder, it would be nice to break up the PRs. This is their official recommendation too:
https://mypy.readthedocs.io/en/stable/existing_code.html#start-small
I would recommend starting with a draft PR that applies this for one file, because I am interested in also seeing what it ends up looking like and how we have to modify the docstrings / docs generation so the docs look good with type annotations.
There is a way to filter folders/ files/directories to exclude them from the mypy check. This can be done by enabling or using the --exclude
option from the configuration file.
https://mypy.readthedocs.io/en/stable/config_file.html
I created a similar config file in the root dir and excluded the major directories in the repository from the mypy check. Now, I am able to run this file from the command-line interface like this:
mypy --config-file "CONFIG_FILE_NAME" .
This is running fine.
Now, because we want to configure mypy with pre-commit, I tried to read the config file from the pre-commit hook in the form of an argument. As of now, it is not working. I am figuring this out.
- repo: https://github.com/pre-commit/mirrors-mypy
rev: ''v1.10.1 "
hooks:
- id: mypy
args: [--config-file, CONFIG_FILE_NAME]
I want to do this so badly! But if someone wants to help, I won't be mad.
MyPy is promising: https://mypy-lang.org/, which has pre-commit hooks at https://github.com/pre-commit/mirrors-mypy
Would like to see how this plays with the docs generation as well.