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

This repository is at the v0.1 foundation stage. It currently provides JSON documents, atomic writes, optimistic version checks, SQLite catalog/history, index rebuilding, and a PyO3 binding. File watching, cache policy, recovery plans, local IPC, and gRPC are deliberately 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.
python benchmark/python/mapping_roundtrip.py --items 1000

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.1.0.tar.gz (13.0 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.1.0-cp311-cp311-win_amd64.whl (1.2 MB view details)

Uploaded CPython 3.11Windows x86-64

dirdb_rust-0.1.0-cp311-cp311-manylinux_2_34_x86_64.whl (1.4 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.34+ x86-64

dirdb_rust-0.1.0-cp311-cp311-macosx_11_0_arm64.whl (1.2 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

File details

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

File metadata

  • Download URL: dirdb_rust-0.1.0.tar.gz
  • Upload date:
  • Size: 13.0 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.1.0.tar.gz
Algorithm Hash digest
SHA256 37c8e5d140f67c9a14cdbd14168832021fb177df600b55269a3bed21b2abd5eb
MD5 e09ab646e63b5c3c19a8d906b3b0dfc8
BLAKE2b-256 1337f30d616c187117a7c5252a98e392e29b5ac02b087f79aea45e47239373df

See more details on using hashes here.

Provenance

The following attestation bundles were made for dirdb_rust-0.1.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.1.0-cp311-cp311-win_amd64.whl.

File metadata

  • Download URL: dirdb_rust-0.1.0-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 1.2 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.1.0-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 bfc59eef863f30f347858af3167e9cd0f4ac40e60dc88c9e318899e1ecf2fbc2
MD5 cdc3bac0cda2e0188b552127851b0ac6
BLAKE2b-256 113a7249881ead3b783c4e59f17fafc26a7f167f61a6c93a14c2f3817546be0f

See more details on using hashes here.

Provenance

The following attestation bundles were made for dirdb_rust-0.1.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.1.0-cp311-cp311-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for dirdb_rust-0.1.0-cp311-cp311-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 b8910d273af8c2790574c901fdc176bcdf40218152cb0444b4b8803e342ed608
MD5 ebe942491c581bac14c60fc88afc5547
BLAKE2b-256 5f936d0a0d5feb834da016ff72ac6261601b7851d93fa1e1b672798f1b01f6e1

See more details on using hashes here.

Provenance

The following attestation bundles were made for dirdb_rust-0.1.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.1.0-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for dirdb_rust-0.1.0-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 66a4e266f39e31fda171664785a34f8802133c07764ebb4475e5973938a9917f
MD5 a057c40ea2c0ef9204740fbac5a76e6e
BLAKE2b-256 c7166d3b735572d84a09a204bd4ec42e320dd7220b76f2d9987ac5b061a64ddc

See more details on using hashes here.

Provenance

The following attestation bundles were made for dirdb_rust-0.1.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