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
Eviction High/low water rebase drops least-recently-used keys automatically
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.1.7.tar.gz (29.6 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.1.7-py3-none-any.whl (32.9 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for kvgit-0.1.7.tar.gz
Algorithm Hash digest
SHA256 d78600a9643d2d2c3f3bfe3f018b4717170dd4bb18c7714df2605ccad47a7a29
MD5 bc6f8b6bbec4bc85b75c50fe2212a8c9
BLAKE2b-256 152c0fcd3b99b51e4fe61263149a4a86d07f68380d75a2531e0a1828cea2d85f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: kvgit-0.1.7-py3-none-any.whl
  • Upload date:
  • Size: 32.9 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.1.7-py3-none-any.whl
Algorithm Hash digest
SHA256 8357f65038598bb019b6dd62c6cc2eee4a95759a1537b675983361586cd68387
MD5 4f57cdf9bd0bba986c00dfaf6584118e
BLAKE2b-256 32a5331a4ac9276c1ab022f51136e6f5ac1b80d113269867618c4c9b23121cc6

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