GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com โ€” GitHub - Mazyod/lsp-python-types: LSP types for Python

BranchesTags
Open more actions menu

Latest commit

 

History

318 Commits
318 Commits

Folders and files

NameName
Last commit message
Last commit date
.github/workflows
.github/workflows
 
 
.vscode
.vscode
 
 
assets
assets
 
 
docs
docs
 
 
examples
examples
 
 
lsp_types
lsp_types
 
 
playground
playground
 
 
tests
tests
 
 
.gitignore
.gitignore
 
 
AGENTS.md
AGENTS.md
 
 
CLAUDE.md
CLAUDE.md
 
 
LICENSE
LICENSE
 
 
Makefile
Makefile
 
 
README.md
README.md
 
 
pyproject.toml
pyproject.toml
 
 
renovate.json
renovate.json
 
 
uv.lock
uv.lock
 
 

Repository files navigation

LSP Types

PyPI version Python Tests License: MIT

Typed Python interfaces for the Language Server Protocol, with async sessions and process pooling for Python language servers. Built on Sublime LSPโ€™s generated types. Python 3.12+; one runtime dependency, tomlkit.

๐Ÿง™ Meet your party

Pixel-art party: Pyright the blue sentinel, Pyrefly the coral artificer, ty the green scout, and Zuban the purple diplomat.

  • ๐Ÿ›ก๏ธ Pyright โ€” the sentinel. Broad typing support and configurable execution environments. Choose basedpyright for extra diagnostics, baselines and semantic highlighting.
  • ๐Ÿ”ง Pyrefly โ€” the artificer. Framework-aware analysis with opt-in regex and mock.patch checks.
  • ๐Ÿน ty โ€” the scout. Incremental analysis, explanatory diagnostics and precise type narrowing.
  • ๐Ÿค Zuban โ€” the diplomat. Mypy-compatible configuration and editor inference for untyped code.

๐Ÿš€ Start a session

pip install "lsp-types[pyrefly]"  # Or [ty] / [zuban]
import asyncio
from pathlib import Path
from tempfile import TemporaryDirectory

from lsp_types import Session
from lsp_types.pyrefly.backend import PyreflyBackend

async def main():
    with TemporaryDirectory() as workspace:
        session = await Session.create(
            PyreflyBackend(),
            base_path=Path(workspace),
            initial_code='answer: int = "oops"',
        )
        try:
            print(await session.get_diagnostics())
            await session.update_code("answer: int = 42")
            print(await session.get_diagnostics())  # []
        finally:
            await session.shutdown()

asyncio.run(main())

Swap in TyBackend, ZubanBackend, or PyrightBackend. For Pyright, install Node.js and npm install -g pyright (or basedpyright) separately. Sessions write backend configuration into base_path; use a dedicated workspace as above. For types alone, import lsp_types; no server is needed.

โœจ Features

All four backends support diagnostics, hover, completion, signature help and rename.

Feature Pyright basedpyright Pyrefly ty Zuban
Semantic highlighting โŒ โœ… โœ… โœ… โœ…
Completion documentation via resolve โœ… โœ… โŒ โŒ โœ…

Pyrefly returns completion items unchanged on resolve; ty does not support the request. ty hover returns the type without the symbol name.

๐Ÿ“– API & lifecycle ยท ๐ŸŽจ Semantic tokens ยท ๐Ÿงญ Backend guide ยท ๐ŸŽฎ Browser playground

๐Ÿ› ๏ธ Development

uv sync --all-extras --locked
npm install -g basedpyright
uv run pytest tests
uvx pyright --pythonpath .venv/bin/python
uvx ruff check .
make generate-latest-types

About

LSP types for Python

mazyod.com/lsp-python-types/

Topics

basedpyrightintellisenselsppyreflypyrightpython

Resources

Readme
License
Activity

Stars

3 stars

Watchers

0 watching

Forks

0 forks
Report repository

Releases

Used by

Contributors

Languages

You are visitor 01402503 โ€” GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800ร—600. No cookies required.