Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/dmontagu/fastapi-utils
Reusable utilities for FastAPI
https://github.com/dmontagu/fastapi-utils
fastapi
Last synced: 2 months ago
JSON representation
Reusable utilities for FastAPI
- Host: GitHub
- URL: https://github.com/dmontagu/fastapi-utils
- Owner: dmontagu
- License: mit
- Created: 2020-01-19T22:34:25.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2023-09-11T14:52:23.000Z (over 1 year ago)
- Last Synced: 2024-01-16T10:49:56.364Z (11 months ago)
- Topics: fastapi
- Language: Python
- Size: 158 KB
- Stars: 1,643
- Watchers: 16
- Forks: 158
- Open Issues: 59
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
- awesome-fastapi - FastAPI Utilities - Reusable utilities: class-based views, response inferring router, periodic tasks, timing middleware, SQLAlchemy session, OpenAPI spec simplification. (Third-Party Extensions / Utils)
- awesome-fastapi - FastAPI Utilities - Reusable utilities: class-based views, response inferring router, periodic tasks, timing middleware, SQLAlchemy session, OpenAPI spec simplification. (Third-Party Extensions / Utils)
- best-of-web-python - GitHub - 70% open · ⏱️ 04.06.2024): (FastAPI Utilities)
README
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` 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 tablesSee the [docs](https://fastapi-utils.davidmontague.xyz/) 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
```bash
pip install fastapi-utils # For basic slim package :)pip install fastapi-utils[session] # To add sqlalchemy session maker
pip install fastapi-utils[all] # For all the packages
```## License
This project is licensed under the terms of the MIT license.