8000 [BREAKING] rename `StripeStreamResponseAsync`'s `.read()` to `read_async()` for consistency by xavdid-stripe · Pull Request #1474 · stripe/stripe-python · GitHub
[go: up one dir, main page]

Skip to content

[BREAKING] rename StripeStreamResponseAsync's .read() to read_async() for consistency #1474

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

Merged
merged 3 commits into from
Mar 31, 2025

Conversation

xavdid-stripe
Copy link
Member
@xavdid-stripe xavdid-stripe commented Mar 26, 2025

Why?

We added a linter ages ago to enforce that all async functions have the _async suffix. This consistency ensures that users are properly awaiting them (failure to do so can be the source of tricky bugs).

There was one exception to that rule, which I'm removing here.

While it's a breaking change for 100% of users, it will be a loud one. The method is renamed and they'll get both typecheck and runtime failures when they use the old method. Also, it only affects a single user-facing method.

This was the one method in our codebase that didn't comply with the convention, so it's being updated

What?

  • renamed StripeStreamResponseAsync.read() to StripeStreamResponseAsync.read_async()
  • fixed test

See Also

Changelog

  • ⚠️ Rename StripeStreamResponseAsync.read() to .read_async()
    • This brings the method name in line with the conventions used by every other async method in the package, ensuring consistent async usage.
    • You'll need to update your code if you call Quote.pdf_async().read() method. A typechecker will alert you to this change.

@xavdid-stripe xavdid-stripe requested a review from a team as a code owner March 26, 2025 19:40
@xavdid-stripe xavdid-stripe requested review from mbroshi-stripe and removed request for a team March 26, 2025 19:40
@xavdid-stripe xavdid-stripe enabled auto-merge (squash) March 26, 2025 19:40
Copy link
Contributor
@helenye-stripe helenye-stripe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the nittiest of nits: can we use ⚠️ in the changelog for consistency?

@xavdid-stripe xavdid-stripe merged commit e5e1019 into master Mar 31, 2025
15 checks passed
@xavdid-stripe xavdid-stripe deleted the rename-async-stream-read branch March 31, 2025 21:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
0