Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ jobs:
esac
# A fresh environment with the wheel and test tools; --no-build refuses any sdist.
run=(uv run --isolated --no-project --no-build --python ${{ matrix.python }}
--with "$wheel" --with pytest --with pandas)
--with "$wheel" --with pytest --with pandas --with pylance)
"${run[@]}" python -I ci/check_wheel.py
cp -r python/python/tests "$RUNNER_TEMP/tests"
cd "$RUNNER_TEMP"
Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@ case needs distributed graph queries or graph algorithms, that's the kind of eng
uv add lance-csr
```

To write Lance datasets or query them on disk, also add `pylance` (`uv add lance-csr pylance`). lance-csr reads
Lance with its own built-in Lance library, so any `pylance` version that writes a file format Lance 13 reads
works; see [Lance datasets](https://lance-csr.hdclabs.ai/lance/).

Prebuilt wheels cover Linux x86-64 and aarch64, native Apple Silicon and Windows x86-64 (CPython 3.12+), so no
Rust toolchain is needed. On Windows, the same command installs the native Windows wheel; you don't need WSL2,
though lance-csr works there too, with the Linux wheel. From Rust, run `cargo add lance-csr` and see the
Expand Down
2 changes: 1 addition & 1 deletion crates/lance-csr-python/src/graph.rs
Original file line number Diff line number Diff line change
Expand Up @@ -771,7 +771,7 @@ fn normalize_record_batch(batch: RecordBatch) -> PyResult<RecordBatch> {

/// True for `lance.LanceDataset` and its subclasses.
fn is_lance_dataset(value: &Bound<'_, PyAny>) -> PyResult<bool> {
// pylance is a hard dependency, so a failed import only happens in a broken install.
// pylance is optional: without it the caller can't hold a LanceDataset to pass in.
match value.py().import("lance") {
Ok(lance) => value.is_instance(&lance.getattr("LanceDataset")?),
Err(_) => Ok(false),
Expand Down
3 changes: 2 additions & 1 deletion docs/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ Prebuilt wheels cover **Linux x86-64 and aarch64** (glibc 2.28+: RHEL 8, Ubuntu
toolchain. On Windows you can also use lance-csr inside WSL2, where it installs the Linux wheel. Other platforms
build from the source distribution, which needs Rust and `protoc` (see [Contributing](contributing.md)).

The package depends on `pyarrow>=14` and `pylance` 13.x, which uv installs for you.
The package depends only on `pyarrow>=14`, which uv installs for you. To write Lance datasets or query them on
disk, also add `pylance` (`uv add lance-csr pylance`); see [Lance datasets](lance.md).

!!! tip "Using Rust?"

Expand Down
17 changes: 12 additions & 5 deletions docs/lance.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,18 @@
fast random access and vector indexes. lance-csr can query Lance datasets on disk without loading them into
memory first.

lance-csr reads Lance with its own built-in copy of the Lance Rust library, version 13, so it doesn't depend on
[`pylance`](https://pypi.org/project/pylance/), Lance's Python package. You still need `pylance` to write datasets
and to open the `lance.dataset(...)` handles you pass in, so add it next to lance-csr:

```bash
uv add lance-csr pylance
```

Any `pylance` version works as long as it writes a file format Lance 13 can read. Lance reads datasets written
by older versions, and `pylance` 13 and 14 both write file format 2.2 by default, which Lance 13 reads. A dataset
written in a newer format than Lance 13 knows fails to open with an error.

## Lazy, version-pinned reads

Pass `lance.dataset(...)` handles to `CypherEngine` and the engine reads them **lazily**: nothing is scanned at
Expand Down Expand Up @@ -43,11 +55,6 @@ stay invisible until you call `checkout_latest()`. That gives every query a stab
Each dataset is pinned separately. The versions across tables are not a transactional multi-table
snapshot; if a writer updates `Person` and `KNOWS` one after the other, call `checkout_latest()` after both commits.

!!! warning "Use pylance 13.x to write"

The engine is built against Lance 13. Datasets written by an older or newer major version of `pylance`
may use a file format it can't read. Installing `lance-csr` pins a compatible `pylance` for you.

## `checkout_latest()` { #checkout-latest }

`checkout_latest()` moves every Lance dataset to its latest version. It's named after Lance's own
Expand Down
4 changes: 2 additions & 2 deletions examples/lance_snapshots.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
"""
Disk-backed CypherEngine: pinned snapshots, checkout_latest(), and streamed results.

Requirements: an installed lance-csr wheel (or `maturin develop` in python/), which
pulls in a compatible pylance 13.x.
Requirements: an installed lance-csr wheel (or `maturin develop` in python/) and pylance,
which writes and opens the datasets.

Run:
python examples/lance_snapshots.py
Expand Down
8 changes: 5 additions & 3 deletions python/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,10 @@ with an in-memory CSR adjacency, and fetches target rows by position instead of
rebuilt on `checkout_latest()` when the relationship table changes, and the per-label id index when its node
table changes. Results are identical; peak memory grows by about 95 bytes per edge while the CSR is built (both directions).

Write Lance data with `pylance` 13.x: the engine is built against Lance 13 and older or newer
majors may write files it cannot read.
lance-csr reads Lance through its own built-in Lance 13 library, so it doesn't depend on `pylance`.
Install `pylance` yourself to write datasets and open the `lance.dataset(...)` handles you pass in.
Any version that writes a file format Lance 13 reads works; `pylance` 13 and 14 write format 2.2
by default.

### 4. Tables created with LanceDB

Expand Down Expand Up @@ -208,7 +210,7 @@ r2 = engine.execute(
## Requirements

- Python 3.12 or newer (3.12, 3.13 and 3.14 tested); macOS arm64, Linux x86-64 or aarch64, or Windows x86-64 (natively or in WSL2)
- `pylance` 13.x for writing Lance datasets
- `pylance`, installed separately, to write Lance datasets or open them on disk

## Contributing

Expand Down
2 changes: 1 addition & 1 deletion python/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ name = "lance-csr"
version = "0.10.0"
dependencies = [
"pyarrow>=14",
"pylance>=13.0.0,<14",
]
description = "Cypher graph queries over Lance datasets, built on DataFusion with a CSR adjacency index (a fork of lance-graph)"
authors = [{ name = "The lance-csr Authors" }]
Expand Down Expand Up @@ -55,6 +54,7 @@ dev = [
"pyright",
"pyarrow-stubs>=20.0.0.20260819",
"pytest-xdist>=3.8.0",
"pylance>=13.0.0",
]

[tool.ruff]
Expand Down
Loading
Loading