Skip to main content

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

Project description

kvgit 🔀

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

Values are Any (serialized via pickle by default). Commits are content-addressable. Branches are cheap. Merges are three-way with pluggable per-key conflict resolution.

Features

  • Commits -- immutable, content-addressable snapshots
  • Branches -- named branch heads with CAS-based concurrency
  • Three-way merge -- auto-merges non-overlapping changes, pluggable merge functions for conflicts
  • Merge functions -- counters, last-writer-wins, or custom per-key merge logic
  • Garbage collection -- high/low water rebase drops cold keys automatically
  • Namespaces -- key-prefixed views with full read/write support
  • Pluggable backends -- in-memory, disk (via diskcache), or bring your own KVStore

Install

pip install kvgit            # in-memory only
pip install kvgit[disk]      # adds disk backend via diskcache

Quick example

import kvgit

# Create a store -- values are Any (pickle-serialized by default)
s = kvgit.store()

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

first = s.current_commit

# Update and commit again
s["score"] = 100
s.commit()
print(s["score"])              # 100

# Rollback to the first commit
s.reset_to(first)
print(s["score"])              # 0

# Branching
s["score"] = 50
s.commit()

dev = s.create_branch("dev")
dev["score"] = 999
dev.commit()

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

Development

uv sync --extra dev
uv run pytest

Documentation

See docs/ for detailed API documentation:

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.0.tar.gz (31.3 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.0-py3-none-any.whl (24.3 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for kvgit-0.1.0.tar.gz
Algorithm Hash digest
SHA256 0a4dd2553b6121ac6cf3f66102a57eb7b1e99651d07b441af54c9c8b387b3004
MD5 30a3a1abef57e47b4dcaf93640799570
BLAKE2b-256 f5ffef14575dd82c4366b0e7b72c19d8fc8a4e01ffe2e49149f9b4a57341de7b

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for kvgit-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 66a8b358a3a548f214fd825e58a24be5b6137101a5601b26343d280a1afd5346
MD5 d6e23ffc3e0beaacadfc11b4ca53c11a
BLAKE2b-256 90eed87357beceec91cbacea418fd10410e0238bc3b9258d45e2ecd8dcdec4fb

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