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
Compatibility with Python 3.7 #284
Comments
In stubs, you can use PEP 585 syntax on Python versions < 3.9. flake8-pyi only supports stub files. |
Yep, just realised that, never mind... :P |
Out of curiosity, did you only just add dependabot to |
Looks like it's been trying to update since February (might have been broken or something before that): https://github.com/aio-libs/multidict/pulls?q=is%3Apr+flake8-pyi+is%3Aclosed |
I'm reopening this, as it seems this isn't quite correct. After releasing multidict 6.0.3 we've been getting type errors in aiohttp if mypy is run with python <3.10. Specifically, testing locally, these are the changes I've needed to revert to get the type checking passing again: The |
This is somewhat surprising. We've been using PEP 585 syntax in typeshed for many months now (and mypy uses the same version of typeshed for checking code on Python 3.7 as it does on other versions of Python). If there were a compatibility issue here, I would have thought that we would have heard about it by now. In any case, this seems more like a mypy bug than a flake8-pyi bug. Type checkers should allow modern syntax in stub files; if they don't, that should be reported as a bug to the type checker. Still, I'm curious to see if I can reproduce this. Can you give me the full details of the Python version you're running mypy on, any environment variables you're setting, the flags you're passing to mypy, and the code mypy is failing on? |
Here's an example of the CI failing: https://github.com/aio-libs/aiohttp/actions/runs/3733253503/jobs/6333799339 That's running on Python 3.9, it seems running mypy on any version of Python <3.10 results in errors. You can test locally by cloning aiohttp and type checking that. You'll find errors with multidict==6.0.3, no errors with the reverted changes in multidict==6.0.4. I don't think it's a problem with the syntax, but the object implementations. e.g. If mypy is type checking with Python 3.7, then it doesn't recognise |
Which come to think of it, is exactly what is being done in typeshed, with |
We import |
Yes, I take that back, just checked that. So, I'm lost why it is happening. |
I'll see if I can spend some time looking at your repo, but tbh I have a lot of other things on right now, so there's a significantly higher chance I'll get to it if you're able to minimise the repro a little :) |
On Python <3.10:
|
"It is easy to reproduce this issue" ≠ "I have a minimal example". |
Uhh, no, I can't figure out a minimal reproducer, which is probably a bad sign... |
Okay, thanks for trying. I'll see if I can figure out what's going on. |
Is there something left to do here? Doesn't sound like there's a reproducible flake8-pyi bug. |
It was reproducible with our repo: #284 (comment) |
That sounds like a bug in mypy, not flake8-pyi. |
I'll leave that to you to decide, but it makes sense to me that mypy would give an error because |
The log you link there no longer exists, unfortunately. However, |
Indeed — even in a I never got round to investigating the weirdness in your CI, I'm afraid, but I'm 95% sure that it wasn't a bug in flake8-pyi. As Jelle says, my best guess is that it's a bug in mypy |
Is there any option to say that we need compatibility with Python 3.7? Or are we expected to add any incompatible error codes to the ignore list?
e.g. Y022 is not possible to fix until Python 3.9 is the minimum supported version (in our library).
The text was updated successfully, but these errors were encountered: