-
Notifications
You must be signed in to change notification settings - Fork 20
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
Support Python 3.10 #116
Comments
+1, also want to include this library to my project. |
Sorry, I am not able to fix this in foreseeable future. There is more to it than the collections issue. Already even Python 3.9 compatibility would require some serious work. When I started this library I did not expect it to require half a rewrite for every new Python release. However, if someone has a fix or improvement to offer (as a PR), be my guest. |
I am trying to follow the history (in From the outside, it seems to me that the decision to leave the type-equivalents of That discussion aside, my current trail ends here, and I want to ask you whether you can point me to other libraries that implement this functionality and which are also updated to Python 3.10, if any. Do you know if there are any third-party libraries that are considered more reference implementations than others? |
@sveinugu , what about mypy? Most static type checkers use mypy hence it can be used in dynamic type checks too. |
Thanks for the feedback. I was under the impression that mypy was only for static type checking, but I suppose you are right. However, I tried now and I am not easily able to make this work:
As this is meant for a production library I would rather make use of an API that is meant to be used dynamically. In any case, I presume I may be missing something? |
@sveinugu , well, mypy can not directly check types in runtime (states by one of maintainers). Nevertheless, there are several tricks:
For both tricks I found mypy.api.run method suitable. Check out my example: >>> from mypy.api import run
>>> run(['-c', 'x:list[int]=1,2'])
('<string>:1: error: Incompatible types in assignment (expression has type "Tuple[int, int]", variable has type "List[int]")\nFound 1 error in 1 file (checked 1 source file)\n', '', 1)
>>> run(['-c', 'x:list[int]=[1,2]'])
('Success: no issues found in 1 source file\n', '', 0) |
Thanks! I am not very happy to use a hack like this, but if that is what’s possible, then at least it should be working. I might be able |
Some code needs to be updated now that the deprecated top-level ABCs in
collections
have been removed.The text was updated successfully, but these errors were encountered: