-
-
Notifications
You must be signed in to change notification settings - Fork 932
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ci: check types with mypy #1226
Conversation
Thanks a lot for taking this on! Your effort is much appreciated, and also much needed to get GitPython back on track. It appears that thanks to never actually running the type checker, the previous commits to add types weren't validated and seemingly aren't working (or are only working with python 3.9). I have no idea how much additional work it would be to get mypy to pass, but if it's a dead-end it would certainly be alright to give up on types altogether and revert the commits that added them. It's all up to you. |
Combined with #1227 this should pass now. |
Without the presence of 'test-requirements.txt' 'tox' is unusable.
Because there's too many to fix quickly.
This gives mypy all information that it needs to determine what the return type of a function call is *iff* it knows the argument's type. As a result it can now stop complaining about passing None to str.join() in exc.py.
By telling it where it's imported from in one case and telling it to ignore it in another.
This will result in _partial_ type checking of the type annotations by using mypy. Keep in mind though that mypy is performing _static_ analysis in a _dynamic_ language so it can only partially check for correctness. Some other tool(s) will be needed to have more complete type checking at runtime. E.g. [typeguard]. [typeguard]: https://pypi.org/project/typeguard/
Rebased (to force test-rerun) after #1227 got merged. Unfortunately it looks like the 3.9 build failed due to what looks like an intermittent failure. And I cannot retrigger a build without (another) force push.... |
Thanks a million! |
This is intended to (partially) address the CI concerns expressed in #1219 and #1223 and will result in partial type checking of the type annotations by using mypy. Keep in mind though that mypy is performing best-effort static analysis in a dynamically typed language so it can only partially check for correctness.
Some other tool(s) will be needed to have more complete type checking at runtime. E.g. typeguard.
In order to get mypy running successfully this also makes a few (as little as possible) changes to the type annotations. The mypy setting to require annotations on everything is commented out because there's way too much functions lacking annotations right now.