Skip to content

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

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

jekozyra
Copy link

@jekozyra jekozyra commented May 10, 2025

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 🦕

@product-auto-label product-auto-label bot added size: s Pull request size is small. api: firestore Issues related to the googleapis/python-firestore API. labels May 10, 2025
@jekozyra jekozyra force-pushed the jillian/update-types-for-async-transactions branch from b216867 to ca23405 Compare May 10, 2025 04:59
@jekozyra jekozyra marked this pull request as ready for review May 10, 2025 04:59
@jekozyra jekozyra requested review from a team as code owners May 10, 2025 04:59
@jekozyra
Copy link
Author

@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")
Copy link
Contributor

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

Copy link
Author

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.

Copy link
Contributor

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: firestore Issues related to the googleapis/python-firestore API. size: s Pull request size is small.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

The type of async_transactional is incorrect
4 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy