skillfed

pygls

A pythonic generic language server (pronounced like 'pie glass')

pygls v2.1.1 2.1M downloads/30d#3,287 on PyPI
Permissive license Apache-2.0 Active released

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 pygls

uv

uv add pygls

poetry

poetry add pygls

Installing 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

Programming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Programming Language :: Python :: 3.9

Tags

language server protocol pythonlsp implementation frameworkbuild language serverseditor code completionlanguage server developmentlsp python frameworkgeneric language server
language-server-protocoleditor-integrationlsp

More Application Frameworks packages