rusackas opened a new pull request, #41502:
URL: https://github.com/apache/superset/pull/41502

   ### SUMMARY
   
   Python 3.12 deprecated `datetime.utcnow()` and 
`datetime.utcfromtimestamp()`. This sweeps all production occurrences under 
`superset/` (8 files, ~29 call sites) and replaces them with 
**behavior-preserving** equivalents:
   
   ```
   datetime.utcnow()            → 
datetime.now(timezone.utc).replace(tzinfo=None)
   datetime.utcfromtimestamp(x) → datetime.fromtimestamp(x, 
timezone.utc).replace(tzinfo=None)
   ```
   
   The values stay **naive UTC**, exactly as before. This is a deliberate 
choice — and the key difference from the earlier #37538, which switched to 
*aware* datetimes. Superset stores naive UTC datetimes in the metadata DB, so 
switching to aware values would raise naive/aware comparison errors (e.g. the 
`Log.dttm` prune query on PostgreSQL — see the existing comment in 
`superset/commands/logs/prune.py`) and would change `isoformat()`/cache-key 
output. Keeping the values naive makes this a pure no-op refactor that just 
removes the deprecation.
   
   `superset/security/session_invalidation.py` already uses 
`datetime.now(timezone.utc)` and is intentionally left unchanged.
   
   ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
   
   N/A — no functional or UI change.
   
   ### TESTING INSTRUCTIONS
   
   No behavior change; the produced datetime values are identical to before 
(naive UTC), so existing tests cover these paths. `pre-commit` (ruff, 
ruff-format, mypy, pylint) passes on all changed files.
   
   ### ADDITIONAL INFORMATION
   
   - [ ] Has associated issue:
   - [ ] Required feature flags:
   - [ ] Changes UI
   - [ ] Includes DB Migration (follow approval process in 
[SIP-59](https://github.com/apache/superset/issues/13351))
   - [ ] Introduces new feature or API
   - [ ] Removes existing feature or API
   
   Scope is limited to production code under `superset/` to keep the diff easy 
to verify as a no-op. Test files under `tests/` still use the deprecated calls 
and can be migrated in a focused follow-up.
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to