Faster FastAPI start-up time for Projects with many nested routers
Project description
fastapi-deferred-init
The Problem
When using nested routers in a FastAPI project its start-up time can get long quite fast. That is because every router re-calculates the routes defined by a nested router when including it and the pre-calculated values by the nested router never get used. In short: values in nested routers are calculated although they will never be used.
The Solution
This library provides a modified APIRoute that defers the calculation of values to the first actual attribute access. A router which uses the route as a default is also provided.
Caveat
When using the deferred APIRoute on every layer of the app, startup errors are deferred to the first time a route is called. So errors related to route registration might go undetected if the route is not tested at least once.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for fastapi_deferred_init-0.2.2.post1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2754a4a0704623c091f100d3393f451d919605d502418d68441c6b4595026cc9 |
|
MD5 | 498c04481f2d0dee7f2dd0db88b1e741 |
|
BLAKE2b-256 | b8663fa0a43c68d4adc07b3d968bc609371fbb77dc60704b7454725ee43e32dd |
Hashes for fastapi_deferred_init-0.2.2.post1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 34d28d2844240451c68ab254d6d3079a9f8ad451dfab3b1d50e0c85d0135c5c0 |
|
MD5 | d43b20af9eafae488e6258a486b8edf2 |
|
BLAKE2b-256 | ba9c15903cc07513c197795bb0e3ebe362e5db1c0899cd29435ef62faefe0659 |