Skip to main content

bsondb

PyPI version Python versions License: MIT

An embedded, file-backed document database for Python with a PyMongo-like local API (BsonDBClient, Database, Collection, ObjectId), built on a native C BSON serialization engine, an mmap-backed storage engine, and a persisted on-disk B-Tree index.

There is no network protocol and no real mongod involved — BsonDBClient is a local facade over BSON documents stored in memory-mapped files on disk.

  • License: MIT
  • Python: 3.10+
  • Dependencies: none (stdlib + native extension only)

Table of contents

Features

Area What's implemented
BSON codec encode(dict) -> bytes / decode(bytes) -> dict, ObjectId, full exception hierarchy
Storage engine Append-only, mmap-backed collection data file per collection, with crash recovery on unclean shutdown
Collection API Insert, find, update, replace, delete, count/distinct, drop, compact (see table below)
Indexing Persisted on-disk B+Tree per indexed field, used to accelerate equality queries and enforce unique constraints

Quickstart

pip install -e ".[dev]"
import bsondb

client = bsondb.BsonDBClient("./data")
coll = client.mydb.people

coll.create_index("age")
coll.insert_many([{"name": "Ada", "age": 36}, {"name": "Bo", "age": 20}])
print(list(coll.find({"age": {"$gte": 30}})))

coll.update_one({"name": "Ada"}, {"$set": {"age": 37}})
coll.delete_one({"name": "Bo"})
client.close()

Supported operations

Category Methods / operators
Insert insert_one, insert_many
Query find, find_one — dot-notation fields, projection, skip/limit
Query operators $eq, $ne, $gt, $gte, $lt, $lte, $in, $nin, $and, $or, $not
Update update_one, update_many ($set, $unset, $inc, upsert), replace_one
Find-and-modify find_one_and_update, find_one_and_delete, find_one_and_replace
Delete delete_one, delete_many
Aggregation count_documents, estimated_document_count, distinct
Maintenance drop, compact
Indexing create_index, drop_index, list_indexes

Development

Quickest path, using Task:

task install   # create .venv and pip install -e ".[dev]"
task test      # run the Python and C test suites

Without Task:

# Install with dev dependencies and run the Python test suite
pip install -e ".[dev]"
pytest tests/python_tests/ -v

# Optional: smoke-build the standalone C engine + C test executables
cmake -S . -B build -DBUILD_TESTING=ON && cmake --build build
ctest --test-dir build --output-on-failure

For OS-specific prerequisites (C compiler, Task, CMake), the full Taskfile.yml task reference, and a walkthrough of how a document flows through the codebase, see docs/development.md.

Project layout

Path Contents
include/custom_bson/ Public C headers (BSON engine, mmap abstraction, storage/record format, B-Tree index)
src/c_engine/ Storage/BSON engine implementation (pure C11, no Python dependency)
src/python_bindings/ CPython C-API bindings: _bson_core.c (encode/decode), _storage_core.c (storage/index)
python/bsondb/ Pure-Python package: ObjectId, exceptions, BsonDBClient/Database/Collection, query/index/cursor logic
tests/ C and Python test suites
docs/ Wire protocol spec and API reference

Documentation

Scope limits

  • Single-process access only
  • Single-field indexes only
  • Index acceleration applies to equality queries only

See docs/api_reference.md for full details.

License

MIT

Metadata

