Name | fastapi-deferred-init JSON |
Version |
0.2.7
JSON |
| download |
home_page | None |
Summary | Faster FastAPI start-up time for Projects with many nested routers |
upload_time | 2024-10-12 17:45:20 |
maintainer | None |
docs_url | None |
author | None |
requires_python | >=3.9 |
license | MIT |
keywords |
fastapi
speed
router
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# fastapi-deferred-init
![PyPI - Downloads](https://img.shields.io/pypi/dd/fastapi-deferred-init)
[![GitHub license](https://img.shields.io/github/license/jvllmr/fastapi-deferred-init)](https://github.com/jvllmr/fastapi-deferred-init/blob/master/LICENSE)
![Tests](https://github.com/jvllmr/fastapi-deferred-init/actions/workflows/test.yml/badge.svg)
## 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.
## Pull Request
I created a pull request to merge this change back into FastAPI: https://github.com/tiangolo/fastapi/pull/10589
Raw data
{
"_id": null,
"home_page": null,
"name": "fastapi-deferred-init",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.9",
"maintainer_email": null,
"keywords": "fastapi, speed, router",
"author": null,
"author_email": "Jan Vollmer <jan@vllmr.dev>",
"download_url": "https://files.pythonhosted.org/packages/52/42/1f660a81e5248cb256b50b8ba69f1424655a8a713d6bd3fba1ea160cc03b/fastapi_deferred_init-0.2.7.tar.gz",
"platform": null,
"description": "# fastapi-deferred-init\n\n![PyPI - Downloads](https://img.shields.io/pypi/dd/fastapi-deferred-init)\n[![GitHub license](https://img.shields.io/github/license/jvllmr/fastapi-deferred-init)](https://github.com/jvllmr/fastapi-deferred-init/blob/master/LICENSE)\n![Tests](https://github.com/jvllmr/fastapi-deferred-init/actions/workflows/test.yml/badge.svg)\n\n## The Problem\n\nWhen using nested routers in a FastAPI project its start-up time can get long quite fast.\nThat 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.\n\n## The Solution\n\nThis 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.\n\n## Caveat\n\nWhen 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.\n\n## Pull Request\n\nI created a pull request to merge this change back into FastAPI: https://github.com/tiangolo/fastapi/pull/10589\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Faster FastAPI start-up time for Projects with many nested routers",
"version": "0.2.7",
"project_urls": {
"Source": "https://github.com/jvllmr/fastapi-deferred-init"
},
"split_keywords": [
"fastapi",
" speed",
" router"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "34a0be21bb0afd41867060f440f57a5bff14bdf2495ace868ed27f3d8dfe6cef",
"md5": "df1e8cc1a6e9416c75fd8eaea99a3755",
"sha256": "3060b53cb4473eb3b14d08c17223e32687c664b9c0ebf9e08e47c45c524e4216"
},
"downloads": -1,
"filename": "fastapi_deferred_init-0.2.7-py3-none-any.whl",
"has_sig": false,
"md5_digest": "df1e8cc1a6e9416c75fd8eaea99a3755",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.9",
"size": 5581,
"upload_time": "2024-10-12T17:45:19",
"upload_time_iso_8601": "2024-10-12T17:45:19.777078Z",
"url": "https://files.pythonhosted.org/packages/34/a0/be21bb0afd41867060f440f57a5bff14bdf2495ace868ed27f3d8dfe6cef/fastapi_deferred_init-0.2.7-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "52421f660a81e5248cb256b50b8ba69f1424655a8a713d6bd3fba1ea160cc03b",
"md5": "bf59a7a6936bfb95ddff5e5dd2e0d04d",
"sha256": "8f13a7121bfaaed2922db4e11c191f2783b4e557faf257e1f5d4dbcee95cc172"
},
"downloads": -1,
"filename": "fastapi_deferred_init-0.2.7.tar.gz",
"has_sig": false,
"md5_digest": "bf59a7a6936bfb95ddff5e5dd2e0d04d",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9",
"size": 7794,
"upload_time": "2024-10-12T17:45:20",
"upload_time_iso_8601": "2024-10-12T17:45:20.944859Z",
"url": "https://files.pythonhosted.org/packages/52/42/1f660a81e5248cb256b50b8ba69f1424655a8a713d6bd3fba1ea160cc03b/fastapi_deferred_init-0.2.7.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-10-12 17:45:20",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "jvllmr",
"github_project": "fastapi-deferred-init",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "fastapi-deferred-init"
}