-
Notifications
You must be signed in to change notification settings - Fork 78
fix: update the async transactional types to not require extra awaits #1045
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
base: main
Are you sure you want to change the base?
fix: update the async transactional types to not require extra awaits #1045
Conversation
b216867
to
ca23405
Compare
@wu-hui could I get a review here please? |
@@ -41,6 +52,10 @@ | |||
from google.cloud.firestore_v1.query_profile import ExplainOptions | |||
|
|||
|
|||
T = TypeVar("T") | |||
P = ParamSpec("P") |
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.
It looks like ParamSpec was added in python 3.10, and we need to support 3.8
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 added typing_extensions
to support expanded type hinting for older python versions. Let me know if that works, otherwise I'll come up with something more hacky for the signatures.
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.
Sorry, adding an extra dependency to setup.py isn't an option unfortunately
Let me know if you're able to experiment with getting this working, or I can try to take it from here if you don't have the capacity
Thanks!
I updated the types of a few things in async_transactional to ensure that when a function wrapped with
@async_transactional
is called:the return type of the inner function is correctly detected as the correct final result by the typechecker
we can pass additional arguments to the wrapped function without the typechecker complaining
Make sure to open an issue as a bug/issue before writing your code! That way we can discuss the change, evaluate designs, and agree on the general idea
Ensure the tests and linter pass
Code coverage does not decrease (if any source code was changed)
Appropriate docs were updated (if necessary)
Fixes #1044 🦕