-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Make type hinting mypy-clean with relaxed settings #6905
Comments
At the moment, |
It looks like this may depend on python version. I still see this crash with python 3.7.12 and mypy 0.950, but I know @levbishop was able to get results with the same mypy python 3.9.12. |
I think it's because Lev used some super relaxed options, that result in the mypy bug I linked above not getting triggered. Probably With no options, I can still reproduce the error on both Python 3.7 and 3.9 and mypy 0.950. |
Interesting, but the relaxed options I think provide a good place to start. Transcribing @levbishop 's results
FWIW, for me mypy crashed out on 3.7 even with the same relaxed options @levbishop was using
|
Hi, I think work on this is blocked by python/mypy#12943? |
It's not necessarily blocked, but it'll definitely be harder to do while mypy crashes on Terra. The code mypy currently crashes on is something that could be worked around with more complete typing - if all partial types are resolved at the end of |
Relatively frequent errors that I'm unsure how to fix
|
Some potential answers:
Part of the reason for doing this is to find cases where there are programming bugs caused by type mis-use, so there's bound to be some places in the code that are incorrect. We need to fix those as well (but not as part of a typing PR - that would be near-impossible to review). |
|
It's not clear that we want to enforce strict type hinting for qiskit and/or include mypy in our CI, but I do think that for the places where type hinting exists, there those hints should aim to be correct. For many modules they mostly already are, but in others there are a lot of errors. I'd even be fine with removing the incorrect type hints if its too much trouble to correct them.
The current situation makes it harder for contributors who care to use mypy since they need to ignore all the errors that don't relate to their PR.
The text was updated successfully, but these errors were encountered: