Skip to content

Conversation

brandon-doist
Copy link
Contributor

@brandon-doist brandon-doist commented Feb 26, 2025

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.

not_found_entries = []

now = datetime.datetime.utcnow()
now = datetime.now(tz=timezone.utc)
Copy link
Contributor Author

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 👍

@brandon-doist brandon-doist marked this pull request as ready for review February 27, 2025 14:54
Copy link
Member

@proxi proxi 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, test pass, memory_sqs is test-only.

Copy link
Member

@goncalossilva goncalossilva left a 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. 🚀

Copy link

@Copilot Copilot AI left a 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.

@brandon-doist brandon-doist merged commit b623bab into main Feb 28, 2025
12 checks passed
@brandon-doist brandon-doist deleted the brandon/utcnow branch February 28, 2025 15:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants