chore: replace deprecated datetime.utcnow() with datetime.now(UTC) #114

Closed
opened 2026-03-19 16:32:43 +00:00 by cal · 1 comment
Owner

Description

evolution_evaluator.py line 173 uses datetime.utcnow() which is deprecated in Python 3.12+ and scheduled for removal:

DeprecationWarning: datetime.datetime.utcnow() is deprecated and scheduled for removal in a future version.
Use timezone-aware objects to represent datetimes in UTC: datetime.datetime.now(datetime.UTC).

Shows as 16 warnings when running the evolution test suite.

Fix

# Before
from datetime import datetime
now = datetime.utcnow()

# After
from datetime import datetime, UTC
now = datetime.now(UTC)

Location

app/services/evolution_evaluator.py:173

Found during

Phase 1 smoke testing (2026-03-19)

## Description `evolution_evaluator.py` line 173 uses `datetime.utcnow()` which is deprecated in Python 3.12+ and scheduled for removal: ``` DeprecationWarning: datetime.datetime.utcnow() is deprecated and scheduled for removal in a future version. Use timezone-aware objects to represent datetimes in UTC: datetime.datetime.now(datetime.UTC). ``` Shows as 16 warnings when running the evolution test suite. ## Fix ```python # Before from datetime import datetime now = datetime.utcnow() # After from datetime import datetime, UTC now = datetime.now(UTC) ``` ## Location `app/services/evolution_evaluator.py:173` ## Found during Phase 1 smoke testing (2026-03-19)
Claude added the
ai-working
label 2026-03-19 17:31:05 +00:00
Claude added the
ai-pr-opened
label 2026-03-19 17:32:09 +00:00
Collaborator

PR #118 opens the fix: #118

Two-line change in app/services/evolution_evaluator.py:

  1. from datetime import datetimefrom datetime import datetime, UTC
  2. datetime.utcnow()datetime.now(UTC)

Eliminates the 16 DeprecationWarning instances from the evolution test suite.

PR #118 opens the fix: https://git.manticorum.com/cal/paper-dynasty-database/pulls/118 Two-line change in `app/services/evolution_evaluator.py`: 1. `from datetime import datetime` → `from datetime import datetime, UTC` 2. `datetime.utcnow()` → `datetime.now(UTC)` Eliminates the 16 `DeprecationWarning` instances from the evolution test suite.
Claude removed the
ai-working
label 2026-03-19 17:32:15 +00:00
cal closed this issue 2026-03-19 18:26:17 +00:00
Sign in to join this conversation.
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: cal/paper-dynasty-database#114
No description provided.