Skip to main content

Filesystem-first local configuration store

Project description

DirDB

Your directory is the database.

DirDB (pronounced Deer DB / Directory DB) is a filesystem-first local configuration store. Dir represents a directory; its reading also evokes deer and dear: a database close to your files.

The files in data/ are always the source of truth. SQLite holds rebuildable metadata and revision history, while callers get a small Python API backed by Rust.

from dirdb import DirDB

db = DirDB("./state")
version = db.set("services/auth/config", {"enabled": True})
config = db.get("services/auth/config")

The async API is the preferred path for application servers. It runs filesystem and SQLite work in a worker thread while the Rust extension releases the GIL.

import asyncio
from dirdb import DirDB

async def main() -> None:
    db = DirDB("./state")
    version = await db.aset("services/auth/config", {"enabled": True})
    config = await db.aget("services/auth/config")

asyncio.run(main())

Status

DirDB is at the v0.2 local-reliability stage. It provides a bounded Rust cache, native file watching with a periodic integrity check, automatic repair of invalid external JSON edits, and sync/async batch APIs. Recovery plans, local IPC, and gRPC remain future milestones.

Layout

state/
├── data/                       # authoritative JSON documents
│   └── services/auth/config.json
└── metadata.db                 # rebuildable catalog and revisions

Development

cargo test -p dirdb-core
uv run maturin develop

Install

python -m pip install DirDB-Rust

Build distributable artifacts with uv build. GitHub Actions builds and uploads wheels for Linux, macOS, and Windows on pull requests and version tags.

Git for Windows Bash

# Build a wheel for the default Python.
./scripts/build-wheel.sh

# Build and install the newest wheel into the default Python.
./scripts/build-and-install.sh

# Target a virtual environment or a specific Python installation.
PYTHON_BIN=/c/path/to/.venv/Scripts/python.exe ./scripts/build-and-install.sh

When launched in an interactive Git Bash window, each script keeps the window open and reports success or failure until Enter is pressed. Set NO_PAUSE=1 for automation.

Examples

Run the async Python example after installing the wheel:

python examples/python/async_basic.py

Run the Rust core example directly:

cargo run --manifest-path examples/rust/basic/Cargo.toml

See all examples.

Tests and Benchmarks

# Build/install DirDB first, then install the Python test dependency.
python -m pip install "pytest>=8"
python -m pytest tests/python -q

# Convenience alias; this delegates to pytest.
python -m tests tests/python -q

# Measure async read/write throughput.
python benchmark/python/async_throughput.py --items 1000 --concurrency 32

# Measure dictionary-style document round trips and warm-cache reads.
python benchmark/python/mapping_roundtrip.py --items 1000 --read-rounds 10

See benchmark notes.

CI and Releases

CI runs Rust formatting, Clippy, Rust tests, Ruff checks/formatting, wheel build/install tests with pytest, Python compilation checks, and platform wheel builds. A successful push to main automatically checks the package version against PyPI; if it is new, CI creates a GitHub Release and publishes the Linux, macOS, and Windows wheels plus the source distribution to PyPI through Trusted Publishing.

Documentation: English guides | Japanese guides | English design | 日本語設計書 | 日本語README

Implementation tracker: TODO | TODO (Japanese)

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

dirdb_rust-0.2.0.tar.gz (20.2 kB view details)

Uploaded Source

Built Distributions

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

dirdb_rust-0.2.0-cp311-cp311-win_amd64.whl (1.3 MB view details)

Uploaded CPython 3.11Windows x86-64

dirdb_rust-0.2.0-cp311-cp311-manylinux_2_34_x86_64.whl (1.6 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.34+ x86-64

dirdb_rust-0.2.0-cp311-cp311-macosx_11_0_arm64.whl (1.4 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

File details

Details for the file dirdb_rust-0.2.0.tar.gz.

File metadata

  • Download URL: dirdb_rust-0.2.0.tar.gz
  • Upload date:
  • Size: 20.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for dirdb_rust-0.2.0.tar.gz
Algorithm Hash digest
SHA256 95b688b7258f6581db1b62bf017dc3f4a4fb64eaa031aeb1360a82949aba7fe8
MD5 fd4267185015807c1087a00e1ff9ad90
BLAKE2b-256 0960df0e8a0427f2362d5d6560dab491963edc987f2b0ffc01bb8a6d6103fab1

See more details on using hashes here.

Provenance

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

Publisher: ci.yml on disnana/DirDB

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

File details

Details for the file dirdb_rust-0.2.0-cp311-cp311-win_amd64.whl.

File metadata

  • Download URL: dirdb_rust-0.2.0-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 1.3 MB
  • Tags: CPython 3.11, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for dirdb_rust-0.2.0-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 d27aaf88ade167ab0e82ffb09e7085e5899045790befb7272310418e9e586f3e
MD5 b365118374cbf2e5fd308984a9fac6cc
BLAKE2b-256 5c48c084e41580d3a35476ace7640fbcef1b537565422336da7534d8ed6f1c87

See more details on using hashes here.

Provenance

The following attestation bundles were made for dirdb_rust-0.2.0-cp311-cp311-win_amd64.whl:

Publisher: ci.yml on disnana/DirDB

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

File details

Details for the file dirdb_rust-0.2.0-cp311-cp311-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for dirdb_rust-0.2.0-cp311-cp311-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 35320c8e0089dddf9a7d6aea6713e5531c4d31e43c2e5b2a891a4387c219bff6
MD5 7d68a8a5dab78c3c2260ba30c0a7ee58
BLAKE2b-256 f9c252ceb546f0bf26140b924ab0cd2fd596dff596bb242bc9bace4c0aa589c1

See more details on using hashes here.

Provenance

The following attestation bundles were made for dirdb_rust-0.2.0-cp311-cp311-manylinux_2_34_x86_64.whl:

Publisher: ci.yml on disnana/DirDB

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

File details

Details for the file dirdb_rust-0.2.0-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for dirdb_rust-0.2.0-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 465d734cc2985603e20cbeeab49d849f3a3554e63e327ef466638c5234391033
MD5 a597118c84d1d6a135e2c0077fd93c0b
BLAKE2b-256 55925b6623eac19863c19f0c48b3ad81c958b4e71b87632aee14b70ea0089721

See more details on using hashes here.

Provenance

The following attestation bundles were made for dirdb_rust-0.2.0-cp311-cp311-macosx_11_0_arm64.whl:

Publisher: ci.yml on disnana/DirDB

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