Python client SDK for Lantern, an in-memory graph key-vertex-store served over gRPC.
Project description
lantern-sdk (Python)
Python client SDK for Lantern, an in-memory graph key-vertex-store served over gRPC. Mirrors the Go SDK feature set: single + batch vertex/edge operations, prefix scans, prefix delete, Illuminate (k-bounded BFS with TF-IDF / MST / SPT post-processing), and the gRPC health check.
v0.1.x is sync-only (
grpcblocking stubs). Anasynciocompanion built ongrpc.aiois planned for v0.2; see the tracking issue.
Install
Distributed on PyPI as lantern-sdk;
the Python import package name remains lantern_client.
pip install lantern-sdk
# or with uv
uv add lantern-sdk
Quick start
from lantern_client import Lantern
with Lantern.connect("localhost:6380") as cli:
cli.put_vertex("user:1", {"name": "alice"}, ttl_seconds=3600)
v = cli.get_vertex("user:1")
print(v) # Vertex(key='user:1', value={'name': 'alice'}, ...)
cli.add_edge("user:1", "post:42", weight=1.5, ttl_seconds=3600)
graph = cli.illuminate("user:1", step=2, k=10)
print(graph.vertices, graph.edges)
Lantern.connect accepts the same target forms as the Go SDK:
"host:port"— single endpoint."dns:///host:port"— DNS fan-out with round-robin load balancing.Lantern.connect_endpoints([...])— explicit static endpoint list.
See examples/quickstart.py for the full surface.
Value types
put_vertex accepts native Python values; the SDK picks the right protobuf
oneof variant. Supported types: int, float, bool, str, bytes,
datetime.datetime, datetime.timedelta, None (tombstone).
int values land in int64 or uint64 based on sign; float always lands
in float64. Use the explicit constructors in lantern_client.values
(int32, uint32, float32) to pin a narrower wire type. Reading is
symmetric — vertex.value returns the natural Python type; vertex.kind is
the VertexKind enum if you need to dispatch without isinstance.
Codegen
Generated protobuf / gRPC stubs live under src/lantern_client/_pb/ and are
committed to the repo, mirroring how Lantern's Go module keeps pb/
in-tree. To regenerate after a .proto change:
uv run --dev scripts/codegen.sh
License
Apache-2.0 — see LICENSE.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file lantern_sdk-0.1.1.tar.gz.
File metadata
- Download URL: lantern_sdk-0.1.1.tar.gz
- Upload date:
- Size: 28.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
52c09f266e71bc5025050ca1fa66d02388a90e05157686bb32192050fabb24bf
|
|
| MD5 |
1c5841bab68919b2fed65c55d7b558d6
|
|
| BLAKE2b-256 |
dd30a487bb8b9e6cb306da1b4f5c6ff07ff60339f964a43cb7bf0bd0cd96d8fe
|
Provenance
The following attestation bundles were made for lantern_sdk-0.1.1.tar.gz:
Publisher:
python-sdk.yml on anaregdesign/lantern
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
lantern_sdk-0.1.1.tar.gz -
Subject digest:
52c09f266e71bc5025050ca1fa66d02388a90e05157686bb32192050fabb24bf - Sigstore transparency entry: 1728174443
- Sigstore integration time:
-
Permalink:
anaregdesign/lantern@9b7128b4fb7ba21babbeba63adfa10a411e47e0e -
Branch / Tag:
refs/tags/sdks/python/v0.1.1 - Owner: https://github.com/anaregdesign
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-sdk.yml@9b7128b4fb7ba21babbeba63adfa10a411e47e0e -
Trigger Event:
push
-
Statement type:
File details
Details for the file lantern_sdk-0.1.1-py3-none-any.whl.
File metadata
- Download URL: lantern_sdk-0.1.1-py3-none-any.whl
- Upload date:
- Size: 33.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6bfa0d3bb3c5a4d81a6735766280ba70c9cf4665ce737fd3a9a5df3b0c3d7e56
|
|
| MD5 |
eb143faccf89bd6f22323eae344800da
|
|
| BLAKE2b-256 |
11cb33a10d134ee017dc7ea5b4cca4124717d36e21aa59da83c874b10dd36d73
|
Provenance
The following attestation bundles were made for lantern_sdk-0.1.1-py3-none-any.whl:
Publisher:
python-sdk.yml on anaregdesign/lantern
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
lantern_sdk-0.1.1-py3-none-any.whl -
Subject digest:
6bfa0d3bb3c5a4d81a6735766280ba70c9cf4665ce737fd3a9a5df3b0c3d7e56 - Sigstore transparency entry: 1728174517
- Sigstore integration time:
-
Permalink:
anaregdesign/lantern@9b7128b4fb7ba21babbeba63adfa10a411e47e0e -
Branch / Tag:
refs/tags/sdks/python/v0.1.1 - Owner: https://github.com/anaregdesign
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-sdk.yml@9b7128b4fb7ba21babbeba63adfa10a411e47e0e -
Trigger Event:
push
-
Statement type: