Skip to main content

Python bindings for the Lora in-memory graph database

Project description

lora-python

Python bindings for the Lora in-memory graph engine. Ships both a synchronous PyO3 Database class and an asyncio-compatible AsyncDatabase wrapper that never blocks the event loop.

Status: prototype / feasibility check. Not published to PyPI.

Install (local dev)

cd crates/lora-python
python3 -m venv .venv && source .venv/bin/activate
pip install -U pip maturin pytest pytest-asyncio
maturin develop         # builds the Rust extension into the venv
pytest                  # runs the sync + async smoke tests

maturin develop produces a lora_python/_native.<platform>.so inside the package and makes import lora_python work immediately.

Sync usage

from lora_python import Database, is_node

db = Database.create()
db.execute("CREATE (:Person {name: $n, age: $a})", {"n": "Alice", "a": 30})

res = db.execute("MATCH (n:Person) RETURN n")
for row in res["rows"]:
    n = row["n"]
    if is_node(n):
        print(n["properties"]["name"])

Async usage (non-blocking)

import asyncio
from lora_python import AsyncDatabase

async def main():
    db = await AsyncDatabase.create()
    await db.execute("CREATE (:Person {name: 'Alice'})")
    r = await db.execute("MATCH (n:Person) RETURN n.name AS name")
    print(r["rows"])

asyncio.run(main())

AsyncDatabase.execute dispatches the query onto the default asyncio thread pool via asyncio.to_thread. The PyO3 Database.execute releases the Python GIL for the duration of engine work, so other coroutines on the event loop can progress while a query runs. A dedicated test proves the event loop continues ticking during a 2 000-node MATCH.

Typed value model

Same conceptual contract as lora-node / lora-wasm:

Python shape Lora value
None, bool, int, float, str scalars
list, dict collections
{"kind": "node", "id", "labels", "properties"} node
{"kind": "relationship", "id", …} relationship
{"kind": "path", "nodes": [...], "rels": [...]} path
{"kind": "date", "iso": "YYYY-MM-DD"} (and time, …) temporal
point dicts — see below point

Points are returned as dicts keyed on their CRS:

SRID Dict
7203 {"kind": "point", "srid": 7203, "crs": "cartesian", "x", "y"}
9157 {"kind": "point", "srid": 9157, "crs": "cartesian-3D", "x", "y", "z"}
4326 {"kind": "point", "srid": 4326, "crs": "WGS-84-2D", "x", "y", "longitude", "latitude"}
4979 {"kind": "point", "srid": 4979, "crs": "WGS-84-3D", "x", "y", "z", "longitude", "latitude", "height"}

Constructors and guards are exported from lora_python.types: date, time, localtime, datetime, localdatetime, duration, cartesian, cartesian_3d, wgs84, wgs84_3d, is_node, is_relationship, is_path, is_point, is_temporal.

distance() on WGS-84-3D points ignores height — see functions reference for the full spatial reference and known limitations.

Errors

  • LoraError — base class
  • LoraQueryError — parse / analyze / execute failure
  • InvalidParamsError — a parameter value couldn't be mapped

All three are available as lora_python.LoraError, etc.

Architecture

lora-database (Rust)
   └── lora-python (crate, cdylib)             <- PyO3 bindings
          ├── Database (sync, releases the GIL)
          └── python/lora_python/
                 ├── _async.py  AsyncDatabase via asyncio.to_thread
                 └── types.py   typed dicts + constructors + guards

Project details


Download files

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

Source Distribution

lora_python-0.2.0.tar.gz (270.9 kB view details)

Uploaded Source

Built Distributions

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

lora_python-0.2.0-cp38-abi3-win_amd64.whl (1.1 MB view details)

Uploaded CPython 3.8+Windows x86-64

lora_python-0.2.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.4 MB view details)

Uploaded CPython 3.8+manylinux: glibc 2.17+ x86-64

lora_python-0.2.0-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (1.3 MB view details)

Uploaded CPython 3.8+manylinux: glibc 2.17+ ARM64

lora_python-0.2.0-cp38-abi3-macosx_11_0_arm64.whl (1.2 MB view details)

