Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DM-41630: Convert to FastAPI lifespan functions #217

Merged
merged 1 commit into from
Nov 15, 2023
Merged

Conversation

rra
Copy link
Member

@rra rra commented Nov 10, 2023

As of FastAPI 0.93.0, FastAPI supports a lifespan async context manager to do startup and shutdown. The part before the yield is run during application startup and the part after the yield is run during application shutdown. The older on_event annotations are now deprecated.

Add a development dependency on FastAPI 0.93.0 and change the test suite uses of on_event annotations to lifespan functions. Update all of the documentation to use the lifespan function instead of on_event handlers.

This change does not bump the Safir FastAPI dependency because Safir's own code still works fine with either method.

@rra rra requested a review from jonathansick November 10, 2023 23:15
@rra rra force-pushed the tickets/DM-41630 branch from c5558a1 to 237d09b Compare November 13, 2023 16:12
Copy link
Member

@jonathansick jonathansick left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great, thank you for keeping this up to date.

As of FastAPI 0.93.0, FastAPI supports a lifespan async context
manager to do startup and shutdown. The part before the yield is
run during application startup and the part after the yield is run
during application shutdown. The older on_event annotations are now
deprecated.

Add a development dependency on FastAPI 0.93.0 and change the test
suite uses of on_event annotations to lifespan functions. Update all
of the documentation to use the lifespan function instead of on_event
handlers.

This change does not bump the Safir FastAPI dependency because Safir's
own code still works fine with either method.
@rra rra force-pushed the tickets/DM-41630 branch from 237d09b to 451f98c Compare November 15, 2023 00:35
@rra rra merged commit 7e1ac3a into main Nov 15, 2023
5 checks passed
@rra rra deleted the tickets/DM-41630 branch November 15, 2023 00:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants