Skip to main content

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fastapi_helpers-0.0.13.tar.gz (9.8 kB view details)

Uploaded Source

Built Distribution

fastapi_helpers-0.0.13-py3-none-any.whl (13.8 kB view details)

Uploaded Python 3

File details

Details for the file fastapi_helpers-0.0.13.tar.gz.

File metadata

  • Download URL: fastapi_helpers-0.0.13.tar.gz
  • Upload date:
  • Size: 9.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9

File hashes

Hashes for fastapi_helpers-0.0.13.tar.gz
Algorithm Hash digest
SHA256 bc7e25526ce0c7626f7e04ebab7d09fa5e4e56c089f32592a6715051171c8d2c
MD5 27ed7c0b7caa0fc375835fc68a03a8e0
BLAKE2b-256 06b7b83caca4999b658bafdfd4984e24f0e0d45c1bb1d02ff0437341fe1571e9

See more details on using hashes here.

Provenance

File details

Details for the file fastapi_helpers-0.0.13-py3-none-any.whl.

File metadata

  • Download URL: fastapi_helpers-0.0.13-py3-none-any.whl
  • Upload date:
  • Size: 13.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9

File hashes

Hashes for fastapi_helpers-0.0.13-py3-none-any.whl
Algorithm Hash digest
SHA256 d87c4be6b579c62bb776052763a1d87fc55b5dc0198fcd2e2a9f683b90f6f0de
MD5 646719795e2bdef02fafa455d94467ff
BLAKE2b-256 2a2b49cd0a9f60396e806d8f0acb31401ae2a541e9693b5403c8aec43e94f47b

See more details on using hashes here.

Provenance

Supported by

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