ty-python-lsp
Wires up Astral's ty, an extremely fast Python type checker, as an LSP server for Claude Code's built-in LSP tool. On .py / .pyi / .pyw file
Open source Repository Open in the app JSON README (API)
About
Wires up Astral's ty, an extremely fast Python type checker, as an LSP server for Claude Code's built-in LSP tool. On .py / .pyi / .pyw files Claude can use hover (inferred types and docstrings), go-to-definition, go-to-implementation, find-references, document and workspace symbol search, and call hierarchy. Configuration is auto-detected from pyproject.toml; no extra LSP settings required. Requires ty on PATH (uv tool install ty or pip install ty).
Details
- Kind
- Plugins
- Topic
- Developer tools
- Publisher
- andres-ortizl
- Origin
- marketplace
- Category
- ferramentas
- Stars
- 1
- Last push
- 2026-04-30T18:15:22Z
- Repository state
- ativo
- Added
- 2026-08-30 01:48:58
- Updated
- 2026-08-30 01:48:58
- Origin id
andres-ortizl/ty-lsp-claude-code-plugin/ty-python-lsp
README
# ty-lsp Claude Code plugin that wires up [`ty`](https://github.com/astral-sh/ty), Astral's extremely fast Python type checker, as an LSP server. Once installed, Claude Code's built-in `LSP` tool can use it for hover, go-to-definition, references, document symbols, and call hierarchy on Python files. ## Requirements - Claude Code `2.1.50+` - `ty` on your `PATH` Install `ty`: ```bash # uv (recommended) uv tool install ty # or pip pip install ty ``` Verify: ```bash ty --version ty server --help ``` ## Install ```bash # Add this repo as a marketplace /plugin marketplace add andres-ortizl/ty-lsp-claude-code-plugin # Then enable it /plugins # → Marketplaces → ty-lsp → Browse plugins → select `ty` → press i to install ``` Restart Claude Code after install. ### Local install (testing this repo) ```bash /plugin marketplace add /absolute/path/to/ty-lsp ``` ## What you get The Claude Code `LSP` tool exposes these operations against Python files via `ty`: - `hover` — inferred types and docstrings - `goToDefinition`, `goToImplementation` - `findReferences`, `documentSymbol`, `workspaceSymbol` - `prepareCallHierarchy`, `incomingCalls`, `outgoingCalls` ## Diagnostics & autofix Claude Code's `LSP` tool consumes symbol-intelligence operations only — it does **not** surface LSP diagnostics. So this plugin will not make ty's type errors appear in Claude's view directly. For actual error reporting and autofix, run the tools directly. Same setup that works in Zed works here: ```bash # Type-check the project ty check # Lint + autofix anything fixable ruff check --fix ruff format ``` A typical flow: - **CI / pre-commit:** `ty check` and `ruff check` block on errors that matter. - **Local autofix:** `ruff check --fix` clears most lint findings without human attention. - **Editor (Zed example):** `format_on_save` runs `source.fixAll.ruff` + `source.organizeImports.ruff` so most violations are gone before you ever see them. - **Claude Code hook (optional):** wire `ty check $CLAUDE_FILE_PATHS` into a `PostToolUse` hook on `Edit`/`Write` so Claude sees type errors after every edit. Tune the rules to your project — e.g. ruff with `extendSelect: ["ALL"]` and a small ignore list (`D`, `S101`, `ANN201`) is a sensible starting point. ## Configuration `ty` auto-detects `pyproject.toml` for project configuration. No additional settings are required. ## License MIT