Skip to main content

Versioned key-value store with git-like commit, branch, and merge semantics.

Project description

kvgit 🔀

Git-style versioning for your data. Commits, branches, and merges -- backed by a dict-like MutableMapping.

Features Description
Dict interface MutableMapping[str, Any] -- reads and writes work like a dict
Commits Immutable, content-addressable snapshots with rollback
Branches Cheap forks with CAS-based optimistic concurrency
Three-way merge Auto-merges non-overlapping changes; pluggable merge fns for conflicts
Pluggable backends In-memory, disk (diskcache), git (GitPython), IndexedDB (Pyodide/browser), or bring your own KVStore

Install

pip install kvgit            # in-memory only
pip install kvgit[disk]      # adds disk backend via diskcache
pip install kvgit[git]       # adds git backend via GitPython (requires git on PATH)
# IndexedDB backend is available automatically in Pyodide (browser) environments

Quick example

import kvgit

main = kvgit.store()

main["user"] = "alice"
main["score"] = 0
main.commit()

# Branch and diverge
dev = main.create_branch("dev")
dev["score"] = 999
dev.commit()

print(main["score"])  # 0   (main unchanged)
print(dev["score"])   # 999 (dev branch)

Part of the agex stack

kvgit provides versioned agent memory in agex with branching and rollback. It also works as a versioned backing store for monkeyfs virtual filesystems -- pass a Staged instance anywhere a dict is expected.

Development

uv sync --extra dev
uv run pytest

Documentation

See docs/ for detailed documentation:

  • Quick Start -- common patterns with runnable examples
  • API Reference -- full reference for all classes, methods, and types

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

kvgit-0.2.2.tar.gz (51.7 kB view details)

Uploaded Source

Built Distribution

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

kvgit-0.2.2-py3-none-any.whl (47.5 kB view details)

Uploaded Python 3

File details

Details for the file kvgit-0.2.2.tar.gz.

File metadata

  • Download URL: kvgit-0.2.2.tar.gz
  • Upload date:
  • Size: 51.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for kvgit-0.2.2.tar.gz
Algorithm Hash digest
SHA256 55bfdb3d540c763c70e135119a97ab645f0cae21c9e858bff23437d682755326
MD5 dbeb4ceefc5b251c89f955c20a7f936b
BLAKE2b-256 f2502ef73b0f0239f026bc0d8647bb21d3d10ad47da157d378880ef978adeef1

See more details on using hashes here.

File details

Details for the file kvgit-0.2.2-py3-none-any.whl.

File metadata

  • Download URL: kvgit-0.2.2-py3-none-any.whl
  • Upload date:
  • Size: 47.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for kvgit-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 c576fc9dadfd8467f29d525be61d95db2095013acc47e1d7cafa6343c7f233fc
MD5 7d1e9e55013e7e43a609cd608a2bf06e
BLAKE2b-256 e2debb5b55244e3b96d6e9e97982afb280cbb2907954d67de6d71913200bb39a

See more details on using hashes here.

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