Strict requirement for type hinting#83
Conversation
|
It looks like |
|
It looks like we should be able to use |
|
Yeah I wasn't sure whether or not requiring type hints on testing code is desirable, but that can be changed if we decide that it isn't |
|
I have had a look at this, because my next PR (#84) is affected. We can include the code below in def pytest_configure(config):
plugin = config.pluginmanager.getplugin("mypy")
plugin.mypy_argv.append("--allow-untyped-calls")
plugin.mypy_argv.append("--allow-untyped-defs")
plugin.mypy_argv.append("--allow-incomplete-defs")I think this is probably worth doing - I guess it is a similar argument to whether or not you use docstrings. I think docstrings are worthwhile because it is the 'right' place to comment on tests when needed, but I'm not sure we need to enforce typing on tests. @dalonsoa and @alexdewar ? |
|
I think that being more relaxed with typing in the tests make sense, so if there is a way of removing the most annoying aspects of mypy there, as it seems there is, I would use it. |
davidorme
left a comment
There was a problem hiding this comment.
OK. With that feedback, I'd say we roll back the typing added in tests and then add the local pytest-mypy plugin configuration to conftest.py.
|
I agree. The only caveat I would add though is that if it ends up being a faff to exclude the |
|
Actually appears to be fairly straightforward to add module/folder level exclusions for |
Description
Based on the discussion in #60 it seems like a good idea to make type annotations mandatory. If this becomes a problem down the we can always switch to a less strict option, but if we are going to use a more strict option, switching to it down the line would be a nightmare (there already were a lot of extra
mypyerrors to fix with our currently pretty minimal code base).I could find type stubs for either
shapelyordpath, so turned off type checking when I imported them. I may not have been looking in the right places for them though. So, if anyone knows where they can be found, let me know.Type of change
Key checklist
pre-commitchecks:$ pre-commit run -a$ poetry run pytestFurther checks