An utils package for fastapi
Project description
Fastapi Helpers
This pip packages will help you to make your life easier when working with fastapi and ormar.
For installing this package:
pip install fastapi-helpers
If you need a default settings for your app, it includes an implemntation BaseSettings of pydantic.
from fastapi_helpers import DefaultSettings
from utils import env_path
from typing import Optional
class Settings(DefaultSettings):
app_name = "your-app-name"
redis_url: Optional[str] = 'redis://localhost:6379'
version: Optional[str] = '1.0.0.0'
port: Optional[str] = "8000"
env: Optional[str] = "dev" #dev, test, prod
settings = Settings(env_path)
If you need a logger, it includes an implemntation a colored console, and in prod envs it will log to aws with the help of watchtower.
from fastapi_helpers import DefaultLogger
from .config import settings
logger = DefaultLogger("your-app-name", settings)
If you need to connect to a db super fast, the only thing you need to do is to:
from fastapi_helpers import DbConfig
from core.config import settings
from core.logger import logger
db_config = DbConfig(settings, logger)
The are other tools for making the usage of ormar and fastapi even easier.
I would realy like to make this tools bigger, but I´m looking for help for documenting this package.
Happy codding!
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_helpers-0.0.9-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ed50018673f222322de1c49f93d9d2769e2ae78b176ff936db51fae5c7843bd5 |
|
MD5 | b147d85378ffb1517fe7dc650c4509c7 |
|
BLAKE2b-256 | 7b61cbc55f5c4fbe64d2fdb66a2da16a473d2af2a08eaa1739b411a67d8891d6 |