Skip to content

Add RemoteContext Python bindings for HTTP client#95

Merged
beinan merged 2 commits into
lance-format:mainfrom
beinan:beinan/python-remote-context
Jun 17, 2026
Merged

Add RemoteContext Python bindings for HTTP client#95
beinan merged 2 commits into
lance-format:mainfrom
beinan:beinan/python-remote-context

Conversation

@beinan

@beinan beinan commented Jun 17, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Expose lance-context-client's RemoteContextStore to Python via PyO3, enabling Python code to talk to a remote lance-context-server over HTTP
  • Add async RemoteContext wrapper class mirroring the AsyncContext pattern
  • Fix pre-existing test mock signature mismatch in test_embeddings.py

Changes

  • python/Cargo.toml: Add lance-context-api and lance-context-client path dependencies
  • python/src/lib.rs: Implement RemoteContext pyclass with all ContextStoreApi methods
  • python/python/lance_context/api.py: Add async RemoteContext wrapper class
  • python/python/lance_context/__init__.py: Export RemoteContext
  • python/tests/test_embeddings.py: Fix _DummyInner.add() signature to include state_metadata

Usage

import asyncio
from lance_context import RemoteContext

async def main():
    ctx = await RemoteContext.connect("http://localhost:3000", "my-context")
    await ctx.add(role="user", content="hello world")
    records = await ctx.list()
    print(records)

asyncio.run(main())

Test plan

  • maturin develop --release builds successfully
  • RemoteContext is exported from lance_context package
  • Existing tests pass (143/148 pass; 2 S3 tests skip due to missing bucket, 2 skipped, 1 xfail)
  • Smoke test against running lance-context-server

🤖 Generated with Claude Code

@beinan beinan marked this pull request as ready for review June 17, 2026 05:44
@beinan beinan force-pushed the beinan/python-remote-context branch from 449f727 to b5279da Compare June 17, 2026 05:48
Expose lance-context-client's RemoteContextStore to Python via PyO3,
enabling Python code to talk to a remote lance-context-server over HTTP.

- Add lance-context-api and lance-context-client deps to python/Cargo.toml
- Implement RemoteContext pyclass wrapping RemoteContextStore
- Add async Python wrapper mirroring AsyncContext pattern
- Export RemoteContext from lance_context package
- Fix test_embeddings mock to match current _inner.add() signature

Co-Authored-By: Beinan Wang <beinanwang@microsoft.com>
@beinan beinan force-pushed the beinan/python-remote-context branch from b5279da to 4a779e4 Compare June 17, 2026 05:55
Co-Authored-By: Beinan Wang <beinanwang@microsoft.com>
@beinan beinan merged commit ef02306 into lance-format:main Jun 17, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant