Reusable utilities for FastAPI
Project description
Quicker FastApi developing tools
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:
- Resource Class: Create CRUD with ease the OOP way with
Resource
base class that lets you implement methods quick. - Class Based Views: Stop repeating the same dependencies over and over in the signature of related endpoints.
- Repeated Tasks: Easily trigger periodic tasks on server startup
- Timing Middleware: Log basic timing information for every request
- OpenAPI Spec Simplification: Simplify your OpenAPI Operation IDs for cleaner output from OpenAPI Generator
- SQLAlchemy Sessions: The
FastAPISessionMaker
class provides an easily-customized SQLAlchemy Session dependency
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-restful # For basic slim package :)
pip install fastapi-restful[session] # To add sqlalchemy session maker
pip install fastapi-restful[all] # For all the packages
License
This project is licensed under the terms of the MIT license.
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
Built Distribution
File details
Details for the file fastapi_utils-0.6.0.tar.gz
.
File metadata
- Download URL: fastapi_utils-0.6.0.tar.gz
- Upload date:
- Size: 16.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.5.1 CPython/3.10.12 Linux/5.15.146.1-microsoft-standard-WSL2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4fd34ff7d3bcc8e31fd5c5a9c66c16ca09093e3d97663ed7e3bf013b380766a9 |
|
MD5 | 16d141202bdb04030829d712a9945e8f |
|
BLAKE2b-256 | ebb7a8334f16b18f11d3200139c978cab5b90e7cbbd3aee518d4b452c67d2f01 |
File details
Details for the file fastapi_utils-0.6.0-py3-none-any.whl
.
File metadata
- Download URL: fastapi_utils-0.6.0-py3-none-any.whl
- Upload date:
- Size: 18.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.5.1 CPython/3.10.12 Linux/5.15.146.1-microsoft-standard-WSL2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8d504d8f88b9cd0f3834e8f8e0545cb890e3bbe661e44fdb4533bb3734610cb7 |
|
MD5 | 5295488806809bc938d0b452dc9fffec |
|
BLAKE2b-256 | e7ccc0e6ea8148657eec5d2857e55bd827ceefbf14321fe5840e5f8982d5e791 |