Stricter mypy#176
Conversation
I've added a stub __set__ to BaseProperty to improve type checking. Other than that, no code changes.
The ActionDescriptor really confuses mypy. It would be nice to find a better way to reference actions.
This doesn't improve the fact that the generated class can't be type checked.
None of these should affect how the code actually runs. Return types of functions used as FastAPI endpoints are also specified as the `model` and thus I don't expect any change to the API.
This also combines the two runs of mypy on src and typing_tests, as they can now both use the stricter rules.
Using `str` was converting `pending` to `InvocationStatus.PENDING` which caused the websocket tests to fail. Using `.value` fixes the problem.
These weren't flagged by dmypy but did show up with mypy.
I added a __set__ to BaseProperty to satisfy mypy, so now there is a test to check it raises an error and is overridden.
julianstirling
left a comment
There was a problem hiding this comment.
I realise that even though I left comments GitHub didn't mark it at review. I think the big one is the assert that should raise an actual error with a message.
|
I think this is ready - there are more improvements based on this branch in #180. |
|
The assert is removed in #180 (I thought I may as well bite the bullet and remove all of them). Trying to quickly do it here, I'm getting into a rabbit hole of rebasing faff. @julianstirling I think it would be more efficient for me to reset this branch back to f6c8976 (all tests passed), then we can hit "merge" and move on to #180 (which passes, but needs coverage improving). I promise the assert is already gone in #180 - eliminating it in this one is just eating time I could use to fix something else. |
|
@julianstirling I've reset this to the last commit that passed CI, which still includes an |
|
Separating no assertions from the MyPy changes is very sensible. I'm happy for this to be bumped to #180 |
I've added some
mypyflags to enforce everything is annotated, and updated the codebase to get it passing the new, stricter checks.mypymay now be run withmypyordmypy run.