Uploaded CPython 3.8+macOS 11.0+ ARM64

lora_python-0.2.0-cp38-abi3-macosx_10_12_x86_64.whl (1.3 MB view details)

Uploaded CPython 3.8+macOS 10.12+ x86-64

File details

Details for the file lora_python-0.2.0.tar.gz.

File metadata

  • Download URL: lora_python-0.2.0.tar.gz
  • Upload date:
  • Size: 270.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for lora_python-0.2.0.tar.gz
Algorithm Hash digest
SHA256 23d955130452a8a90644fbfa3dceda62872b0a1c87fefdaef29ab91538cc499b
MD5 ab1f388c95469be0ade68dd1684ea333
BLAKE2b-256 597af83407225aa63a378330e7863d052edb24117b20428d241c022de9fbc3a3

See more details on using hashes here.

Provenance

The following attestation bundles were made for lora_python-0.2.0.tar.gz:

Publisher: packages-release.yml on lora-db/lora

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

File details

Details for the file lora_python-0.2.0-cp38-abi3-win_amd64.whl.

File metadata

  • Download URL: lora_python-0.2.0-cp38-abi3-win_amd64.whl
  • Upload date:
  • Size: 1.1 MB
  • Tags: CPython 3.8+, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for lora_python-0.2.0-cp38-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 f8f68cc395a887f2740b6d46d5c457618f8abb56826066b1037f3bd1975da5e6
MD5 96f397c8a8a662a906c26ed530770a97
BLAKE2b-256 d04a851691aa04361205e1531a3a6ab2ce582b6fe6fc3052ed4cae20ed7303b8

See more details on using hashes here.

Provenance

The following attestation bundles were made for lora_python-0.2.0-cp38-abi3-win_amd64.whl:

Publisher: packages-release.yml on lora-db/lora

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

File details

Details for the file lora_python-0.2.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for lora_python-0.2.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 5ef8d8c58acf2c9c7daf6559dc693cd0c0f7e382c538472f4b585217b56bd051
MD5 cfccca4a4c142ebc7a91222becf5dc97
BLAKE2b-256 8a2c082b3bf6fd4589e1a24629287fe3f47b79c1b0954b3454104592abb30275

See more details on using hashes here.

Provenance

The following attestation bundles were made for lora_python-0.2.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: packages-release.yml on lora-db/lora

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

File details

Details for the file lora_python-0.2.0-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for lora_python-0.2.0-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 f6720607d21dea9d1a26bfb3409eaf4bb329e314d9e2a8e65b8f7564274ab3de
MD5 58bbb54ce022bf64eeb6093c18426a7b
BLAKE2b-256 6227eb3415d8e63a52beb9739f1c501dd1609774769e4572bc07d0a82b8b24a6

See more details on using hashes here.

Provenance

The following attestation bundles were made for lora_python-0.2.0-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:

Publisher: packages-release.yml on lora-db/lora

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

File details

Details for the file lora_python-0.2.0-cp38-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for lora_python-0.2.0-cp38-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 be7b37c2f4aef5a3841075e896160f8ccab2efb429963deb02566b5471a7c14e
MD5 61db4f2f3dbb95a671dcf65bd2b60942
BLAKE2b-256 ec73c62fe5e593f5f89eebe0bac66db48fc38bbf5cb9d5bc84cb2b8c5b141c4f

See more details on using hashes here.

Provenance

The following attestation bundles were made for lora_python-0.2.0-cp38-abi3-macosx_11_0_arm64.whl:

Publisher: packages-release.yml on lora-db/lora

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

File details

Details for the file lora_python-0.2.0-cp38-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for lora_python-0.2.0-cp38-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 946d87f12946e0aa70c7783d466a04781824815be7fabf36d25043e60b232ab7
MD5 7b6f96dd6e1ea3f55522c59a14187a5e
BLAKE2b-256 9f8f3d9cf0f14c69563313d7a02cd492dce3c8280a3e753e6d67d29ec1ef3e57

See more details on using hashes here.

Provenance

The following attestation bundles were made for lora_python-0.2.0-cp38-abi3-macosx_10_12_x86_64.whl:

Publisher: packages-release.yml on lora-db/lora

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

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page