skillfed

lsprotocol

Python types for Language Server Protocol.

lsprotocol v2025.0.0 2.3M downloads/30d#3,119 on PyPI157
Permissive license Active released

What it is and what it does

lsprotocol is a Python library that provides object-oriented type definitions for the Language Server Protocol (LSP), a standardized protocol used by code editors to communicate with language tools. It includes both the type classes themselves and built-in converters to serialize and deserialize LSP messages to and from JSON.

You use it by importing type classes from lsprotocol.types to construct protocol messages, and optionally using lsprotocol.converters to handle JSON serialization. It depends on attrs and cattrs for class definitions and conversion logic. The library is kept up to date with the latest version of LSP.

Use it for:

  • Building a language server that needs to send and receive LSP protocol messages with type safety
  • Creating an LSP client that communicates with language servers using standardized message structures
  • Serializing LSP types to JSON for transmission over a network or stdio connection
  • Validating protocol messages against the official LSP specification types

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Provides Python object types and converters for the Language Server Protocol, enabling you to build LSP clients and servers with standardized message structures.

Yes. lsprotocol is actively maintained with no known vulnerabilities, carries a permissive license, and installs with minimal friction. It is the standard way to work with LSP types in Python. Install it if you are building any LSP-based tool.

Install

lsprotocol on PyPI

pip

pip install lsprotocol

uv

uv add lsprotocol

poetry

poetry add lsprotocol

Installing lsprotocol

Before you install

Low friction install with only two runtime dependencies. Active maintenance with recent commits since first release in 2022.

License in practice

Permissive license allows free use, modification, and distribution with minimal restrictions.

Quickstart

python -m pip install lsprotocol

from lsprotocol import types
position = types.Position(line=10, character=3)

Verify before relying

  • Whether the generated types stay synchronized with the official LSP specification across all versions
  • Performance characteristics when serializing/deserializing large or deeply nested protocol messages

Package facts

License not declared (permissive)
Python support supports the current Python release (>=3.8)
Install friction low — pure-Python wheel
Runtime dependencies 2 — attrs, cattrs
Maintenance actively maintained — 423 days since the last release
Last repo commit
First released
Downloads 2,346,046/month — #3,119 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: lsprotocol-2025.0.0-py3-none-any.whl

Development Status :: 4 - BetaLicense :: OSI Approved :: MIT LicenseProgramming Language :: PythonProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Programming Language :: Python :: Implementation :: CPythonProgramming Language :: Python :: Implementation :: PyPy

Tags

language server protocol typeslsp types pythonlanguage server implementationlsp client server typesprotocol message structures
language-server-protocoltype-definitionslsp

More Software Development packages