Skip to main content

Reusable utilities for FastAPI

Project description

Reusable utilities for FastAPI

Build Coverage Netlify status
Package version


Documentation: https://fastapi-utils.davidmontague.xyz

Source Code: https://github.com/dmontagu/fastapi-utils


This is a forked version of fatapi-utils developped by David Montagu.


Features

This package includes a number of utilities to help reduce boilerplate and reuse common functionality across projects:

  • Class Based Views: Stop repeating the same dependencies over and over in the signature of related endpoints.
  • Response-Model Inferring Router: Let FastAPI infer the response_model to use based on your return type annotation.
  • Repeated Tasks: Easily trigger periodic tasks on server startup
  • Timing Middleware: Log basic timing information for every request
  • SQLAlchemy Sessions: The FastAPISessionMaker class provides an easily-customized SQLAlchemy Session dependency
  • OpenAPI Spec Simplification: Simplify your OpenAPI Operation IDs for cleaner output from OpenAPI Generator

It also adds a variety of more basic utilities that are useful across a wide variety of projects:

  • APIModel: A reusable pydantic.BaseModel-derived base class with useful defaults
  • APISettings: A subclass of pydantic.BaseSettings that makes it easy to configure FastAPI through environment variables
  • String-Valued Enums: The StrEnum and CamelStrEnum classes make string-valued enums easier to maintain
  • CamelCase Conversions: Convenience functions for converting strings from snake_case to camelCase or PascalCase and back
  • GUID Type: The provided GUID type makes it easy to use UUIDs as the primary keys for your database tables

See the docs for more details and examples.

Requirements

This package is intended for use with any recent version of FastAPI (depending on pydantic>=1.0), and Python 3.7+.

Installation

pip install fastapi-utils

License

This project is licensed under the terms of the MIT license.

Download files

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

Source Distribution

fastapi_utils_evo-0.2.2.tar.gz (14.7 kB view details)

Uploaded Source

Built Distribution

fastapi_utils_evo-0.2.2-py3-none-any.whl (16.3 kB view details)

Uploaded Python 3

File details

Details for the file fastapi_utils_evo-0.2.2.tar.gz.

File metadata

  • Download URL: fastapi_utils_evo-0.2.2.tar.gz
  • Upload date:
  • Size: 14.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.2.2 CPython/3.10.6 Darwin/21.2.0

File hashes

Hashes for fastapi_utils_evo-0.2.2.tar.gz
Algorithm Hash digest
SHA256 ac4747fd84e58c923516cae56da13a5dd97511341f3ecfa5e4c99654934d4dd1
MD5 e8ef74d178ec0db1ace3d83ea2281667
BLAKE2b-256 7f5180487501a1760d32d5303f88f21254044d2df9e2311e4f7042774cc0bd36

See more details on using hashes here.

File details

Details for the file fastapi_utils_evo-0.2.2-py3-none-any.whl.

File metadata

File hashes

Hashes for fastapi_utils_evo-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 eff1ab8f4903fbc17e97500a138f08efad12ddedf08d54cc8337ea464b16db2f
MD5 50456fb91a268991df0ca685eae4bcff
BLAKE2b-256 5f3870fd065602d23544869bede52752fe6677660f006db08ad12912d1107dd1

See more details on using hashes here.

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