Release files for bsondb 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for bsondb 0.1.0
File Size Uploaded Provenance Actions
bsondb-0.1.0.tar.gz 51.1 kB With provenance Details for bsondb-0.1.0.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for bsondb 0.1.0
File Actions
bsondb-0.1.0-cp314-cp314-win_amd64.whl CPython 3.14 CPython 3.14 Windows x86-64 Details for bsondb-0.1.0-cp314-cp314-win_amd64.whl
bsondb-0.1.0-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl CPython 3.14 CPython 3.14 Linux glibc 2.17+ x86-64, Linux glibc 2.28+ x86-64 Details for bsondb-0.1.0-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
bsondb-0.1.0-cp313-cp313-win_amd64.whl CPython 3.13 CPython 3.13 Windows x86-64 Details for bsondb-0.1.0-cp313-cp313-win_amd64.whl
bsondb-0.1.0-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl CPython 3.13 CPython 3.13 Linux glibc 2.17+ x86-64, Linux glibc 2.28+ x86-64 Details for bsondb-0.1.0-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
bsondb-0.1.0-cp312-cp312-win_amd64.whl CPython 3.12 CPython 3.12 Windows x86-64 Details for bsondb-0.1.0-cp312-cp312-win_amd64.whl
bsondb-0.1.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl CPython 3.12 CPython 3.12 Linux glibc 2.28+ x86-64, Linux glibc 2.17+ x86-64 Details for bsondb-0.1.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
bsondb-0.1.0-cp311-cp311-win_amd64.whl CPython 3.11 CPython 3.11 Windows x86-64 Details for bsondb-0.1.0-cp311-cp311-win_amd64.whl
bsondb-0.1.0-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl CPython 3.11 CPython 3.11 Linux glibc 2.28+ x86-64, Linux glibc 2.17+ x86-64 Details for bsondb-0.1.0-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
bsondb-0.1.0-cp310-cp310-win_amd64.whl CPython 3.10 CPython 3.10 Windows x86-64 Details for bsondb-0.1.0-cp310-cp310-win_amd64.whl
bsondb-0.1.0-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl CPython 3.10 CPython 3.10 Linux glibc 2.17+ x86-64, Linux glibc 2.28+ x86-64 Details for bsondb-0.1.0-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl

Total release size: 1.2 MB

Release files / bsondb-0.1.0.tar.gz

Download URL bsondb-0.1.0.tar.gz
Size 51.1 kB
Tags Source
SHA-256 checksum
How to use checksums
4363c39216e1cd5b611103a101060fbbcc830b39b965bea7f9c8ca335648ff42
BLAKE2b-256 checksum
How to use checksums
c91897f9f09c20bab861b03bd96197a969e0386e8baea68540ed4ab8885330a4
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 26, 2026.

Transparency log

Release files / bsondb-0.1.0-cp314-cp314-win_amd64.whl

Download URL bsondb-0.1.0-cp314-cp314-win_amd64.whl
Size 60.0 kB
Tags CPython 3.14 Windows x86-64
SHA-256 checksum
How to use checksums
7480918c7e7de273c49dc3e704d859c68e9ec485d8c85874e474018c28ce5c59
BLAKE2b-256 checksum
How to use checksums
e63711ad6c00c164f976f5c3e0f17421cbe87c49a94a984a6c7b3646acac449f
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 26, 2026.

Transparency log

Release files / bsondb-0.1.0-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl

Download URL bsondb-0.1.0-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Size 169.5 kB
Tags CPython 3.14 Linux glibc 2.17+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
9add9300a8a52abeb42d79032f7ac004b553c94ab56df860776867f5334b0633
BLAKE2b-256 checksum
How to use checksums
fa418e605597f9f17976cb5daf971f50764533649a4146ce7ad3c3c1c1d3f379
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 26, 2026.

Transparency log

Release files / bsondb-0.1.0-cp313-cp313-win_amd64.whl

Download URL bsondb-0.1.0-cp313-cp313-win_amd64.whl
Size 58.9 kB
Tags CPython 3.13 Windows x86-64
SHA-256 checksum
How to use checksums
d9620b9cd9dcef7a31abdce6595787a40c1b470fd3a047120f8df2a61a479b4d
BLAKE2b-256 checksum
How to use checksums
33ea42d700acd70f1df7fdbc895fe1f9c5263423d2ffe07858437a8db2b3eb1d
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 26, 2026.

Transparency log

