μMongo: sync/async ODM
μMongo is a Python MongoDB ODM. Its inception comes from two needs: the lack of async ODM and the difficulty to do document (un)serialization with existing ODMs.
From this point, μMongo made a few design choices:
Stay close to the standards MongoDB driver to keep the same API when possible: use find({"field": "value"}) like usual but retrieve your data nicely OO wrapped !
Work with multiple drivers (PyMongo, TxMongo, motor_asyncio and mongomock for the moment)
Tight integration with Marshmallow serialization library to easily dump and load your data with the outside world
i18n integration to localize validation error messages
Free software: MIT license
Test with 90%+ coverage ;-)
Quick example
import datetime as dt
from pymongo import MongoClient
from umongo import Document, fields, validate
from umongo.frameworks import PyMongoInstance
db = MongoClient().test
instance = PyMongoInstance(db)
@instance.register
class User(Document):
email = fields.EmailField(required=True, unique=True)
birthday = fields.DateTimeField(
validate=validate.Range(min=dt.datetime(1900, 1, 1))
)
friends = fields.ListField(fields.ReferenceField("User"))
class Meta:
collection_name = "user"
# Make sure that unique indexes are created
User.ensure_indexes()
goku = User(email="goku@sayen.com", birthday=dt.datetime(1984, 11, 20))
goku.commit()
vegeta = User(email="vegeta@over9000.com", friends=[goku])
vegeta.commit()
vegeta.friends
# <object umongo.data_objects.List([<object umongo.dal.pymongo.PyMongoReference(document=User, pk=ObjectId('5717568613adf27be6363f78'))>])>
vegeta.dump()
# {id': '570ddb311d41c89cabceeddc', 'email': 'vegeta@over9000.com', friends': ['570ddb2a1d41c89cabceeddb']}
User.find_one({"email": "goku@sayen.com"})
# <object Document __main__.User({'id': ObjectId('570ddb2a1d41c89cabceeddb'), 'friends': <object umongo.data_objects.List([])>,
# 'email': 'goku@sayen.com', 'birthday': datetime.datetime(1984, 11, 20, 0, 0)})>
Get it now:
$ pip install umongo # This installs umongo with pymongo $ pip install my-mongo-driver # Other MongoDB drivers must be installed manually
Or to get it along with the MongoDB driver you’re planing to use:
$ pip install umongo[motor] $ pip install umongo[txmongo] $ pip install umongo[mongomock]
Support umongo
If you’d like to support the future of the project, please consider contributing to Marshmallow’s Open Collective:
Metadata
Release files for umongo 4.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| umongo-4.0.0.tar.gz | 175.6 kB | With provenance | Details for umongo-4.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| umongo-4.0.0-py3-none-any.whl | Python 3 | none | any | Details for umongo-4.0.0-py3-none-any.whl |
Total release size: 220.7 kB
Release files / umongo-4.0.0.tar.gz
| Download URL | umongo-4.0.0.tar.gz |
|---|---|
| Size | 175.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6c9e9d0795924397658f5b013cb0bac96b8e2f562358e40ba10de1143bbe79be
|
|
BLAKE2b-256 checksum How to use checksums |
e6afe012442938077251dda607f4653c4999a9aeb1bcd43889127b23e3d0135e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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 Mar 1, 2026.
Transparency logRelease files / umongo-4.0.0-py3-none-any.whl
| Download URL | umongo-4.0.0-py3-none-any.whl |
|---|---|
| Size | 45.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
34a1ea6ef90fc669d3db657cfd43772da1e7c28539424e250b637d5c734fda4b
|
|
BLAKE2b-256 checksum How to use checksums |
aa87e1723a240bc5785abb25bbd2ec3096710bdd98197b0f29243af7d2d0db94
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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 Mar 1, 2026.
Transparency logSecurity for umongo 4.0.0
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.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for umongo-4.0.0.tar.gz
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 Mar 1, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.