replace deprecated startup + UTC timestamp APIs with Python 3.12#182
Open
matheusmaldaner wants to merge 1 commit into
Open
replace deprecated startup + UTC timestamp APIs with Python 3.12#182matheusmaldaner wants to merge 1 commit into
matheusmaldaner wants to merge 1 commit into
Conversation
server/server.py @app.on_event("startup") moved to an asynccontextmanager
lifespan attached via FastAPI(..., lifespan=_lifespan). Same startup body.
17 datetime.utcnow() call sites rewritten to
datetime.now(timezone.utc).replace(tzinfo=None) across server/server.py
and the microchat / micromail / microdin handlers. The .replace(tzinfo=None)
preserves the naive-UTC wall-clock value so downstream .isoformat() + "Z"
strings and .timestamp() ID generation stay byte-identical.
Both APIs were deprecated (FastAPI 0.93 / Python 3.12). CI pins 3.12 so the
warnings would surface on every run.
79869d3 to
c885269
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
@app.on_event("startup")with an async lifespan managerdatetime.utcnow()calls while preserving naive UTC timestamp strings and timestamp-based IDschecked with:
TestClient/statusreturnspreinit; withSENTINEL_DEV=micromailreturnsreadySENTINEL_DEV=<env>environments boot toreadyeval_sqlchecks; none reference the rewritten dynamic timestamp fields or generated timestamp ID prefixes