Release files / bsondb-0.1.0-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl

Download URL bsondb-0.1.0-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Size 169.3 kB
Tags CPython 3.13 Linux glibc 2.17+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
70bfcc57f215aeabb0d4dd598aa369e0449e39217e6f6309554fd63210155800
BLAKE2b-256 checksum
How to use checksums
c24123068c7502206b62d82dd1fa6dab5b2035fedede6a43c80e4af509df08b4
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 26, 2026.

Transparency log

Release files / bsondb-0.1.0-cp312-cp312-win_amd64.whl

Download URL bsondb-0.1.0-cp312-cp312-win_amd64.whl
Size 58.9 kB
Tags CPython 3.12 Windows x86-64
SHA-256 checksum
How to use checksums
6b5f8bd8a5aaaa72948dbc560abb82949fdc081c668f97282cf618f0e7d88407
BLAKE2b-256 checksum
How to use checksums
ebef271aaca1b52969dd2abb0199f09af477ea016fd8e9eba29b2539986ad8ef
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 26, 2026.

Transparency log

Release files / bsondb-0.1.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl

Download URL bsondb-0.1.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Size 169.3 kB
Tags CPython 3.12 Linux glibc 2.17+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
0ebde39604e35690bcbc9b23e5f64e90514f4c48c6f850020c5e5eecc67d1221
BLAKE2b-256 checksum
How to use checksums
fb66db0ea7ec3db1468eea590fe09dd145d47df44ffc4a2ce423f0e7aa1c8f1e
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 26, 2026.

Transparency log

Release files / bsondb-0.1.0-cp311-cp311-win_amd64.whl

Download URL bsondb-0.1.0-cp311-cp311-win_amd64.whl
Size 58.8 kB
Tags CPython 3.11 Windows x86-64
SHA-256 checksum
How to use checksums
370228d7243ca4f79f0ed82160f8267008854603a3a6dd6f28de053b18c355d7
BLAKE2b-256 checksum
How to use checksums
00dbf0cb33df695a49258d688b65b628deae214362029aa6d9d407c96054a945
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 26, 2026.

Transparency log

Release files / bsondb-0.1.0-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl

Download URL bsondb-0.1.0-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Size 168.8 kB
Tags CPython 3.11 Linux glibc 2.17+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
db279d905756053826fc13ab7b4c8717af6afb7198925557eb880fd8f9573a0b
BLAKE2b-256 checksum
How to use checksums
05cfc96cdd8a711e617954ee674d8b66fccd7b2fb6b7c896cc3ad320608913ed
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 26, 2026.

Transparency log

Release files / bsondb-0.1.0-cp310-cp310-win_amd64.whl

Download URL bsondb-0.1.0-cp310-cp310-win_amd64.whl
Size 58.8 kB
Tags CPython 3.10 Windows x86-64
SHA-256 checksum
How to use checksums
3386afca51d953ba26c010ee078905b8a8e02d8749f13f21d912d40f24dda128
BLAKE2b-256 checksum
How to use checksums
fdf62808510f9024c431814bdc3ff485a57e39153c43fe8fd608949e07fb478e
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 26, 2026.

Transparency log

Release files / bsondb-0.1.0-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl

Download URL bsondb-0.1.0-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Size 167.2 kB
Tags CPython 3.10 Linux glibc 2.17+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
f71598f20a8329c460e604d0053180374eda98f3b207eecb27d25bdb448e5ebc
BLAKE2b-256 checksum
How to use checksums
f84f18e2818fe41c2b2886752d8e70147d1e5794e9362bb767180d3deae392ef
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 26, 2026.

Transparency log

Security for bsondb 0.1.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 11 files in this release have been uploaded with provenance metadata.

Select from 11 files

Attestation for bsondb-0.1.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 Aug 26, 2026.

Transparency log

A 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.

Release history Release notifications | RSS feed

This release

0.1.0 This release

11 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page