Skip to main content

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 and shutdown_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


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.1.tar.gz (23.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

fastapi_booster-0.2.1-py3-none-any.whl (29.0 kB view details)

Uploaded Python 3

File details

Details for the file fastapi_booster-0.2.1.tar.gz.

File metadata

  • Download URL: fastapi_booster-0.2.1.tar.gz
  • Upload date:
  • Size: 23.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.4 CPython/3.12.3 Linux/5.15.167.4-microsoft-standard-WSL2

File hashes

Hashes for fastapi_booster-0.2.1.tar.gz
Algorithm Hash digest
SHA256 9e913bc6b67e13567f9d0a068a75be1545a46335857b256aac510c86bcdbb523
MD5 485b34b56b4172e53fa73bcae4e1a913
BLAKE2b-256 a056424044bb9be4c538c426eb9a66e7fe3d682f7d4fc51266b38cfb5abbec1c

See more details on using hashes here.

File details

Details for the file fastapi_booster-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: fastapi_booster-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 29.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.4 CPython/3.12.3 Linux/5.15.167.4-microsoft-standard-WSL2

File hashes

Hashes for fastapi_booster-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 b70942227fb6a7969cb331b5f34d920ac865e45139f509681b3db7ed616b271f
MD5 6512773669f01425482c13639a26e22d
BLAKE2b-256 9a0e85b4baa5606d966ca5a03e9216dcfc052f51c82ec5f26d66bace739b6f8d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page