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
Mypy 0.620 and generic type aliases #272
Conversation
If disallow_any_generics is enabled, we get the following errors in projects using multidict: multidict/__init__.pyi:34: error: Missing type parameters for generic type multidict/__init__.pyi:42: error: Missing type parameters for generic type multidict/__init__.pyi:58: error: Missing type parameters for generic type
Here are the original errors: multidict/__init__.pyi:16: error: Class multidict.MultiMapping has abstract attributes "__getitem__", "__iter__", "__len__" multidict/__init__.pyi:16: note: If it is meant to be abstract, add 'abc.ABCMeta' as an explicit metaclass multidict/__init__.pyi:28: error: Class multidict.MutableMultiMapping has abstract attributes "__delitem__", "__getitem__", "__iter__", "__len__", "__setitem__" multidict/__init__.pyi:28: note: If it is meant to be abstract, add 'abc.ABCMeta' as an explicit metaclass Another things fixed: * MultiDictProxy.copy returns MultiDict (not Proxy) * CIMultiDictProxy.copy returns CIMultiDict (not Proxy)
Codecov Report
@@ Coverage Diff @@
## master #272 +/- ##
=======================================
Coverage 99.71% 99.71%
=======================================
Files 4 4
Lines 355 355
=======================================
Hits 354 354
Misses 1 1 Continue to review full report at Codecov.
|
Thanks! |
Any plans for a release? |
We still need to test the flow with new tox-based approach, but it should be possible. @asvetlov should I implement publishing to testpypi? For example with matching tag names ( |
Yes, at least beta release would be helpful (can't install from git) |
Why can't you? |
Can't find some |
it does run cython to generate C-files and then compiles shared objects out of that if you use sdist. We just didn't formalize any policy for publishing new versions, that's why I don't do it and it's fully on @asvetlov to trigger this. I'm only in charge of automation here. |
I'm doing |
I've started to build the next 4.4.0 alpha version. |
@tailhook do you have cython + gcc available in env? |
gcc -- yes, cython -- no. But there were no errors like |
Yeah, it's being suppressed. So you get pure-python implementation available anyway. |
I'm not sure this discussion is useful here, but even if cython errors are suppressed, gcc errors aren't. So I don't get package installed. |
Actually, all of them should be suppressed. So it's likely a bug. |
Well, if it's a bug, it's a good one. I don't want my programs to become slower without noticing. I'm not sure what is a common way, but I would prefer |
@tailhook it's a common approach for all aio-libs repos. @asvetlov's motivation was to simplify stuff for non-techies. I would prefer a warning to stderr instead of changing default behavior + there's aio-libs/aiohttp#3164 where we think of implementing an env var for unsuppressing errors in dev mode. |
Here is the error BTW, and it's the same for 4.4.0a1, so it's not specific for git version:
When building a container, you have almost no chance to see the warning. So warnings on installation are almost useless in my opinion. |
Meaning warning in default mode and true error in strict mode. Also, why do you use sdist, whereas you're supposed to use binary wheel? |
Oh.. wheel haven't been published for some reason. |
I've got a feeling that something's changed in setuptools or so. cc @asvetlov |
Apparently, travis config might be broken. @asvetlov it's on me. |
I've triggered the release of v4.4.0a2: https://travis-ci.com/aio-libs/multidict/builds/80737712 |
v4.4.0a3 should address OS X specific stuff: https://travis-ci.com/aio-libs/multidict/builds/80738972 |
@webknjaz thanks. |
No worries, I feel like smth is missing there in env. I'll try to get it fixed in the evening. |
Great! Thanks! (now we need to fix aiohttp :) ) |
What's wrong with it? Anyway, file a ticket there. This is closed PR and comments are going to get lost |
Things I've noticed:
.pyx
and.py
implementationdisallow_any_generics = True
in mypy config because there are a lot of errors likeNo library stub file for module 'pytest'
(see travis). Not sure what to do with them._S
as a type name inMultiDict[_S, _T]
confuses_S
with a generic argument (TypeVar
), while it's just an alias forUnion
. Probably better name it_Str
or alike.