Skip to main content

PyKV

An educational key-value store built from scratch in Python.

Part of the PyLearn series — learning computer science by building real tools.

What Is a Key-Value Store?

Think of a phonebook: you look up a name (the key) and get back a phone number (the value). A key-value store works the same way — it's the simplest kind of database.

Features

  • Get / Set / Delete — basic phonebook operations
  • TTL (Time-To-Live) — keys that expire, like milk with a use-by date
  • Multiple Data Types — store strings, numbers, lists, and dicts
  • Persistence — save to disk so data survives a restart
  • Namespaces — group keys like folders in a filing cabinet
  • Batch Operations — handle many keys at once, like a grocery list
  • Atomic Counters — thread-safe increment/decrement, like a tally counter
  • Pattern Matching — find keys matching a glob pattern

Quick Start

from pykv.store import BasicStore

store = BasicStore()
store.set("greeting", "hello")
print(store.get("greeting"))  # "hello"

Releasing

Other projects in the series (PyStack) use a pinned release of this one, not whatever is on main. To publish a change for them:

  1. Merge the change to main.
  2. Tag it: git tag -a vX.Y.Z -m vX.Y.Z && git push origin vX.Y.Z. A change to the public API bumps the minor version (v0.1.0 → v0.2.0); anything else bumps the patch (v0.1.0 → v0.1.1).
  3. In each project that uses it, edit the tag in [tool.uv.sources], run uv lock --upgrade-package <name>, and open a pull request so CI checks the pair together.

This project is one of a series that builds real systems "from scratch in Python" to teach how they work. See the series home for the full story.

Project What it teaches Repository Docs
PyOS Operating systems py-os Docs
Pebble Compilers and programming languages pebble-lang Docs
PyDB Relational databases pydb Docs
PyKV Key-value stores pykv Docs
PyDocDB Document databases pydoc-db Docs
PyGraphDB Graph databases pygraphdb Docs
PyTSDB Time-series databases pytsdb Docs
PyVecDB Vector databases pyvecdb Docs
PyColDB Column-family databases pycoldb Docs
PyCrypt Cryptography pycrypt Docs
PyNet Computer networking pynet Docs
PyWeb HTTP web servers pyweb Docs
PyGit Version control pygit Docs
PySearch Search engines pysearch Docs
PyMQ Message queues pymq Docs
PyLLM Language models (the brain) pyllm Docs
PyScheduler Job scheduling pyscheduler Docs
PyStack Full-stack integration pystack Docs

Documentation

Full docs (with kid-friendly explanations of every idea): https://robcox2910.github.io/pykv/

Metadata

Release files for fromscratch-pykv 0.4.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for fromscratch-pykv 0.4.0
File Size Uploaded Provenance
fromscratch_pykv-0.4.0.tar.gz 89.7 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for fromscratch-pykv 0.4.0
File Interpreter ABI Platform
fromscratch_pykv-0.4.0-py3-none-any.whl Python 3 none any Details

Total release size: 111.4 kB

Release files / fromscratch_pykv-0.4.0.tar.gz

Download URL fromscratch_pykv-0.4.0.tar.gz
Size 89.7 kB
Tags Source
SHA-256 checksum
How to use checksums
f772e6e44af7dd49d34b452e5360fd1bc660dcba9aef59c026dc0c77f86aac1b
BLAKE2b-256 checksum
How to use checksums
abadaee5ee5fc676a4a6a02ce9efadf049a191fafd325cb0073cf9a946c9af12
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 26, 2026.

Transparency log

Release files / fromscratch_pykv-0.4.0-py3-none-any.whl

Download URL fromscratch_pykv-0.4.0-py3-none-any.whl
Size 21.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ea510a018f94f904fb580edf1e38136e0ba8763be2105e39e42de7b8c7ded28a
BLAKE2b-256 checksum
How to use checksums
8909937e86c25d65917cdeac3344a50effe4339dbcd115db939f16e7ff6ea214
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 26, 2026.

Transparency log

Security for fromscratch-pykv 0.4.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for fromscratch_pykv-0.4.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 26, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.4.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page