Skip to main content

OpenKache Python client

openkache is the maintained synchronous Python client for the frozen OpenKache v1 Gate 0 (v1-gate0) contract. It exposes only the five contract operations:

Operation Result
Client.connect(address) A connected client
client.get(key) Found(value) or Missing
client.set(key, value) SetOutcome
client.delete(key) DeleteOutcome.DELETED or DeleteOutcome.NOT_FOUND
client.close() Idempotent resource release

Mapped keys accept UTF-8 str, signed 64-bit int, and bytes-like values. Every public value read and write uses StructuredValue-CBOR-v1; JSON, raw operations, TTL and retry overrides, cancellation controls, and certificate configuration are outside this Gate 0 facade.

SetOutcome contains only CREATED and REPLACED. A conditional NOT_STORED response is outside Gate 0 and raises OpenKacheIncompatibleServerError, because the facade never sends conditional writes. A mutation whose response is lost raises the distinct OpenKacheUnknownMutationError.

Install

python -m pip install openkache

Quick start

The package-local example is intentionally development-only. It uses the shared TLS 1.3 transport with server-certificate verification disabled; do not use it for production credentials or internet-facing deployments.

OPENKACHE_ADDRESS=127.0.0.1:4433 python examples/basic.py
from openkache import Client, DeleteOutcome, Found, Missing

client = Client.connect("127.0.0.1:4433")
try:
    client.set("profile", {"name": "OpenKache", "visits": 1})
    result = client.get("profile")
    if isinstance(result, Found):
        print(result.value)
    elif isinstance(result, Missing):
        print("missing")
    if client.delete("profile") is DeleteOutcome.DELETED:
        print("deleted")
finally:
    client.close()

client.get always returns model wrappers that preserve Undefined, None/Null, booleans, arbitrary integers, Float16/32/64 width and raw bits, bytes, text, arrays, and ordered scalar-key maps. This lossless contract keeps every StructuredValue kind observable to Python callers.

Configuration

Gate 0 has no certificate, timeout, retry, TTL, or transport configuration. The development example reads only OPENKACHE_ADDRESS.

The lossless constructors and codec helpers are available for applications that need an explicit model value:

from openkache import FloatValue, IntegerValue, MapValue, UNDEFINED

value = MapValue([
    ("count", IntegerValue(2**80)),
    ("missing", UNDEFINED),
    ("half", FloatValue(16, 0x3C00)),
])

Build and verify

Run these commands from openkache/clients/python in a checkout with the repository development tools:

python -m compileall src examples
OPENKACHE_GENERATION_TARGET=python ../generate.ts
python -m unittest ../../../tests/clients/python_value_test.py
python -m build --sdist --wheel --outdir dist

The generated Smithy modules and platform-native adapter are package build outputs. Do not commit dist/, build/, generated modules, or native libraries.

Package layout

  • src/openkache/_client.py — Gate 0 facade and key/result mapping.
  • src/openkache/_native.py — ctypes ownership and native ABI conversion.
  • src/openkache/_value.py — lossless StructuredValue-CBOR-v1 codec.
  • src/openkache/_generated/ — generated contract and ABI modules.
  • native/ — thin Rust cdylib adapter over the shared client core.
  • examples/basic.py — clearly labeled development-only TLS example.

License

The Python client and native adapter are distributed under the Apache License 2.0. Package artifacts include the license text.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

openkache-0.1.0.tar.gz (514.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

openkache-0.1.0-py3-none-manylinux_2_38_x86_64.whl (4.0 MB view details)

Uploaded Python 3manylinux: glibc 2.38+ x86-64

File details

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

File metadata

  • Download URL: openkache-0.1.0.tar.gz
  • Upload date:
  • Size: 514.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for openkache-0.1.0.tar.gz
Algorithm Hash digest
SHA256 dc66deb07b707d919a85db89a9422b355f94aa90cd1e761938f23ac8b9fd8376
MD5 eaf120b28671b0cfcf995e8baadf9b27
BLAKE2b-256 7a46c4d7fde12c49c897d5cc5ec2b92b7ddea6a8b190db007229a432021a470a

See more details on using hashes here.

Provenance

The following attestation bundles were made for openkache-0.1.0.tar.gz:

Publisher: publish-pypi.yml on openkache/openkache

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file openkache-0.1.0-py3-none-manylinux_2_38_x86_64.whl.

File metadata

File hashes

Hashes for openkache-0.1.0-py3-none-manylinux_2_38_x86_64.whl
Algorithm Hash digest
SHA256 b6e9725bdd50d8a7d363c14fae88579df21dcde71fda1975afdb84781f69914b
MD5 2830bf5b285e3bb30dc628baebbdb638
BLAKE2b-256 590620c3ce2f6ac0b3f74d070795bf7c4ae0c1fa765b002f9277cf1bb7379e2f

See more details on using hashes here.

Provenance

The following attestation bundles were made for openkache-0.1.0-py3-none-manylinux_2_38_x86_64.whl:

Publisher: publish-pypi.yml on openkache/openkache

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

0.1.3

7 files

0.1.2

2 files

0.1.1

2 files

This release

0.1.0 This release

2 files

0.0.2

2 files

0.0.1

2 files

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