Skip to the text
KDOS
Menu
kdos.dev KDOS from Scratch KDOS 0.2 · 4dd4a10 · 2026-11-30 Contents Index

169.6. python3-lsp-server-1.15.0

The Python language server, with Pylint, flake8, Rope, YAPF and Black

The build-state snapshot was taken from 1.15.0-2; this recipe is 1.15.0-3, so the size, time and contents below describe the earlier build.

Version 1.15.0, release 3
Shelf python-dev — python3-* Jupyter, kernel, language-server and debugger modules
Phase 41_system (System), 865 of 1047 in build order
Licence MIT AND BSD-3-Clause AND TCL AND Apache-2.0 AND LGPL-2.1-or-later AND LGPL-3.0-or-later AND GPL-2.0-or-later
Homepage https://github.com/python-lsp/python-lsp-server
Build time 1.5 SBU
Installed size 18.6 MiB in 1736 files
Recipe ports/core/python-dev/python3-lsp-server/kpkgbuild

About

python-lsp-server, pylsp, is the Python language server: an editor connects to it over the Language Server Protocol for completion, go-to-definition, hover, diagnostics and formatting. This port ships it with every plugin it carries: Jedi (from the ipython port), Rope, Pylint, pyflakes, pycodestyle, pydocstyle, mccabe, flake8, autopep8 and YAPF, and the python-lsp-black plugin with Black. The linters and formatters install their own commands too. spyder uses it for its editor, and python3-lsp-ruff plugs into it.

Sources

Dependencies

Depends on: patch, python3, python3-pip, python3-setuptools, python3-setuptools-scm, python3-wheel, python3-hatchling, python3-hatch-vcs, python3-poetry-core, python3-flit-core, python3-calver, python3-trove-classifiers, ipython, python3-pluggy, python3-platformdirs, python3-tomlkit, python3-click, python3-pathspec, python3-packaging, python3-typing-extensions.

Required by (2): python3-lsp-ruff, spyder.

Patches

build.sh applies these; kpkg applies nothing by itself.

Installation

From the repository root, inside the build container, this is the line kdosbuild runs for the port:

script/chroot/exec.sh bash -c 'source script/phases/41_system/phase.env && kpkg install python3-lsp-server'

What kpkg does

kpkg runs these steps, in this order, as root inside the chroot. The port directory is /ports/core/python-dev/python3-lsp-server.

1. Verify every declared source. Each file a sha256 = line names, found in the port directory or in /var/cache/kpkg/sources, must hash to its line; a mismatch stops the build before anything is unpacked.

cd /ports/core/python-dev/python3-lsp-server
echo '85fa090262c3d1aef09b759d98811d6cb9ad5bbc58af15d588608ae8c1925801  python3-lsp-server-1.15.0.tar.gz' | sha256sum -c -
echo 'a6eee2990064199413e0e276d2e237e6dac35aacd780a67591e95adebfe1b1b7  python3-lsp-server-vendor-1.15.0.tar.xz' | sha256sum -c -

2. Unpack. The work directory is emptied and the first source is unpacked into $SRC with its top directory stripped; any later tarball lands unstripped beside it in $SRC_ROOT, and a file that is not a tarball is copied into $SRC.

SRC_ROOT=/var/cache/kpkg/work/python3-lsp-server
SRC=$SRC_ROOT/python3-lsp-server-1.15.0
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf python3-lsp-server-1.15.0.tar.gz -C "$SRC" --strip-components=1

Every config.guess and config.sub older than automake’s is then replaced with automake’s, so a configure script recognises the musl target.

3. Build. build.sh is sourced in a subshell under set -e, from $SRC, with name, version, release and the recipe’s helpers pyrequirements, pyruntime and the five paths PKGNAME, PORT_SRC, SRC_ROOT, SRC and PKG set as shell variables. Its body, verbatim:

mkdir -p vendor
tar -xf $PORT_SRC/$name-vendor-$version.tar.xz --strip-components=1 -C vendor

_back="$SRC_ROOT/backends"
pip3 install --no-deps --no-index --find-links=vendor --no-build-isolation \
	--target "$_back" hatch-fancy-pypi-readme pdm-backend
export PYTHONPATH="$_back${PYTHONPATH:+:$PYTHONPATH}"

_d2m="$SRC_ROOT/docstring_to_markdown-0.17"
tar -xzf vendor/docstring_to_markdown-0.17.tar.gz -C "$SRC_ROOT"
(cd "$_d2m" && patch -p1 -i "$PORT_SRC/stdlib-importlib-metadata.patch")

_ap8="$SRC_ROOT/autopep8-2.0.4"
tar -xzf vendor/autopep8-2.0.4.tar.gz -C "$SRC_ROOT"
(cd "$_ap8" && patch -p1 -i "$PORT_SRC/autopep8-py314.patch")

export PYTOKENS_USE_MYPYC=0
pip3 install --ignore-installed --no-deps --no-index --find-links=vendor --no-build-isolation \
	--root=$PKG --prefix=/usr \
	python-lsp-jsonrpc ujson "$_d2m" pylint astroid dill isort \
	mccabe pycodestyle pyflakes flake8 "$_ap8" yapf rope pytoolconfig \
	whatthepatch pydocstyle snowballstemmer python-lsp-black black pytokens \
	mypy-extensions .
