Skip to main content

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

Metadata

Release files for lsp-types 0.26.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for lsp-types 0.26.0
File Size Uploaded Provenance Actions
lsp_types-0.26.0.tar.gz 87.7 kB With provenance Details for lsp_types-0.26.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for lsp-types 0.26.0
File Interpreter ABI Platform Actions
lsp_types-0.26.0-py3-none-any.whl Python 3 none any Details for lsp_types-0.26.0-py3-none-any.whl

Total release size: 183.4 kB

Release files / lsp_types-0.26.0.tar.gz

Download URL lsp_types-0.26.0.tar.gz
Size 87.7 kB
Tags Source
SHA-256 checksum
How to use checksums
68cacf9cfff423a4c7ab5fd7e8f6ce238aa26535c57b3fb59cc9d1f6e98214ef
BLAKE2b-256 checksum
How to use checksums
6cde1f10552d2938819e1fd9f4ca31b4b95de7ccba5c8a33c75ae5aad4dece05
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 2, 2026.

Transparency log

Release files / lsp_types-0.26.0-py3-none-any.whl

Download URL lsp_types-0.26.0-py3-none-any.whl
Size 95.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7795eb334a0f91da1e69f82e99d837db0705290de2277eedc35cc75e965005ca
BLAKE2b-256 checksum
How to use checksums
c79fdd3cd7b32adebea6f9a4d206ab3f92a4ffe4f0baca57b1b6021e0b62930c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 2, 2026.

Transparency log

Security for lsp-types 0.26.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for lsp_types-0.26.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 2, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.26.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page