Reusable utilities for FastAPI with support sqlalchemy 2.0
Project description
Reusable utilities for FastAPI
Documentation: https://fastapi-utils.davidmontague.xyz
Source Code: https://github.com/dmontagu/fastapi-utils
FastAPI is a modern, fast web framework for building APIs with Python 3.7+.
But if you're here, you probably already knew that!
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
andCamelStrEnum
classes make string-valued enums easier to maintain - CamelCase Conversions: Convenience functions for converting strings from
snake_case
tocamelCase
orPascalCase
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.
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
File details
Details for the file fastapi_utils_sqlalch2-0.3.0.tar.gz
.
File metadata
- Download URL: fastapi_utils_sqlalch2-0.3.0.tar.gz
- Upload date:
- Size: 14.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.4.2 CPython/3.11.1 Darwin/21.2.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e6aa7a258209a14ba3747af01762f1521ddc648465f6153b5cf868eb39772eba |
|
MD5 | eb0cef9a9abddfa223b07f525107c114 |
|
BLAKE2b-256 | 15ecf2f06a969f50cacf79b1d8f2547cfcf889aac11d3819d6f8de2c2895c37b |
File details
Details for the file fastapi_utils_sqlalch2-0.3.0-py3-none-any.whl
.
File metadata
- Download URL: fastapi_utils_sqlalch2-0.3.0-py3-none-any.whl
- Upload date:
- Size: 16.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.4.2 CPython/3.11.1 Darwin/21.2.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 52faa8c981f3f30d99ca2d026d7241612e6c0f48397425f0f84add10a3fd76a9 |
|
MD5 | e9bc4d5c93966bb9dbe5994bfa1098c8 |
|
BLAKE2b-256 | 1dec5532b4afd3ac1ff1f4723346b67196f266852c9b836fd1949af5c74b7fff |