A pythonic generic language server (pronounced like 'pie glass')
Maintained. Last release 8 months ago.
pip install pyglspygls: The Generic Language Server Framework
pygls (pronounced like "pie glass") is a pythonic generic implementation of the Language Server Protocol for use as a foundation for writing your own Language Servers in just a few lines of code.
Quickstart
from pygls.lsp.server import LanguageServer
from lsprotocol import types
server = LanguageServer("example-server", "v0.1")
@server.feature(types.TEXT_DOCUMENT_COMPLETION)
def completions(params: types.CompletionParams):
items = []
document = server.workspace.get_text_document(params.text_document.uri)
current_line = document.lines[params.position.line].strip()
if current_line.endswith("hello."):
items = [
types.CompletionItem(label="world"),
types.CompletionItem(label="friend"),
]
return types.CompletionList(is_incomplete=False, items=items)
server.start_io()
Which might look something like this when you trigger autocompletion in your editor:

Docs and Tutorial
The full documentation and a tutorial are available at https://pygls.readthedocs.io/en/latest/.
Projects based on pygls
We keep a table of all known pygls implementations. Please submit a Pull Request with your own or any that you find are missing.
Alternatives
The main alternative to pygls is Microsoft's NodeJS-based Generic Language Server Framework. Being from Microsoft it is focussed on extending VSCode, although in theory it could be used to support any editor. So this is where pygls might be a better choice if you want to support more editors, as pygls is not focussed around VSCode.