SDK for interacting with lsproxy container
Project description
LSProxy SDK
A Python SDK for interacting with the LSProxy container, providing language-server protocol functionality for code analysis across multiple languages.
Features
- Symbol definition lookup
- Reference lookup across files
- Support for analyzing Python, TypeScript/JavaScript, and Rust
- Built-in retry logic and error handling
- Pydantic models for type safety
Try it out!
If you just want to get a feel for lsproxy
try out the tutorial. Just clone the repo and run:
./examples/tutorial/run.sh
Installation
pip install lsproxy-sdk
Usage
- Start the LSProxy container:
docker run --rm -d -p 4444:4444 -v "/path/to/your/code:/mnt/workspace" --name lsproxy agenticlabs/lsproxy:0.1.0a1
- Use the SDK:
from lsproxy import Lsproxy
lsp = Lsproxy()
List all files in the workspace
lsp.list_files()
Get symbols in a file
lsp.definitions_in_file(path="path/to/file.py")
Get references to a symbol
# Find all references to a symbol at a specific position
references = lsp.find_references(
GetReferencesRequest(
identifier_position=FilePosition(
file_path="path/to/file.py",
line=10,
character=15
),
include_code_context_lines=2, # Show 2 lines of context around each reference
include_declaration=True # Include the original declaration
)
)
# Print found references
for ref in references.references:
print(f"Reference in {ref.file_path} at line {ref.range.start.line}")
if ref.code_context:
print(ref.code_context)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
lsproxy_sdk-0.1.1.tar.gz
(4.9 kB
view details)
Built Distribution
File details
Details for the file lsproxy_sdk-0.1.1.tar.gz
.
File metadata
- Download URL: lsproxy_sdk-0.1.1.tar.gz
- Upload date:
- Size: 4.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f9862a1d7df77905bcdde0ec93808cc95fbef80e4a05332574c589158982a1a7 |
|
MD5 | 49773c407903fc1df12ad17b9f758d8e |
|
BLAKE2b-256 | 8700ac6ed57cfc3c8acfb0f56568bf4bfefef68677ab27e270d69a828accf89c |
File details
Details for the file lsproxy_sdk-0.1.1-py3-none-any.whl
.
File metadata
- Download URL: lsproxy_sdk-0.1.1-py3-none-any.whl
- Upload date:
- Size: 5.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 69d6cef8720f82bc36241958d70dda3f0e2f02435854931f33ecf305880bac5e |
|
MD5 | 51726b603dff2811ec8ca3a2542fe583 |
|
BLAKE2b-256 | f7b65ea5b9464c833b9cd5766c90c9b5240384cc0ff5647e02fbbe4c78c295da |