Skip to main content

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 at demo.lsproxy.dev

Installation

pip install lsproxy-sdk

Usage

  1. 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
  1. 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


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.2.tar.gz (4.8 kB view details)

Uploaded Source

Built Distribution

lsproxy_sdk-0.1.2-py3-none-any.whl (5.4 kB view details)

Uploaded Python 3

File details

Details for the file lsproxy_sdk-0.1.2.tar.gz.

File metadata

  • Download URL: lsproxy_sdk-0.1.2.tar.gz
  • Upload date:
  • Size: 4.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for lsproxy_sdk-0.1.2.tar.gz
Algorithm Hash digest
SHA256 c9871881aaf1ff9b787af978b29609a2d184521d27626452e33c8a395f528796
MD5 f65edf67725e72c2d8af3f87579e2138
BLAKE2b-256 ac1f5515929b57b29fcb580186ba0c003bc840f169bc7b7bacbe7c8e7ba8d86d

See more details on using hashes here.

File details

Details for the file lsproxy_sdk-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: lsproxy_sdk-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 5.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for lsproxy_sdk-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 740e493ca3cacf9ae099f589da1d81da11d98e22eb18ae7256070e003306f7e1
MD5 94f885cbad3d0f5c9092f75b47f4723f
BLAKE2b-256 e9bc5c80eb6fa20a26c87ffb438232f4e4ddcee4257edc8deb8f781b341863ff

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page