Skip to main content

LSP integration for Aurora - code intelligence, dead code detection, and impact analysis

Reason this release was yanked:

bundled with original

Project description

Aurora LSP

LSP integration for Aurora - code intelligence, dead code detection, and impact analysis.

Built on multilspy (Microsoft) with custom layers for import filtering and code analysis.

Features

  • Find Usages (excluding imports) - Distinguish actual code usage from import statements
  • Dead Code Detection - Find functions/classes with 0 usages
  • Linting - Get errors, warnings, hints via LSP diagnostics
  • Call Hierarchy - Find callers of a function (where supported)

Supported Languages

Language LSP Server Import Filtering Call Hierarchy
Python Pyright Limited
TypeScript tsserver
JavaScript tsserver
Rust rust-analyzer
Go gopls
Java Eclipse JDT
Ruby Solargraph Limited
C# OmniSharp
Dart Dart Analysis
Kotlin kotlin-lsp Limited

Installation

pip install aurora-lsp

Usage

Basic Usage

from aurora_lsp import AuroraLSP

# Initialize with workspace path
lsp = AuroraLSP("/path/to/project")

# Find usages of a symbol (excluding imports)
result = lsp.find_usages("src/main.py", line=10, col=5)
print(f"Found {result['total_usages']} usages ({result['total_imports']} imports filtered)")

# Get usage summary with impact assessment
summary = lsp.get_usage_summary("src/main.py", line=10, col=5, symbol_name="MyClass")
print(f"Impact: {summary['impact']} ({summary['files_affected']} files affected)")

# Find dead code
dead = lsp.find_dead_code()
for item in dead:
    print(f"Unused: {item['name']} ({item['kind']}) in {item['file']}:{item['line']}")

# Lint a directory
diags = lsp.lint("src/")
print(f"{diags['total_errors']} errors, {diags['total_warnings']} warnings")

# Find callers of a function
callers = lsp.get_callers("src/utils.py", line=25, col=0)
for caller in callers:
    print(f"Called by: {caller['name']} in {caller['file']}")

# Clean up
lsp.close()

Context Manager

from aurora_lsp import AuroraLSP

with AuroraLSP("/path/to/project") as lsp:
    dead = lsp.find_dead_code()
    print(f"Found {len(dead)} dead code items")
# Server connections closed automatically

Convenience Functions

from aurora_lsp import find_usages, find_dead_code, lint

# One-off operations (creates temporary LSP instance)
result = find_usages("src/main.py", line=10, col=5)
dead = find_dead_code("src/")
diags = lint("src/")

API Reference

AuroraLSP

Main facade class providing synchronous API.

find_usages(file_path, line, col, include_imports=False) -> dict

Find usages of a symbol.

Returns:

  • usages: List of usage locations with context
  • imports: List of import locations
  • total_usages: Count of actual usages
  • total_imports: Count of import statements

get_usage_summary(file_path, line, col, symbol_name=None) -> dict

Get comprehensive usage summary.

Returns:

  • symbol: Symbol name
  • total_usages: Usage count
  • total_imports: Import count
  • impact: 'low' (<3), 'medium' (3-10), 'high' (>10)
  • files_affected: Number of files with usages
  • usages_by_file: Usages grouped by file

find_dead_code(path=None, include_private=False) -> list[dict]

Find functions/classes with 0 usages.

Returns: List of items with:

  • file: File path
  • line: Line number
  • name: Symbol name
  • kind: 'function', 'class', or 'method'
  • imports: Number of times imported but never used

lint(path=None, severity_filter=None) -> dict

Get linting diagnostics.

Returns:

  • errors: List of errors
  • warnings: List of warnings
  • hints: List of hints
  • total_errors, total_warnings, total_hints: Counts

get_callers(file_path, line, col) -> list[dict]

Find functions that call this symbol.

Returns: List of items with:

  • file: File path
  • line: Line number
  • name: Function name

Architecture

┌─────────────────────────────────────────┐
│  AuroraLSP (facade.py)                  │  High-level sync API
├─────────────────────────────────────────┤
│  CodeAnalyzer (analysis.py)             │  Dead code, usage summary
│  DiagnosticsFormatter (diagnostics.py)  │  Linting
│  ImportFilter (filters.py)              │  Import vs usage
├─────────────────────────────────────────┤
│  AuroraLSPClient (client.py)            │  Async LSP operations
├─────────────────────────────────────────┤
│  multilspy (Microsoft)                  │  LSP server management
└─────────────────────────────────────────┘

Development

# Install dev dependencies
pip install -e ".[dev]"

# Run tests
pytest tests/

# Type checking
mypy src/

License

MIT

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

aurora_lsp-0.1.0.tar.gz (31.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

aurora_lsp-0.1.0-py3-none-any.whl (16.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: aurora_lsp-0.1.0.tar.gz
  • Upload date:
  • Size: 31.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for aurora_lsp-0.1.0.tar.gz
Algorithm Hash digest
SHA256 6071ef4bc798348cf7f03316875485bafa7da6ffb00e174eb132e0b4ed224302
MD5 b823a681c1bb3a2a2cc5a9e30e9e5007
BLAKE2b-256 4c1ad1d706cf74252975b281f3a1cece07d260b029e2c6eb590ec1a28bda3ca7

See more details on using hashes here.

File details

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

File metadata

  • Download URL: aurora_lsp-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 16.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for aurora_lsp-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d0300610e9537b5b307d7f249266ed7ee50edcf521d1759d188afc0ea630b686
MD5 7d66ca5a54d00bcb7a5196f8b7e3d4b0
BLAKE2b-256 498ddbf5eb89d49f26f76eaf78870d45885b0aeeefbd1dbc48ce8cc38f6459e1

See more details on using hashes here.

Supported by

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