Skip to content
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

docs: deprecate google.cloud.firestore_v1.rate_limiter.utcnow #716

Merged
merged 6 commits into from
Dec 5, 2023

Conversation

Mariatta
Copy link
Contributor

@Mariatta Mariatta commented May 11, 2023

These will be deprecated starting in Python 3.12.

Replaced:

  • datetime.datetime.utcnow() with datetime.datetime.now(tz=datetime.timezone.utc)

  • datetime.utcfromtimestamp() with datetime.fromtimestamp(tz=datetime.timezone.utc)

Source: python/cpython#103857

Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly:

  • 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 #<issue_number_goes_here> 🦕

BEGIN_COMMIT_OVERRIDE
fix: Remove used of deprecated datetime.datetime.utcnow() and datetime.utcfromtimestamp()
docs: deprecate google.cloud.firestore_v1.rate_limiter.utcnow
END_COMMIT_OVERRIDE

These will be deprecated starting in Python 3.12.

Replaced:
- `datetime.datetime.utcnow()` with `datetime.datetime.now(tz=datetime.timezone.utc)`

- `datetime.utcfromtimestamp()` with `datetime.fromtimestamp(tz=datetime.timezone.utc)`
@Mariatta Mariatta requested review from a team as code owners May 11, 2023 00:02
@product-auto-label product-auto-label bot added size: m Pull request size is medium. api: firestore Issues related to the googleapis/python-firestore API. labels May 11, 2023
Copy link

@pganssle pganssle left a comment

Choose a reason for hiding this comment

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

Looks good from what I can tell, except for the change to the public interface, which you'd know more about than me.

google/cloud/firestore_v1/rate_limiter.py Outdated Show resolved Hide resolved
tests/unit/v1/test_rate_limiter.py Show resolved Hide resolved
@meredithslota
Copy link
Contributor

Added do not merge here as we want to verify that we're doing this consistently across any other Python libraries that use this.

@meredithslota meredithslota added the do not merge Indicates a pull request not ready for merge, due to either quality or timing. label Jun 20, 2023
@parthea parthea changed the title feat: Replace utcnow and utcfromtimestamp fix: Replace utcnow and utcfromtimestamp Nov 30, 2023
@parthea parthea removed the do not merge Indicates a pull request not ready for merge, due to either quality or timing. label Nov 30, 2023
@product-auto-label product-auto-label bot added size: l Pull request size is large. and removed size: m Pull request size is medium. labels Dec 4, 2023
@parthea parthea changed the title fix: Replace utcnow and utcfromtimestamp docs: deprecate google.cloud.firestore_v1.rate_limiter.utcnow Dec 4, 2023
@parthea parthea added kokoro:run Add this label to force Kokoro to re-run the tests. kokoro:force-run Add this label to force Kokoro to re-run the tests. labels Dec 4, 2023
@parthea parthea assigned daniel-sanche and unassigned parthea Dec 4, 2023
@yoshi-kokoro yoshi-kokoro removed kokoro:run Add this label to force Kokoro to re-run the tests. kokoro:force-run Add this label to force Kokoro to re-run the tests. labels Dec 4, 2023
Copy link
Contributor

@daniel-sanche daniel-sanche left a comment

Choose a reason for hiding this comment

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

LGTM

@parthea
Copy link
Contributor

parthea commented Dec 5, 2023

I filed #812 for the issue Using the synchronous google.api_core.retry.Retry with asynchronous calls may lead to unexpected results. Please use google.api_core.retry_async.AsyncRetry instead. which appears in the failing presubmit Kokoro Prerelease Dependencies

@parthea parthea merged commit 4a74d71 into main Dec 5, 2023
21 of 22 checks passed
@parthea parthea deleted the replace-utcnow branch December 5, 2023 15:50
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: l Pull request size is large.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants