Skip to main content

A surrogate single-node MongoDB server in Python using the WiredTiger storage engine

Project description

SecantusDB

Status: alpha Tests: 584 passing License: GPL-2.0-only Python: 3.12+ Documentation Status

[!WARNING] Alpha software — not for production use.

SecantusDB is in early development. The API surface and on-disk format can change between point releases. It exists today as a developer tool for exercising application code against a MongoDB-shaped surrogate; it is not a database for storing data you can't recreate.

A surrogate single-node MongoDB server in Python. SecantusDB speaks the subset of the MongoDB wire protocol that pymongo emits, so test suites can talk to it instead of standing up a real mongod. No binary to install, no port conflicts, parallel-test friendly. Single-node only — replica sets and sharding are out of scope by design.

from pymongo import MongoClient
from secantus import SecantusDBServer

with SecantusDBServer(port=0) as server:
    client = MongoClient(server.uri)
    db = client["mydb"]
    db["users"].insert_one({"_id": 1, "name": "Joe"})
    assert db["users"].find_one({"_id": 1})["name"] == "Joe"

What's in scope

The subset of MongoDB that pymongo actually drives — connection handshake, CRUD, cursors, aggregation, findAndModify — backed by a real query planner with index acceleration (single-field, compound, mixed-direction, partial, TTL, sort), proper explain output (IXSCAN vs COLLSCAN), and a hash-join $lookup.

What's out of scope: replica sets, sharding, change streams, authentication, TLS, text/geo/wildcard indexes, $where, real transaction rollback. If your test depends on those, run a real mongod.

Installation

pip install SecantusDB

Pre-built wheels are published for CPython 3.12 and 3.13 on:

  • macOS arm64 (Apple Silicon)
  • Linux x86_64 and aarch64 (manylinux2014 / glibc, and musllinux_1_2 / Alpine)
  • Windows AMD64

macOS Intel (x86_64) is not in the wheel matrix; use a from-source install if you need it.

WiredTiger is vendored inside the wheel — no separate package, no compile step, no system build tools required.

Building from source (unsupported platforms only)

If your platform isn't in the matrix above, pip install SecantusDB falls back to the sdist and compiles WiredTiger from source. That needs three native build tools on PATH:

  • cmake (>= 3.21)
  • ninja
  • swig (>= 4.0)
Platform Install prerequisites
macOS (Homebrew) brew install cmake ninja swig
Debian/Ubuntu sudo apt-get install -y cmake ninja-build swig
Fedora/RHEL sudo dnf install -y cmake ninja-build swig
Alpine apk add --no-cache cmake ninja swig build-base

See Installation for dev-install instructions.

Examples

A walk through the operations a typical test exercises — connect, insert, index, query, drop. Full version with explanations: examples in the docs.

from pymongo import MongoClient
from secantus import SecantusDBServer

with SecantusDBServer(port=0) as server:
    client = MongoClient(server.uri)
    cellar = client["wine_cellar"]
    bottles = cellar["bottles"]

    # --- Insert ---
    bottles.insert_one(
        {"_id": 1, "name": "Pommard 2018", "region": "Burgundy", "year": 2018}
    )
    bottles.insert_many(
        [
            {"_id": 2, "name": "Brunello 2015", "region": "Tuscany", "year": 2015},
            {"_id": 3, "name": "Barolo 2017", "region": "Piedmont", "year": 2017},
            {"_id": 4, "name": "Pommard 2020", "region": "Burgundy", "year": 2020},
        ]
    )

    # --- Indexes ---
    bottles.create_index([("year", 1)])                     # single-field
    bottles.create_index([("region", 1), ("year", -1)])     # compound

    # --- Query ---
    drinkable_now = list(
        bottles.find({"year": {"$lte": 2018}}).sort("year")
    )
    assert [b["name"] for b in drinkable_now] == [
        "Brunello 2015",
        "Barolo 2017",
        "Pommard 2018",
    ]

    by_region = list(
        bottles.aggregate(
            [
                {"$group": {"_id": "$region", "count": {"$sum": 1}}},
                {"$sort": {"_id": 1}},
            ]
        )
    )

    # --- Drop ---
    bottles.drop()                              # one collection
    client.drop_database("wine_cellar")         # whole database

Documentation

Full docs are in docs/; build them with uv run python -m invoke docs and open docs/_build/html/index.html. Highlights:

  • Quickstart — embedding in tests, running standalone.
  • Architecture — the layered design.
  • Indexes — what find() and aggregate accelerate, explain semantics, hints, partial indexes, TTL.
  • Aggregation — supported pipeline stages and expression operators.
  • Compatibility — the divergences you should know about before you trust SecantusDB for a given test.

Development

git clone https://github.com/jdrumgoole/SecantusDB.git
cd SecantusDB
uv sync --extra dev
uv run python -m pytest    # 584 tests, runs in parallel under pytest-xdist

Common workflows:

uv run python -m invoke fmt    # ruff format
uv run python -m invoke lint   # ruff check
uv run python -m invoke test   # pytest, parallel
uv run python -m invoke docs   # build Sphinx docs (warnings as errors)

