-
Notifications
You must be signed in to change notification settings - Fork 9
Remove uses of utcnow, update deps for python 3.12 #120
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
not_found_entries = [] | ||
|
||
now = datetime.datetime.utcnow() | ||
now = datetime.now(tz=timezone.utc) |
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.
Note -- we're using datetime.timezone.utc
in all these places instead of datetime.UTC
like we do in Todoist; they are the same thing, but the datetime.UTC
alias was only created in python 3.11, and for this library we want to maintain compatibility farther back than that 👍
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.
✅ Looks good, test pass, memory_sqs is test-only.
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.
All changes make sense to me and tests pass. 🚀
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.
PR Overview
This PR updates the project to use timezone-aware datetimes instead of naive ones and bumps dependency versions to support Python 3.12.
- Updated tests (conftest.py) to generate queue names with aware datetimes.
- Replaced all naive datetime usages with timezone-aware alternatives in the SQS in-memory implementation and shutdown policies.
- Updated pre-commit configuration to use Python 3.12.
Reviewed Changes
File | Description |
---|---|
tests/conftest.py | Uses aware datetime for constructing test SQS queue prefixes. |
sqs_workers/memory_sqs.py | Updated datetime usages to be timezone aware in SQS in-memory logic. |
sqs_workers/shutdown_policies.py | Replaced naive datetime with aware datetime in shutdown logic. |
.pre-commit-config.yaml | Updated Python version from 3.11 to 3.12 in pre-commit configuration. |
Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.
What the title says! Switches from naive datetimes to aware ones, which from my looking at the places they're used, I don't think will cause any problems --
memory_sqs
is only used for tests, and shutdown policy's_last_seen
is maintained totally by us (e.g. we're not comparing datetimes to responses from AWS).(but please double-check this ^ with me)!
Also updates the versions of dependencies in
poetry.lock
.