-
Notifications
You must be signed in to change notification settings - Fork 97
Fixes annotations and tests for python 3.14 #208
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
Conversation
grpclib/client.py
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
RuntimeError is a generic exception which might be raised for many reasons. It might be better to check the Python version instead of relying on exceptions.
grpclib/client.py
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
grpclib is a library, not a framework, IMO we can't create an event loop on our own, and then make it private. So it must be ok that error will be thrown if there is no event loop in the current context, then it is user's responsibility to create one.
requirements/test_314.txt
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have you tried to regenerate all requirements files instead of introducing new test_314.txt file?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried, but I did not come up with a way to get pip-compile to auto-generate a single file that works with 3.8 and newer versions.
I did another attempt to generate one for 3.9 and use that for Python>=3.9, but it was not compatible with 3.13.
Another approach is to generate a 3.14 file with ; python_version >= "3.14, add ; python_version < "3.14" to the current test.txt, and combine the two files. It feels kind of hacky tho.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you okay with generating a new test_314.txt for Python 3.14?
grpclib/events.py
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We used to have _compat module: v0.3.2/grpclib/_compat.py
It makes sense to create such module again and move compatibility code there.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense! I moved this logic to a _compat.py file.
Uh oh!
There was an error while loading. Please reload this page.
With 3.14, the
__annotations__are no longer inparamswhen using a metaclass. This PR fixes this issue by usingannotationlibfor Python 3.14 to get the annotations.For details see: https://docs.python.org/3.14/library/annotationlib.html
I also need to generate another Python 3.14 requirements file to pull in the changes from
pytest-asynciothat is compatible with 3.14.