MonaDB
An embedded document store with Python dict semantics, built on redb. Documents are stored as BSON.
pip install monadb
import monadb
db = monadb.open("app.db") # or monadb.open() for in-memory
db["users"]["alice"] = {"age": 30}
db["users"]["alice"] # {"age": 30}
"alice" in db["users"]
len(db["users"])
del db["users"]["alice"]
Every operation is its own commit. update() is one commit for the whole
mapping, so a bad item leaves nothing behind:
db["users"].update({"bob": {"age": 41}, "cy": {"age": 9}})
Ordered operations
Keys use an order-preserving encoding, so the b-tree's ordering is directly available:
events.range(start, stop) # half-open [start, stop); None means unbounded
events.prefix("2026-08") # str/bytes prefix, or a tuple of leading components
events.first(); events.last()
reversed(events)
Models
A collection is plain-dict by default and can be bound to a type. Binding is a property of the handle — nothing about the type is stored, so the same data is always readable as dicts.
from dataclasses import dataclass
@dataclass
class User:
name: str
age: int
users = db.collection("users", User)
users["alice"] = User(name="alice", age=30)
users["alice"] # User(name='alice', age=30)
db["users"]["alice"] # {"name": "alice", "age": 30}
pydantic models work the same way, recognized by shape — MonaDB never imports pydantic.
How it differs from dict
- Iteration is key order, not insertion order.
- Keys are
str | int | bytes | tupleof those.float,bool, andNoneraiseTypeError; anintoutside 64 bits raisesValueError. - Values must be mappings — a dict, dataclass instance, or model.
keys(),values(),items()are snapshot iterators, not live views."a"and("a",)are the same key — a scalar is a 1-component tuple.
Concurrency
Readers never block: redb is MVCC, so an open iterator keeps its own snapshot. Writers serialize — a second writer waits for the first to commit.
Only one process may open a database for writing. redb takes an exclusive file lock; several processes may open the same file read-only. This is the one capability 0.2 gives up relative to 0.1, which used LMDB.
Durability
durable=False trades commit durability for speed, which suits bulk loads:
db = monadb.open("app.db", durable=False)
Exceptions
monadb.Error covers storage faults and use of a closed database. Everything
else is a Python builtin — KeyError, TypeError, ValueError.
Requirements
Python 3.9+. Building from source needs Rust 1.85+ (edition 2024).
Versions
0.2 is a rewrite. The SQL engine MonaDB shipped through 0.1 is preserved under
the v0.1.0-sql git tag, and pip install "monadb<0.2" still installs it.
Databases written by 0.1 cannot be read by 0.2.
License
Apache-2.0 — see LICENSE.
Metadata
Release files for monadb 0.2.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 | |
|---|---|---|---|
| monadb-0.2.0.tar.gz | 85.6 kB | Details |
Built distributions (wheels)
| File | Reset | |||
|---|---|---|---|---|
| monadb-0.2.0-cp39-abi3-win_amd64.whl | CPython 3.9 | abi3 | Windows x86-64 | Details |
| monadb-0.2.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl | CPython 3.9 | abi3 | Linux glibc 2.17+ x86-64 | Details |
| monadb-0.2.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl | CPython 3.9 | abi3 | Linux glibc 2.17+ ARM64 | Details |
| monadb-0.2.0-cp39-abi3-macosx_11_0_arm64.whl | CPython 3.9 | abi3 | macOS 11.0+ ARM64 | Details |
| monadb-0.2.0-cp39-abi3-macosx_10_12_x86_64.whl | CPython 3.9 | abi3 | macOS 10.12+ x86-64 | Details |
Total release size: 3.4 MB
Release files / monadb-0.2.0.tar.gz
| Download URL | monadb-0.2.0.tar.gz |
|---|---|
| Size | 85.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9f00231f7005838a20d4ba9d33e90bd5fdf1fce61e4e399cc6033cb436ccd042
|
|
BLAKE2b-256 checksum How to use checksums |
7c1c4a0ab2eb24f959fc51e527265de6185a79175f283bbf82f250fa34514e05
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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 Aug 3, 2026.
Transparency logRelease files / monadb-0.2.0-cp39-abi3-win_amd64.whl
| Download URL | monadb-0.2.0-cp39-abi3-win_amd64.whl |
|---|---|
| Size | 555.3 kB |
| Tags | CPython 3.9 Windows x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
7c41a23f383b89507127dc895ceb00133bc1dbcd7933789119456008405e21b0
|
|
BLAKE2b-256 checksum How to use checksums |
e3a71697a1f44a2313ab83e5474a2f3f95046c50842793c800072f482fa8bac1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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 Aug 3, 2026.
Transparency logRelease files / monadb-0.2.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | monadb-0.2.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 739.1 kB |
| Tags | CPython 3.9 Linux glibc 2.17+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
68c3da5d86222faf2b72b3073dea2e2a9e2a104833d0bce6b51f01d3fcb95bba
|
|
BLAKE2b-256 checksum How to use checksums |
f7fa2d7175b4b9e9129267c3c5142cc6c3a9584ac957fffe0999dadd1d20a549
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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 Aug 3, 2026.
Transparency logRelease files / monadb-0.2.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
| Download URL | monadb-0.2.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl |
|---|---|
| Size | 703.6 kB |
| Tags | CPython 3.9 Linux glibc 2.17+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
f99dbd8e3b8e813d796f35fb6d26131d141a88639ccabe7e772f6435467fc6cc
|
|
BLAKE2b-256 checksum How to use checksums |
3ecd6806fe3a4d95739c0625efbe8b55cde81cf3dee33e23984c6f08a9af8f7a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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 Aug 3, 2026.
Transparency logRelease files / monadb-0.2.0-cp39-abi3-macosx_11_0_arm64.whl
| Download URL | monadb-0.2.0-cp39-abi3-macosx_11_0_arm64.whl |
|---|---|
| Size | 650.1 kB |
| Tags | CPython 3.9 abi3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
deba40f5e5119af880c17cc9cd0a65fdfb82262c65a6c9de351ed8a0bbf2447a
|
|
BLAKE2b-256 checksum How to use checksums |
42b25ee29ab4ee77a37ea359e21a1c7652660ee34bea75f845a8664fb74adb82
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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 Aug 3, 2026.
Transparency logRelease files / monadb-0.2.0-cp39-abi3-macosx_10_12_x86_64.whl
| Download URL | monadb-0.2.0-cp39-abi3-macosx_10_12_x86_64.whl |
|---|---|
| Size | 678.2 kB |
| Tags | CPython 3.9 abi3 macOS 10.12+ x86-64 |
|
SHA-256 checksum How to use checksums |
8d364178b2377d3ea950398af04b3a9ecf94b5f2ec2807d440ca184bdbfbbefb
|
|
BLAKE2b-256 checksum How to use checksums |
28f4f7e57e1530121f7c56e5ad9a17c3d4f279fe9668a39ce2b663bd2665e8d7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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 Aug 3, 2026.
Transparency log