Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 

README.md

ty-lsp

Python language server (ty) for Claude Code, providing static type checking and code intelligence.

Supported Extensions

.py, .pyi

Requirements

  • uv must be installed

The LSP is automatically installed via uvx ty@latest server on first use - no manual installation required.

Notes

Monorepo Usage

For monorepos with multiple Python projects, start Claude Code from within the specific project directory:

# Instead of:
cd ~/Code/monorepo && claude

# Do this:
cd ~/Code/monorepo/my-python-project && claude

This ensures ty uses the correct project's .venv and pyproject.toml.

Testing

After installing, restart Claude Code. Create a file with type errors:

# test.py
x: int = "not an int"

def add(a: int, b: int) -> int:
    return a + b

result: str = add(1, 2)

Verify the LSP is running:

ps aux | grep "ty server"

Edit or read the file - diagnostics should appear in system reminders:

test.py:
  ✘ [Line 2:10] Object of type `Literal["not an int"]` is not assignable to `int` [invalid-assignment] (ty)
  ✘ [Line 7:15] Object of type `int` is not assignable to `str` [invalid-assignment] (ty)

More Information