test -x "$PKG/usr/bin/pylsp"

The switches, and why each is set:

The common switches of each build system are explained in the Flag glossary.

4. Package. kpkg removes libtool archives, the info directory index, mimeinfo.cache and every fonts.dir from $PKG, copies the source’s licence files into /usr/share/licenses/python3-lsp-server, prunes what the image does not ship, lints the tree and rolls it reproducibly:

tar --sort=name --format=gnu --numeric-owner --owner=0 --group=0 \
    --mtime=@$SOURCE_DATE_EPOCH \
    --use-compress-program='xz -9 -T0 --block-size=32MiB --no-adjust' \
    -cf python3-lsp-server-1.15.0-3.tar.xz -C "$PKG" .

5. Adopt. kpkgadd installs the package’s files over the root, refusing a path another package owns, records the file list in /var/lib/kpkg/db/python3-lsp-server, and runs the triggers its paths call for.

Contents

Installed programs: autopep8, black, blackd, flake8, get_gprof, get_objgraph, isort, isort-identify-imports, pycodestyle, pydocstyle, pyflakes, pylint, pylint-config, pylsp, pyreverse, symilar, undill, yapf, yapf-diff.

Installed directories: /usr/lib/python3.14/site-packages/astroid, /usr/lib/python3.14/site-packages/astroid-4.0.4.dist-info, /usr/lib/python3.14/site-packages/autopep8-2.0.4.dist-info, /usr/lib/python3.14/site-packages/black, /usr/lib/python3.14/site-packages/black-26.5.1.dist-info, /usr/lib/python3.14/site-packages/blackd, /usr/lib/python3.14/site-packages/blib2to3, /usr/lib/python3.14/site-packages/dill, /usr/lib/python3.14/site-packages/dill-0.4.1.dist-info, /usr/lib/python3.14/site-packages/docstring_to_markdown, /usr/lib/python3.14/site-packages/docstring_to_markdown-0.17.dist-info, /usr/lib/python3.14/site-packages/flake8, /usr/lib/python3.14/site-packages/flake8-7.1.2.dist-info, /usr/lib/python3.14/site-packages/isort, /usr/lib/python3.14/site-packages/isort-9.0.1.dist-info, /usr/lib/python3.14/site-packages/mccabe-0.7.0.dist-info, /usr/lib/python3.14/site-packages/mypy_extensions-1.1.0.dist-info, /usr/lib/python3.14/site-packages/pycodestyle-2.12.1.dist-info, /usr/lib/python3.14/site-packages/pydocstyle, /usr/lib/python3.14/site-packages/pydocstyle-6.3.0.dist-info, /usr/lib/python3.14/site-packages/pyflakes, /usr/lib/python3.14/site-packages/pyflakes-3.2.0.dist-info, /usr/lib/python3.14/site-packages/pylint, /usr/lib/python3.14/site-packages/pylint-4.0.9.dist-info, /usr/lib/python3.14/site-packages/pylsp, /usr/lib/python3.14/site-packages/pylsp_black, /usr/lib/python3.14/site-packages/pylsp_jsonrpc, /usr/lib/python3.14/site-packages/python_lsp_black-2.0.0.dist-info, /usr/lib/python3.14/site-packages/python_lsp_jsonrpc-1.1.2.dist-info, /usr/lib/python3.14/site-packages/python_lsp_server-1.15.0.dist-info, /usr/lib/python3.14/site-packages/pytokens, /usr/lib/python3.14/site-packages/pytokens-0.4.1.dist-info, /usr/lib/python3.14/site-packages/pytoolconfig, /usr/lib/python3.14/site-packages/pytoolconfig-1.3.1.dist-info, /usr/lib/python3.14/site-packages/rope, /usr/lib/python3.14/site-packages/rope-1.15.0.dist-info, /usr/lib/python3.14/site-packages/snowballstemmer, /usr/lib/python3.14/site-packages/snowballstemmer-3.1.1.dist-info, /usr/lib/python3.14/site-packages/ujson-6.0.0.dist-info, /usr/lib/python3.14/site-packages/ujson-stubs, /usr/lib/python3.14/site-packages/whatthepatch, /usr/lib/python3.14/site-packages/whatthepatch-1.0.7.dist-info, /usr/lib/python3.14/site-packages/yapf, /usr/lib/python3.14/site-packages/yapf-0.43.0.dist-info, /usr/lib/python3.14/site-packages/yapf_third_party, /usr/lib/python3.14/site-packages/yapftests, /usr/share/licenses/python3-lsp-server.

Notes

The two patched packages are unpacked from the vendor bundle into $SRC_ROOT, patched there and installed from those directories; the bundle itself stays as it was fetched. patch is in depends for that.

test -x "$PKG/usr/bin/pylsp" after the install stops the build if the server’s entry point is missing.

The recipe’s runtime = python3-tomlkit line exists because the bundled pylint imports tomlkit from pylint/config/arguments_manager.py whenever it runs, as pylint or as the language server’s pylint plugin. That import is in a submodule the run-time needs record does not read, and python3-tomlkit is listed in ports/buildonly, the ports a prebuilt install does not follow a dependency into unless the package’s recorded needs name it. Without the line, an install from prebuilt packages would leave tomlkit out and pylint would stop as it starts.