pygls
A pythonic generic language server (pronounced like 'pie glass')
What it is and what it does
pygls is a Python framework that implements the Language Server Protocol (LSP), a standardized way for editors and IDEs to communicate with language-aware tools. It lets you build a language server—a program that provides features like code completion, error diagnostics, and symbol navigation—by decorating Python functions with feature handlers and starting the server with a single call.
The framework handles all the LSP protocol machinery, including message parsing, workspace management, and client communication. You define what your server does by writing handler functions for specific LSP features (like TEXT_DOCUMENT_COMPLETION or TEXT_DOCUMENT_HOVER), and pygls routes incoming requests to them. It depends on attrs for data classes, cattrs for serialization, and lsprotocol for LSP type definitions, keeping the dependency footprint small.
Use it for:
- Build a language server for a domain-specific language or custom syntax to integrate with VSCode, Neovim, or other LSP-compatible editors.
- Add code completion and diagnostics to an existing language or tool by wrapping it in an LSP server.
- Create editor-agnostic language support without writing separate plugins for each editor.
- Prototype or experiment with language features and editor integrations quickly using Python.
- Extend an existing Python project with IDE-like features (completion, linting, navigation) for users.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
pygls is a Python framework for building Language Servers that implement the Language Server Protocol, enabling editors and IDEs to provide code completion, diagnostics, and other language-aware features.
Yes. pygls is actively maintained, has low install friction, carries no known vulnerabilities, and uses a permissive license. It is the right choice if you need to build a language server in Python and want to support multiple editors without vendor lock-in. Install it if you are building or extending a language server; skip it if you only need to use an existing language server.
Install
pygls on PyPI
pip
pip install pyglsuv
uv add pyglspoetry
poetry add pyglsInstalling pygls
Before you install
Low install friction with a pure Python wheel and only three runtime dependencies (attrs, cattrs, lsprotocol). Actively maintained with a release 142 days ago and support for current Python versions (3.9 through 3.14).
License in practice
Apache-2.0 is a permissive license; you can use pygls in commercial and private projects with minimal restrictions, provided you include the license notice.
Quickstart
pip install pygls
from pygls.lsp.server import LanguageServer
from lsprotocol import types
server = LanguageServer("my-server", "v0.1")
@server.feature(types.TEXT_DOCUMENT_COMPLETION)
def completions(params: types.CompletionParams):
return types.CompletionList(is_incomplete=False, items=[])
server.start_io()
Verify before relying
- Whether pygls handles editor-specific protocol variations or edge cases beyond the LSP specification
- Performance characteristics when handling large files or many concurrent language server requests
- Availability of examples or templates for common language server use cases
Package facts
| License | Apache-2.0 (permissive) |
| Python support | supports the current Python release (>=3.9) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 3 — attrs, cattrs, lsprotocol |
| Maintenance | actively maintained — 142 days since the last release |
| First released | |
| Downloads | 2,110,125/month — #3,287 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: pygls-2.1.1-py3-none-any.whl
Tags
More Application Frameworks packages
FastAPI is a Python web framework for building…
permissive · top 100 on PyPI
annotated-docProvides a way to document function parameters,…
permissive · top 100 on PyPI
textualTextual is a Python framework for building…
permissive · top 100 on PyPI
typerTyper builds command-line applications from…
permissive · top 1,000 on PyPI
mcpBuild and connect to Model Context Protocol…
permissive · top 1,000 on PyPI
WerkzeugWerkzeug is a WSGI utility library providing…
permissive · top 1,000 on PyPI
jedi-language-serverA Language Server Protocol implementation for…
permissive · top 15,000 on PyPI
jupyterlab-lspAdds Language Server Protocol (LSP) integration…
permissive · top 15,000 on PyPI
lsprotocolProvides Python object types and converters for…
permissive · top 5,000 on PyPI
ruff-lspProvides a Language Server Protocol bridge to…
permissive · top 15,000 on PyPI
esbonioA Language Server Protocol implementation for…
permissive · top 15,000 on PyPI
jupyter-lspBridges Language Server Protocol servers to…
permissive · top 1,000 on PyPI
pyvimA Vi/Vim-like text editor implemented entirely…
permissive · top 15,000 on PyPI
robotcodeRobotCode is a language server and IDE toolkit…
permissive · top 15,000 on PyPI
zubanZuban is a Rust-based Python language server…
agpl · top 15,000 on PyPI
tyA fast Python type checker and language server…
permissive · top 1,000 on PyPI