Async MongoDB with vanilla Pydantic v2+ - made easy.
Project description
Source code: https://github.com/volfpeter/motorhead
Documentation and examples: https://volfpeter.github.io/motorhead
Motorhead
Async MongoDB with vanilla Pydantic v2+ - made easy.
Key features:
- Database model and API design with vanilla
Pydantic
v2+. - Relationship support and validation using async validators and delete rules with a declarative, decorator-based syntax.
- ODM-like query builder for convenient, typed, and Pythonic query construction.
- Declarative index specification.
- Typed utilities for convenient model and API creation.
- Ready to use, customizable async service layer with transaction support that integrates all the above to keep your API and business logic clean, flexible, and easy to understand.
- Simplicity: by not being a classic ODM, the codebase is very simple and easy to understand (even contribute to) even for relative beginners.
By providing a convenient, declarative middle layer between MongoDB and your API, motorhead
is halfway between an object document mapper (based on vanilla Pydantic
) and a database driver (by wrapping the official, async motor
driver). What's missing is the built-in ODM performance and memory overhead, whose benefits are rarely felt when working with document databases.
See the full documentation here.
Installation
The library is available on PyPI and can be installed with:
$ pip install motorhead
Examples
See the documentation for usage and application examples.
Requirements
The project depends on motor
(the official asyncio MongoDB driver, which is built on top of pymongo
and bson
) and pydantic
v2+.
Development
Use black
for code formatting, mypy
for static code analysis, ruff
for linting, and pytest
(with pytest-asyncio
and pytest-docker
) for testing.
The documentation is built with mkdocs-material
and mkdocstrings
.
Contributing
All contributions are welcome.
Notes
This project is the continuation of fastapi-motor-oil with support for Pydantic v2, among other improvements. Migration from fastapi-motor-oil
should be easy, but if you need help, just create an issue in the issue tracker.
License - MIT
The library is open-sourced under the conditions 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 motorhead-0.2411.0.tar.gz
.
File metadata
- Download URL: motorhead-0.2411.0.tar.gz
- Upload date:
- Size: 18.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 03879a521d15a15f99d270a223d7bd36c4b7c219494883e73eeb497b71055952 |
|
MD5 | cbde768171e35bc21a645e8adf74f84f |
|
BLAKE2b-256 | 42d3c0e13097a340461601a6f2f29ae7e212da9ecc0730c25f78f78c39bb7ae7 |
Provenance
The following attestation bundles were made for motorhead-0.2411.0.tar.gz
:
Publisher:
publish.yml
on volfpeter/motorhead
-
Statement type:
https://in-toto.io/Statement/v1
- Predicate type:
https://docs.pypi.org/attestations/publish/v1
- Subject name:
motorhead-0.2411.0.tar.gz
- Subject digest:
03879a521d15a15f99d270a223d7bd36c4b7c219494883e73eeb497b71055952
- Sigstore transparency entry: 147808763
- Sigstore integration time:
- Predicate type:
File details
Details for the file motorhead-0.2411.0-py3-none-any.whl
.
File metadata
- Download URL: motorhead-0.2411.0-py3-none-any.whl
- Upload date:
- Size: 20.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7339a254f5f3071bfc341288c720d17a9288b9065d79f1e619afe69d6940d51d |
|
MD5 | 183ac40f00fc67f22807fde5c5c9d784 |
|
BLAKE2b-256 | 926df52dd8a53e8efe14e76ca3ec07c8673befd29b12426ae6cdd8c38cdfc07e |
Provenance
The following attestation bundles were made for motorhead-0.2411.0-py3-none-any.whl
:
Publisher:
publish.yml
on volfpeter/motorhead
-
Statement type:
https://in-toto.io/Statement/v1
- Predicate type:
https://docs.pypi.org/attestations/publish/v1
- Subject name:
motorhead-0.2411.0-py3-none-any.whl
- Subject digest:
7339a254f5f3071bfc341288c720d17a9288b9065d79f1e619afe69d6940d51d
- Sigstore transparency entry: 147808765
- Sigstore integration time:
- Predicate type: