Lance Graph is a Cypher-capable graph query engine built in Rust with Python bindings for building high-performance, scalable, and serverless multimodal knowledge graphs.
This repository contains:
rust/lance-graph
– the Cypher-capable query engine implemented in Rustpython/
– PyO3 bindings and a thinlance_graph
Python package
- Rust toolchain (1.82 or newer recommended)
- Python 3.11
uv
available on yourPATH
cd rust/lance-graph
cargo check
cargo test
cd python
uv venv --python 3.11 .venv # create the local virtualenv
source .venv/bin/activate # activate the virtual environment
uv pip install maturin[patchelf] # install build tool
uv pip install -e '.[tests]' # editable install with test extras
maturin develop # build and install the Rust extension
pytest python/tests/ -v # run the test suite
If another virtual environment is already active, run
deactivate
(orunset VIRTUAL_ENV
) before theuv run
command so uv binds to.venv
.
import pyarrow as pa
from lance_graph import CypherQuery, GraphConfig
people = pa.table({
"person_id": [1, 2, 3, 4],
"name": ["Alice", "Bob", "Carol", "David"],
"age": [28, 34, 29, 42],
})
config = (
GraphConfig.builder()
.with_node_label("Person", "person_id")
.build()
)
query = (
CypherQuery("MATCH (p:Person) WHERE p.age > 30 RETURN p.name AS name, p.age AS age")
.with_config(config)
)
result = query.execute({"Person": people})
print(result.to_pydict()) # {'name': ['Bob', 'David'], 'age': [34, 42]}
For linting and type checks:
# Install dev dependencies and run linters
uv pip install -e '.[dev]'
ruff format python/ # format code
ruff check python/ # lint code
pyright # type check
# Or run individual tests
pytest python/tests/test_graph.py::test_basic_node_selection -v
The Python README (python/README.md
) contains additional details if you are
working solely on the bindings.