KoutenDB Python Driver
Pure Python TCP driver for KoutenDB.
This driver talks to koutend over KoutenDB's high-level wire protocol. It does
not reimplement KoutenDB's ring-key, period, head-angle, or placement rules.
Applications pass a human-readable ring name, and KoutenDB returns a typed ID.
Version 0.3.0 adds stricter framing, version negotiation, typed errors and safe retry behavior. See the TCP safety and migration guide.
Status
- package: PyPI
koutendbv0.3.0 - current mode: native TCP wire driver
- Python: 3.10+
- runtime dependencies: none
- KoutenDB core: running
koutendnode or cluster
Implemented:
- persistent TCP connections
wire_version/healthput/put_codec/put_json/put_nif/put_bifget/get_encoded/get_text/get_jsonquery/query_encoded/query_text/query_json- codec metadata negotiation with
CODECMETA ON batch_get- direct owner redirects from extended
FWD ... ownerresponses - ordered
batch_getusing epoch-aware GETID requests - typed
KoutenId - at most one reconnect retry for reads; no automatic write replay
- context manager support
- username/password, shared-secret transport, and TLS authentication
Planned:
- retrieve / atlas wire APIs once the public wire contract is finalized for drivers
- ring-read filters/projection once the public wire contract is finalized for drivers
- connection pooling
Install
Install the published package from PyPI:
python3 -m pip install koutendb
For local driver development, install from a checkout:
python3 -m pip install -e .
Build koutend from the KoutenDB core repository:
git clone https://github.com/puffball1567/koutendb.git
cd koutendb
nimble install -y
nim c -d:release --nimcache:/tmp/nimcache_koutend -o:src/koutend src/koutend.nim
Example
from koutendb import KoutenClient
with KoutenClient.connect("127.0.0.1:17301") as db:
doc_id = db.put_json(
"docs/japan/support",
{"title": "Tokyo support note", "country": "JP"},
vector=[1.0, 0.0],
)
print(db.get_json(doc_id))
print(db.get_encoded(doc_id).codec)
print(db.query_json(doc_id, "{ title }"))
Authentication and TLS
connect accepts credentials and TLS options. Password auth and TLS use only
the standard library. Shared-secret (secret_key) challenge-response and the
encrypted transport it enables additionally need libsodium via PyNaCl — install
the secure extra:
pip install koutendb[secure]
Connect over TLS with shared-secret auth, verifying the server against a CA or self-signed certificate PEM (certificate verification stays on):
from koutendb import KoutenClient
db = KoutenClient.connect(
"127.0.0.1:17301",
username="alice",
password="secret",
secret_key="shared-secret",
tls_ca_file="/path/to/server.crt",
)
Password-only auth over TLS needs no extra dependency:
db = KoutenClient.connect(
"127.0.0.1:17301", username="alice", password="secret",
tls_ca_file="/path/to/server.crt",
)
tls_insecure_skip_verify=True disables certificate verification. The
connection is then encrypted but unauthenticated and trivially impersonable, so
it is for local smoke tests only — never a production server. Prefer
tls_ca_file for self-signed certificates.
Test
From this driver repository, point KOUTENDB_CORE_DIR at a KoutenDB checkout:
KOUTENDB_CORE_DIR=/path/to/koutendb python3 -m unittest discover -s tests
The test starts a two-node local koutend cluster and verifies put/get/query,
JSON helpers, codec metadata, BIF opaque payloads, wire_version, and
batch_get.
Why A Native Wire Driver?
The Python driver is intended for API services, scripts, experiments, and AI/RAG validation where a running KoutenDB server or cluster is the natural boundary. It keeps Python out of KoutenDB's placement internals and uses the same ring-oriented API that other external drivers should use.
Metadata
Release files for koutendb 0.3.0
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 | |
|---|---|---|---|---|
| koutendb-0.3.0.tar.gz | 22.3 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| koutendb-0.3.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 37.9 kB
Release files / koutendb-0.3.0.tar.gz
| Download URL | koutendb-0.3.0.tar.gz |
|---|---|
| Size | 22.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c44b2f63a6ccc3516a8dce9c4c89288a05326ae1b85c35a4c60a7d2840700d14
|
|
BLAKE2b-256 checksum How to use checksums |
76643e5ceb42a6c15a2b8568c14400d90d91280d366836a5712983b508362b43
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.8
|
Release files / koutendb-0.3.0-py3-none-any.whl
| Download URL | koutendb-0.3.0-py3-none-any.whl |
|---|---|
| Size | 15.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6b87537bd6b95f8d3dc79a8779ed06933ab4fc074b970acd162e8f8c2f9e319e
|
|
BLAKE2b-256 checksum How to use checksums |
9702d60e0b32487e782fa29e727b44be0b0a2ba2a9fb5d2426f528c6cf8d3842
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.8
|
Security for koutendb 0.3.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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
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.