pykvd
Python bindings for the KVD
key-value document format, built on kvd-rs
via PyO3 and maturin.
Install
pip install pykvd
Usage with files
loads and dumps work with strings, so pair them with open() for files.
This is the recommended way to read and write .kvd files.
import pykvd
# Write Python objects to a KVD file (canonical form).
doc = {"app": {"port": 8080, "tags": ["web", "api"]}}
with open("config.kvd", "w") as f:
f.write(pykvd.dumps(doc))
# Write the matching schema file.
with open("schema.kvd", "w") as f:
f.write("app:\n port: int\n tags:\n type: list\n element: str\n")
# Read a KVD file into plain Python objects.
with open("config.kvd") as f:
doc = pykvd.loads(f.read())
assert doc == {"app": {"port": 8080, "tags": ["web", "api"]}}
# Update one value in a file.
with open("config.kvd") as f:
text = f.read()
text = pykvd.set(text, "app.port", 9090)
with open("config.kvd", "w") as f:
f.write(text)
# Normalize a file to canonical form.
with open("config.kvd") as f:
text = pykvd.canonical(f.read())
with open("config.kvd", "w") as f:
f.write(text)
# Verify a file against a schema file.
with open("config.kvd") as f:
doc_text = f.read()
with open("schema.kvd") as f:
schema_text = f.read()
pykvd.verify(doc_text, schema_text)
Usage with strings
import pykvd
# Parse KVD text into plain Python objects.
doc = pykvd.loads("app:\n port: 8080\n")
# Serialize Python objects to canonical KVD text.
pykvd.dumps({"app": {"port": 8080}})
# Normalize/validate KVD text to its canonical form.
pykvd.canonical("app:\n port: 8080")
# Verify a document against a schema document.
pykvd.verify("port: 8080\n", "port: int\n")
# Check a schema document is well-formed.
pykvd.validate_schema("port: int\n")
# Structural editing with spec 8.5 paths.
pykvd.get("app:\n port: 8080\n", "app.port")
pykvd.set("app:\n port: 8080\n", "app.port", 9090)
pykvd.remove("app:\n port: 8080\n", "app.port")
pykvd.remove("a:\n b:\n c: 1\n", "a.b.c", recursive=True)
Type notes:
dumpsaccepts dicts, lists, tuples (as lists), str, int, float, bool, and None. Integers must fit in u64; larger values raiseKvdError.- Int literals beyond u64 parse but come back from
loadsas strings. - The document root must be a mapping (spec 4).
Errors:
KvdError(aValueError) for parse and serialization failures.SchemaError(aKvdError) for verification failures and malformed schemas.OpError(aKvdError) for bad operation paths. Missing keys raiseKeyErrorand out-of-range indices raiseIndexError.
Development
pip install maturin pytest
PYO3_USE_ABI3_FORWARD_COMPATIBILITY=1 maturin develop
pytest tests/
License
MIT
Metadata
Release files for pykvd 1.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| pykvd-1.1.1.tar.gz | 9.5 kB | With provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pykvd-1.1.1-cp311-abi3-manylinux_2_34_x86_64.whl | CPython 3.11 | abi3 | Linux glibc 2.34+ x86-64 | Details |
Total release size: 1.1 MB
Release files / pykvd-1.1.1.tar.gz
| Download URL | pykvd-1.1.1.tar.gz |
|---|---|
| Size | 9.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
587813320eb6188fd45569e29247287da7ab19f8cbfeb4324246b872b34642a3
|
|
BLAKE2b-256 checksum How to use checksums |
7e75e7603a634c7ec8f1133e8ef98007742d25e424bc8640f536c8ba54316a06
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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 Sep 16, 2026.
Transparency logRelease files / pykvd-1.1.1-cp311-abi3-manylinux_2_34_x86_64.whl
| Download URL | pykvd-1.1.1-cp311-abi3-manylinux_2_34_x86_64.whl |
|---|---|
| Size | 1.0 MB |
| Tags | CPython 3.11 Linux glibc 2.34+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
9204970bb0c164eb789ac9e78a80a92851e022a82b5bd4c74c3ae454883a6356
|
|
BLAKE2b-256 checksum How to use checksums |
5777d4f23b204079e7b470aebd0ef9178ec6e4c30b180b39baef1e32783ebae2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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 Sep 16, 2026.
Transparency logSecurity for pykvd 1.1.1
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.
Attestation for pykvd-1.1.1.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 Sep 16, 2026.
Transparency logA 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.