Files
lancedb/AGENTS.md
Will JonesandClaude Opus 5.5 b4459f35e6 docs: teach agents Embedded/Enterprise terms and deprecation rules (#5108)
## Summary

Coding agents keep writing "local/remote tables" in new docs,
docstrings, and error messages, partly because `AGENTS.md` itself still
describes the two backends that way. Recent PRs also removed released
APIs instead of deprecating them, and put migration notes in the user
guide. This updates `AGENTS.md` so implementing agents learn these
conventions up front:

- Use "Embedded" and "Enterprise" in user-facing text. `remote` stays as
the internal module, feature, and type name.
- Deprecate released public APIs rather than removing them, and don't
reuse a released name for a different meaning.
- Keep `docs/web` guides evergreen. Deprecations are marked in
docstrings, and breaking changes go in a `BREAKING CHANGE:` paragraph in
the PR body.

`REVIEW.md` gets the matching wording fix and a short checklist so
automated reviews catch the same things.

## Merge Risk

**Door:** two-way; agent guidance only.
**Blast Radius:** none

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-20 09:08:22 -08:00

9.2 KiB

LanceDB is a database designed for retrieval, including vector, full-text, and hybrid search. It is a wrapper around Lance. There are two editions: LanceDB Embedded (in-process, like SQLite) and LanceDB Enterprise (a server cluster reached over HTTP).

In user-facing text (docs, docstrings, error messages, examples), always say "Embedded" and "Enterprise". Don't say "local" or "remote" tables. ("LanceDB Cloud" means only the legacy hosted service, not Enterprise.) The code implements Enterprise in the remote module, the remote cargo feature, and Remote* types. Those names are internal and shouldn't leak into user-facing text.

The core of LanceDB is written in Rust. There are bindings in Python, Typescript, and Java.

Project layout:

  • rust/lancedb: The LanceDB core Rust implementation.
  • python: The Python bindings, using PyO3.
  • nodejs: The Typescript bindings, using napi-rs
  • java: The Java bindings

Common commands:

  • Check for compiler errors: cargo check --quiet --features remote --tests --examples
  • Run tests: cargo test --quiet --features remote --tests
  • Run specific test: cargo test --quiet --features remote -p <package_name> --test <test_name>
  • Lint: cargo clippy --quiet --features remote --tests --examples
  • Format Rust: cargo fmt --all
  • Use repository-defined Cargo profiles instead of ad hoc LTO overrides.
  • Use release-with-debug for benchmarks and profiling so optimized builds keep debug symbols without a rebuild.
  • Use release-no-lto only for local debugging, IO-bound benchmarks, or compile-time-sensitive performance investigation where LTO would not affect the measured bottleneck.
  • Format Python: ruff format .
  • Lint Python: ruff check .
  • Bootstrap Python dev env: cd python && uv run --extra tests --extra dev maturin develop --extras tests,dev
  • Run Python tests: cd python && uv run --extra tests pytest python/tests -vv --durations=10 -m "not slow and not s3_test"
  • Run specific Python test: cd python && uv run --extra tests pytest python/tests/<test_file>.py::<test_name> -q

For Python validation, prefer the uv-managed environment declared by python/uv.lock. Do not treat system python, global pytest, or missing editable-install errors as final blockers; bootstrap or enter the uv environment instead. If lancedb._lancedb is missing or stale, or if Rust/PyO3 binding code changed, rebuild the Python extension with the bootstrap command above before running tests.

Before committing changes, run formatting for every language you touched. At minimum:

  • Rust changes: run cargo fmt --all.
  • Python changes: run ruff format . and ruff check . from the repository root, and run targeted tests through cd python && uv run ....
  • TypeScript changes: run the relevant pnpm lint, format, build, and docs commands in nodejs.

Before creating a PR, the exact value passed to gh pr create --title must follow Conventional Commits, such as fix: support nested field paths in native index creation or feat(python): add dataset multiprocessing support. Do not use a plain natural language summary like Support nested field paths in native index creation as the PR title. The semantic-release check uses the PR title and body as the merge commit message, so a non-conventional PR title will fail CI. After creating a PR, read the remote PR title back and fix it immediately if it is not conventional.

Coding tips

  • When writing Rust doctests for things that require a connection or table reference, write them as a function instead of a fully executable test. This allows type checking to run but avoids needing a full test environment. For example:
    /// ```
    /// use lance_index::scalar::FullTextSearchQuery;
    /// use lancedb::query::{QueryBase, ExecutableQuery};
    ///
    /// # use lancedb::Table;
    /// # async fn query(table: &Table) -> Result<(), Box<dyn std::error::Error>> {
    /// let results = table.query()
    ///     .full_text_search(FullTextSearchQuery::new("hello world".into()))
    ///     .execute()
    ///     .await?;
    /// # Ok(())
    /// # }
    /// ```
    

Example plan: adding a new method on Table

Adding a new method involves first adding it to the Rust core, then exposing it in the Python and TypeScript bindings. Every method needs an Embedded and an Enterprise implementation. Enterprise tables are implemented via a HTTP API in the remote module and require the remote cargo feature flag to be enabled. Python has both sync and async methods.

Rust core changes:

  1. Add method on Table struct in rust/lancedb/src/table.rs (calls BaseTable trait).
  2. Add method to BaseTable trait in rust/lancedb/src/table.rs.
  3. Implement new trait method on NativeTable in rust/lancedb/src/table.rs.
    • Test with unit test in rust/lancedb/src/table.rs.
  4. Implement new trait method on RemoteTable in rust/lancedb/src/remote/table.rs.
    • Test with unit test in rust/lancedb/src/remote/table.rs against mocked endpoint.

Python bindings changes:

  1. Add PyO3 method binding in python/src/table.rs. Run make develop to compile bindings.
  2. Add types for PyO3 method in python/python/lancedb/_lancedb.pyi.
  3. Add method to AsyncTable class in python/python/lancedb/table.py.
  4. Add abstract method to Table abstract base class in python/python/lancedb/table.py.
  5. Add concrete sync method to LanceTable class in python/python/lancedb/table.py.
    • Should use LOOP.run() to call the corresponding AsyncTable method.
  6. Add concrete sync method to RemoteTable class in python/python/lancedb/remote/table.py.
  7. Add unit test in python/tests/test_table.py.
  8. If you added a new public class or module-level function (not just a method on an existing class), expose it in the API reference. See "Python API reference" below.

TypeScript bindings changes:

  1. Add napi-rs method binding on Table in nodejs/src/table.rs.
  2. Run pnpm build to generate TypeScript definitions.
  3. Add typescript method on abstract class Table in nodejs/lancedb/table.ts.
  4. Add concrete method on LocalTable class in nodejs/lancedb/table.ts.
    • Note: despite the name, this class is also used for Enterprise tables.
  5. Add test in nodejs/__test__/table.test.ts.
  6. Run pnpm run docs to generate TypeScript documentation.

Python API reference

docs/src/python/python.md is the entire Python API reference. It is maintained by hand, and anything not listed there is not rendered at all, so new public classes and module-level functions have to be added explicitly. How depends on the module:

  • lancedb.index, lancedb.embeddings, lancedb.remote, and lancedb.rerankers are rendered by a single directive each, driven by the module's __all__. Add the new name to __all__ and it appears; forget, and it is silently omitted.
  • Everything else (lancedb, lancedb.table, lancedb.query, lancedb.db, ...) is listed symbol by symbol. Add a ::: lancedb.<module>.<Name> line to the matching section, and remember that the page separates synchronous and asynchronous APIs.

Deliberately undocumented: concrete implementations reached through an abstract base (LanceTable, LanceDBConnection, RemoteDBConnection), query base classes already covered by inherited_members, and internal helpers.

Cross-references in docstrings use mkdocstrings syntax, [text][lancedb.table.Table]. Plain relative links such as [Table](Table) do not resolve. To check your work:

pip install -r docs/requirements.txt
cd docs && PYTHONPATH=. mkdocs build

The docs site only builds on pushes to main, so this is not covered by PR CI.

Review Guidelines

Please consider the following when reviewing code contributions.

Rust API design

  • Design public APIs so they can be evolved easily in the future without breaking changes. Often this means using builder patterns or options structs instead of long argument lists.
  • For public APIs, prefer inputs that use Into<T> or AsRef<T> traits to allow more flexible inputs. For example, use name: Into<String> instead of name: String, so we don't have to write func("my_string".to_string()).

Testing

  • Ensure all new public APIs have documentation and examples.
  • Ensure that all bugfixes and features have corresponding tests. We do not merge code without tests.

Documentation

  • New features must include updates to the rust documentation comments. Link to relevant structs and methods to increase the value of documentation.
  • User guides (docs/web) are evergreen: document only the current API. Don't add migration tables or deprecation notices there. Mark deprecated APIs in their docstrings, which feed the API reference.

Breaking changes and deprecation

  • Prefer deprecating over removing a released public API. When the new name differs from the old one, keep the old one as a deprecated alias (#[deprecated] in Rust, DeprecationWarning in Python, @deprecated in TypeScript), with a test that it still works.
  • Don't reuse a released public name for something with a different meaning. Callers get a confusing error instead of a deprecation warning.
  • For a breaking change, add ! to the PR title and start the PR body with a BREAKING CHANGE: paragraph covering the new behavior, the old behavior, and how to migrate. Release notes are generated from it.