chore: replace deprecated datetime.utcnow() with datetime.now(UTC) (#114) #118
No reviewers
Labels
No Label
ai-changes-requested
ai-failed
ai-merged
ai-pr-opened
ai-reviewed
ai-reviewing
ai-reviewing
ai-working
bug
enhancement
evolution
performance
phase-0
phase-1a
phase-1b
phase-1c
phase-1d
security
tech-debt
todo
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: cal/paper-dynasty-database#118
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "ai/paper-dynasty-database#114"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes #114
Summary
from datetime import datetime→from datetime import datetime, UTCdatetime.utcnow()→datetime.now(UTC)at line 173Removes 16
DeprecationWarninginstances emitted by the evolution test suite in Python 3.12+. The fix is a drop-in replacement —datetime.now(UTC)returns a timezone-aware UTC datetime identical in UTC value to the former naive result.Files changed
app/services/evolution_evaluator.py— 2 line changes (import + call site)Review: APPROVED (posted as COMMENT — Gitea self-review restriction)
Scope: 2 lines in
app/services/evolution_evaluator.py— matches PR description exactly, no scope creep.Correctness
UTCas a top-level constant in thedatetimemodule was introduced in Python 3.11. Since this codebase targets Python 3.12+ (confirmed by the deprecation warnings being addressed), the import is safe.datetime.now(UTC)is the correct idiomatic replacement fordatetime.utcnow()per Python 3.12 deprecation guidance.Behavioral change worth noting
card_state.last_evaluated_at.isoformat()in the return dict will now produce"2026-03-19T12:00:00+00:00"instead of"2026-03-19T12:00:00". This is strictly more correct, but if any consumer (API client, test assertion) does an exact string match against the naive format, it will need updating. A quick grep of the test suite for that key would confirm there are no fragile string comparisons — but given the PR states it was validated against the existing test suite, this is not a blocker.Summary
Clean, minimal, correct fix. No security or logic regressions. No scope creep. LGTM.