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
Pydanticv2+. - 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.
Metadata
Release files for motorhead 0.2501.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| motorhead-0.2501.2.tar.gz | 18.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| motorhead-0.2501.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 40.5 kB
Release files / motorhead-0.2501.2.tar.gz
| Download URL | motorhead-0.2501.2.tar.gz |
|---|---|
| Size | 18.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
583b9c063086bf5f90ebb31204d08044eb4f49fbd1c50c7031147e9e08b806bd
|
|
BLAKE2b-256 checksum How to use checksums |
1d677b0bb81410cd8353db454ee2983a2d058b81cce7f7b1e6b788884c5f2b2c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.0.1 CPython/3.12.8
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jan 18, 2025.
Transparency logRelease files / motorhead-0.2501.2-py3-none-any.whl
| Download URL | motorhead-0.2501.2-py3-none-any.whl |
|---|---|
| Size | 21.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e22ce3e9490eabb4d9df52d9abf842d9e0f3febeb58e2ab1d6c115f4db55b6ea
|
|
BLAKE2b-256 checksum How to use checksums |
f893fccc25af3d871c10451c79e71a7cbe6b00062ccee42d349b9f818931ebc7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.0.1 CPython/3.12.8
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jan 18, 2025.
Transparency log