No project description provided
Project description
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_function
andshutdown_function
decorator. - 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)
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
fastapi_booster-0.2.0.tar.gz
(22.7 kB
view details)
Built Distribution
File details
Details for the file fastapi_booster-0.2.0.tar.gz
.
File metadata
- Download URL: fastapi_booster-0.2.0.tar.gz
- Upload date:
- Size: 22.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.4 CPython/3.12.3 Linux/5.15.153.1-microsoft-standard-WSL2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5d1e274f276d7a01e44c560d54cfa5c1061b84c6ba0436df0ee6d2d8f91c7324 |
|
MD5 | 83ee507292883c185ba27b53a2de3a00 |
|
BLAKE2b-256 | b17834a01a7e55b1c28bf9083c854dba4e7ae578734187ce926145bdcd862cf4 |
File details
Details for the file fastapi_booster-0.2.0-py3-none-any.whl
.
File metadata
- Download URL: fastapi_booster-0.2.0-py3-none-any.whl
- Upload date:
- Size: 27.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.4 CPython/3.12.3 Linux/5.15.153.1-microsoft-standard-WSL2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2e6729690c3b19cfb363d75df4e91e2bb2d038e483e53d5ac4fbfec217b7cc11 |
|
MD5 | 2f45d8bcc96f700a04d70394de7a89db |
|
BLAKE2b-256 | 415f68d19928db81accc6f92fae79c48c5ccc87cd7aa76f3e9685756aee2e09c |