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.2.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.2-py3-none-any.whl (24.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: kvgit-0.1.2.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.2.tar.gz
Algorithm Hash digest
SHA256 1473208c951bd9654b35e020f55bdbf1a5c606b9641c138c2f5ec6cd64717048
MD5 7d21d8243c446ae05379d5ad0831cfde
BLAKE2b-256 e6e95c53c6ee237e7a8d8de190aaaec0d032b43905122a04965cf7c064a8b4c0

See more details on using hashes here.

File details

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

File metadata

  • Download URL: kvgit-0.1.2-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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 5ddba242ef8deae448096dff0a0f568f32f4c24932f5fbd78b854a69fd1718b5
MD5 63bd65a77c4c3b112ed24d552bb1cff7
BLAKE2b-256 88b651b4214a8e9799cd71bc726a914999c8b13431fbcad0992d4d90bc127d84

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