License

GPL-2.0-only. See LICENSE. SecantusDB intends to bundle the WiredTiger storage engine (itself GPL-2/GPL-3), so the combined work is GPL.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

secantusdb-0.2.0a2.tar.gz (5.4 MB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

secantusdb-0.2.0a2-cp313-cp313-win_amd64.whl (991.2 kB view details)

Uploaded CPython 3.13Windows x86-64

secantusdb-0.2.0a2-cp313-cp313-musllinux_1_2_x86_64.whl (1.3 MB view details)

Uploaded CPython 3.13musllinux: musl 1.2+ x86-64

secantusdb-0.2.0a2-cp313-cp313-musllinux_1_2_aarch64.whl (1.2 MB view details)

Uploaded CPython 3.13musllinux: musl 1.2+ ARM64

secantusdb-0.2.0a2-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.3 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

secantusdb-0.2.0a2-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (1.2 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ ARM64

secantusdb-0.2.0a2-cp313-cp313-macosx_11_0_arm64.whl (1.1 MB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

secantusdb-0.2.0a2-cp312-cp312-win_amd64.whl (991.4 kB view details)

Uploaded CPython 3.12Windows x86-64

secantusdb-0.2.0a2-cp312-cp312-musllinux_1_2_x86_64.whl (1.3 MB view details)

Uploaded CPython 3.12musllinux: musl 1.2+ x86-64

secantusdb-0.2.0a2-cp312-cp312-musllinux_1_2_aarch64.whl (1.2 MB view details)

Uploaded CPython 3.12musllinux: musl 1.2+ ARM64

secantusdb-0.2.0a2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.3 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

secantusdb-0.2.0a2-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (1.2 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ ARM64

secantusdb-0.2.0a2-cp312-cp312-macosx_11_0_arm64.whl (1.1 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

File details

Details for the file secantusdb-0.2.0a2.tar.gz.

File metadata

  • Download URL: secantusdb-0.2.0a2.tar.gz
  • Upload date:
  • Size: 5.4 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for secantusdb-0.2.0a2.tar.gz
Algorithm Hash digest
SHA256 e9b71adb87960613ea9ecbb2ad8edf823a6118ea368c6835c74aeefa767240af
MD5 488f4ff1f5ab712744e9861abcc861c4
BLAKE2b-256 1cfca64205b2f3fcbf20ab2fb6560d0dc3f5be6ba31b7b796613b9bcd41e55c7

See more details on using hashes here.

Provenance

The following attestation bundles were made for secantusdb-0.2.0a2.tar.gz:

Publisher: publish.yml on jdrumgoole/SecantusDB

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file secantusdb-0.2.0a2-cp313-cp313-win_amd64.whl.

File metadata

File hashes

Hashes for secantusdb-0.2.0a2-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 45297c6489f25ed0bb3796355ac180c5f0c1541a7cdb170a6a46f0799ba1adac
MD5 294fee0654681ad7fd3427cb442e81a4
BLAKE2b-256 ea4bab5ecb1b136cdef196f5a88f7bb1fcf9754308096e60f87bf5746d1ba779

See more details on using hashes here.

Provenance

The following attestation bundles were made for secantusdb-0.2.0a2-cp313-cp313-win_amd64.whl:

Publisher: publish.yml on jdrumgoole/SecantusDB

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file secantusdb-0.2.0a2-cp313-cp313-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for secantusdb-0.2.0a2-cp313-cp313-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 87082c45da3684bbde2d9ab77ce7a8a83f31def0d638cce61e186a1507a11b22
MD5 c24239c9acdd516805deb094db7999c2
BLAKE2b-256 b47867ec4c35ab9ecdc55a7b462c5839e697fc8f7ebc7b7cc80a5a649e712274

See more details on using hashes here.

Provenance

The following attestation bundles were made for secantusdb-0.2.0a2-cp313-cp313-musllinux_1_2_x86_64.whl:

Publisher: publish.yml on jdrumgoole/SecantusDB

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file secantusdb-0.2.0a2-cp313-cp313-musllinux_1_2_aarch64.whl.

File metadata

File hashes

Hashes for secantusdb-0.2.0a2-cp313-cp313-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 01ec6ffe612ea4ff6b899066304e4c47558a051b3eb4d1d262cce7a9021881c4
MD5 c72e199b2b872b55dd84f6f545351d91
BLAKE2b-256 9f3a77213fa84604757ccf7ccffd76b55814a4527560d6c84c0ea8e5b2b7cda2

See more details on using hashes here.

Provenance

The following attestation bundles were made for secantusdb-0.2.0a2-cp313-cp313-musllinux_1_2_aarch64.whl:

Publisher: publish.yml on jdrumgoole/SecantusDB

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file secantusdb-0.2.0a2-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for secantusdb-0.2.0a2-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 ab2125768dda587b66a1fcc8beaefea8e92ce570338b65ba78fc8b6f51eccd9b
MD5 9373c45f1128214b317e223b2a01852f
BLAKE2b-256 141351044cb2062eefb6d361480ed4897e34c3f1f29e274fcedcd544c36f8e38

See more details on using hashes here.

Provenance

The following attestation bundles were made for secantusdb-0.2.0a2-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: publish.yml on jdrumgoole/SecantusDB

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file secantusdb-0.2.0a2-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for secantusdb-0.2.0a2-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 5609d9e3b18ab70881dda082ba0a575d26ea24e499cbb1c9b4d2f7d43dc2c0f7
MD5 49181088489778369fdef86cbeb21a94
BLAKE2b-256 bbcdf68d1bf11f282da6a899da88bc1134b22e2074d27c21d8951f9d494b9e25

See more details on using hashes here.

Provenance

The following attestation bundles were made for secantusdb-0.2.0a2-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:

Publisher: publish.yml on jdrumgoole/SecantusDB

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file secantusdb-0.2.0a2-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for secantusdb-0.2.0a2-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 bb5404f533d2d140c5046afba9aa3ff70b081ad6f6517922a7e6aacf11940198
MD5 1520508b66df43ea4c19c917087f42b2
BLAKE2b-256 376de277592e593f8e3b4e2c6098abc6a1a1e8c6bef2b13812a311a206029173

See more details on using hashes here.

Provenance

The following attestation bundles were made for secantusdb-0.2.0a2-cp313-cp313-macosx_11_0_arm64.whl:

Publisher: publish.yml on jdrumgoole/SecantusDB

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file secantusdb-0.2.0a2-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for secantusdb-0.2.0a2-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 460dd3ccdb8ac79428e07cbcea0e937c98fd455db68f8fbf72bc063feb063daf
MD5 630b9f5bf22fa7d9dc7f845f0a8eb461
BLAKE2b-256 56dc1bf80012807b4548acd00aea6ebd6d4b73c1cb421e371b36563cc8eeaf4c

See more details on using hashes here.

Provenance

The following attestation bundles were made for secantusdb-0.2.0a2-cp312-cp312-win_amd64.whl:

Publisher: publish.yml on jdrumgoole/SecantusDB

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file secantusdb-0.2.0a2-cp312-cp312-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for secantusdb-0.2.0a2-cp312-cp312-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 2304bfea792c7a8ba02c1da9b5c64c34dc63195b38bac8261b660c40aaf2459e
MD5 b8b849db3487eb5a9aca58d631be5d22
BLAKE2b-256 ef90fe25c0d61d2e49083b4eda9768d11457ce00475acc522978e3eaa549437b

See more details on using hashes here.

Provenance

The following attestation bundles were made for secantusdb-0.2.0a2-cp312-cp312-musllinux_1_2_x86_64.whl:

Publisher: publish.yml on jdrumgoole/SecantusDB

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file secantusdb-0.2.0a2-cp312-cp312-musllinux_1_2_aarch64.whl.

File metadata

File hashes

Hashes for secantusdb-0.2.0a2-cp312-cp312-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 fea5dd00c69dc452951cba68e6a2dcd996e49ffb632872faf30b774a23137c72
MD5 35aeca9a5d5a9106b4e2400d128fe41f
BLAKE2b-256 7574476eb38779bc11ef3340a4a090baea0a1f0aef7be81cd2808b06d778bc51

See more details on using hashes here.

Provenance

The following attestation bundles were made for secantusdb-0.2.0a2-cp312-cp312-musllinux_1_2_aarch64.whl:

Publisher: publish.yml on jdrumgoole/SecantusDB

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file secantusdb-0.2.0a2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for secantusdb-0.2.0a2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 8c271030d7fbcc5930f1df82068d29fb6d360f35464c515e787d3d7717d206d2
MD5 f6066c27e53e7afc800832873702dbd8
BLAKE2b-256 c25b5d80f5084c3c13303827c1cf8e9f57b293b8aab00df162ec7ced8f192f0e

See more details on using hashes here.

Provenance

The following attestation bundles were made for secantusdb-0.2.0a2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: publish.yml on jdrumgoole/SecantusDB

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file secantusdb-0.2.0a2-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for secantusdb-0.2.0a2-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 ce23342ead2940e5219c49b350b1fc60f1a23209ad491fe178c685917666a4ec
MD5 214fa4a796d421f19f38c1c151099490
BLAKE2b-256 1067979e916640dfe339acc9f5b2c2dc3bf44370fce74f37c5d9b4d8e8e899c0

See more details on using hashes here.

Provenance

The following attestation bundles were made for secantusdb-0.2.0a2-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:

Publisher: publish.yml on jdrumgoole/SecantusDB

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file secantusdb-0.2.0a2-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for secantusdb-0.2.0a2-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 fd3928d9e76b602a113367317c2b15895c2c5f45e04ea541610bccb480918242
MD5 b0b8a97e12062421cc28f06fb967c32b
BLAKE2b-256 bf46cc9f386f24c15726882b8b4ecbe27e27fe8734927e29d507e68073273088

See more details on using hashes here.

Provenance

The following attestation bundles were made for secantusdb-0.2.0a2-cp312-cp312-macosx_11_0_arm64.whl:

Publisher: publish.yml on jdrumgoole/SecantusDB

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page