FastAPI Booster
FastAPI Booster is a library that provides a set of tools and utilities to enhance the development experience with FastAPI. It aims to streamline common tasks, provide additional functionality, and make the development process more efficient.
This work is licensed under CC BY-NC-ND 4.0. To view a copy of this license, visit https://creativecommons.org/licenses/by-nc-nd/4.0/
Features
- Authenticator: Built-in support for JWT and HTTP Basic authentication.
- Module: Built-in support for Module, aka microservice with independent database and router.
- Lifespan Manager: Easy to manage the lifespan of the application, with
startup_functionandshutdown_functiondecorator. - Certificate Manager: Utility to manage certificates and keys.
- Akatosh: Built-in support for Akatosh, a powerful tool for managing server side real time tasks.
Example
import uvicorn
from fastapi import Depends, FastAPI
from fastapi_booster.LifeSpanManager import lifespan
from fastapi_booster.Authenticator import JWT
from fastapi_booster.Module import Module
from sqlalchemy.orm import MappedColumn, mapped_column
# Create the FastAPI app with the lifespan manager
app = FastAPI(lifespan=lifespan)
# Create the JWT authenticator
jwt = JWT.JWT()
# Include the JWT router in the FastAPI app
app.include_router(jwt.router)
# Create the root route with the JWT authenticator
@app.get("/", dependencies=[Depends(jwt)])
async def root():
return {"message": "Hello World"}
# Create the my_module
my_module = Module("my_module", "This is my module")
# Create the my_table
class my_table(my_module.model):
__tablename__ = "my_table"
id: MappedColumn[int] = mapped_column(primary_key=True)
name: MappedColumn[str] = mapped_column()
age: MappedColumn[int] = mapped_column()
gender: MappedColumn[str] = mapped_column()
# Create the my_module root route
@my_module.router.get("/my_module")
async def my_module_root():
return {"message": "Hello World from my_module"}
# Include the my_module router in the FastAPI app
app.include_router(my_module.router)
if __name__ == "__main__":
uvicorn.run(app, host="0.0.0.0", port=8000)
Metadata
Release files for fastapi-booster 0.2.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| fastapi_booster-0.2.1.tar.gz | 23.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| fastapi_booster-0.2.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 52.6 kB
Release files / fastapi_booster-0.2.1.tar.gz
| Download URL | fastapi_booster-0.2.1.tar.gz |
|---|---|
| Size | 23.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9e913bc6b67e13567f9d0a068a75be1545a46335857b256aac510c86bcdbb523
|
|
BLAKE2b-256 checksum How to use checksums |
a056424044bb9be4c538c426eb9a66e7fe3d682f7d4fc51266b38cfb5abbec1c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.4 CPython/3.12.3 Linux/5.15.167.4-microsoft-standard-WSL2
|
Release files / fastapi_booster-0.2.1-py3-none-any.whl
| Download URL | fastapi_booster-0.2.1-py3-none-any.whl |
|---|---|
| Size | 29.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b70942227fb6a7969cb331b5f34d920ac865e45139f509681b3db7ed616b271f
|
|
BLAKE2b-256 checksum How to use checksums |
9a0e85b4baa5606d966ca5a03e9216dcfc052f51c82ec5f26d66bace739b6f8d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.4 CPython/3.12.3 Linux/5.15.167.4-microsoft-standard-WSL2
|