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

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

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: lsproxy_sdk-0.1.0.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.0.tar.gz
Algorithm Hash digest
SHA256 ae996b37b691652cc887de47e805b6531e4a45136a7a55e1b21f257e5cd81aae
MD5 a4e25d1416294ca9a830d5f75570431d
BLAKE2b-256 4b1a2f2e2df2fb4bd48ceb1489f964bb565142f0e544d8de49be0cffa2f06963

See more details on using hashes here.

File details

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

File metadata

  • Download URL: lsproxy_sdk-0.1.0-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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e3d7891f056635db8d1b5a949469bae1385b96f7b56926c576ac81204b3a6413
MD5 fad883de42d7a05007aeb84554b2ef93
BLAKE2b-256 bf7b3f78d2557c4a9db5777c053772543403f4660f3a8a2fff4c404914f24cb3

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