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.3.tar.gz (31.8 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.3-py3-none-any.whl (24.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: kvgit-0.1.3.tar.gz
  • Upload date:
  • Size: 31.8 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.3.tar.gz
Algorithm Hash digest
SHA256 4ebe1b15d57dff8ebb283d34af4b7842b24e789f3ddc5dab9171454a594fcc74
MD5 7d5ee36b3f11a3af4d0a228cb04b25ac
BLAKE2b-256 ef9d0aa7c5d51a3c9a0fa67e35b910a4a4bc6e5794d96d9c5ba90fb718b609ad

See more details on using hashes here.

File details

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

File metadata

  • Download URL: kvgit-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 24.5 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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 2309a7711e7afa8653af4d79309c072b93d92c3492da8c71f6100aee3bc51560
MD5 70f7c462e01afc24f045e67c1a917eaa
BLAKE2b-256 d880a1f28ea807f2b9354af7896ffeeba4ef1979f5394a1ef7244641ca1670e3

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