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

74.5. python3-debugpy-1.8.22

The Debug Adapter Protocol server for Python, behind the debuggers of Spyder and the IPython kernel

Version 1.8.22, release 2
Shelf python-dev — python3-* Jupyter, kernel, language-server and debugger modules
Phase 40_lang (Languages), 72 of 186 in build order
Licence MIT AND EPL-1.0
Homepage https://github.com/microsoft/debugpy
Build time 0.9 SBU
Installed size 16.9 MiB in 533 files
Recipe ports/core/python-dev/python3-debugpy/kpkgbuild

About

debugpy is Microsoft’s implementation of the Debug Adapter Protocol for Python: a debugger an editor drives over a socket. spyder and python3-ipykernel debug through it. It carries a copy of pydevd, the debugger core, under debugpy/_vendored/pydevd, with C accelerators for its tracing written in Cython.

Sources

Dependencies

Depends on: python3, python3-pip, python3-setuptools, python3-wheel, python3-cython.

Required by (2): python3-ipykernel, 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/40_lang/phase.env && kpkg install python3-debugpy'

What kpkg does

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

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-debugpy
echo 'e489c7268e1c7b41e13b438d9c533d2a7af73fb59bf8cd30fead8286c1c39c4e  python3-debugpy-1.8.22.tar.gz' | 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-debugpy
SRC=$SRC_ROOT/python3-debugpy-1.8.22
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf python3-debugpy-1.8.22.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 five paths PKGNAME, PORT_SRC, SRC_ROOT, SRC and PKG set as shell variables. Its body, verbatim:

patch -p1 -i "$PORT_SRC/cython-redeclared.patch"

_pydevd=src/debugpy/_vendored/pydevd

( cd "$_pydevd" && python3 setup_pydevd_cython.py build_ext --inplace --force-cython )
export REQUIRE_CYTHON_BUILD=1

g++ $CXXFLAGS $LDFLAGS -std=c++11 -shared -fPIC -nostartfiles \
	"$_pydevd/pydevd_attach_to_process/linux_and_mac/attach.cpp" \
	-o "$_pydevd/pydevd_attach_to_process/attach_linux_amd64.so"

pip3 install --ignore-installed --no-deps --no-index --no-build-isolation --root=$PKG --prefix=/usr .
test -x "$PKG/usr/bin/debugpy"
ls "$PKG"/usr/lib/python3*/site-packages/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_cython*.so
test -e "$PKG"/usr/lib/python3*/site-packages/debugpy/_vendored/pydevd/pydevd_attach_to_process/attach_linux_amd64.so

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-debugpy, 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-debugpy-1.8.22-2.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-debugpy, and runs the triggers its paths call for.

Contents

Installed programs: debugpy, debugpy-adapter.

Installed directories: /usr/lib/python3.14/site-packages/debugpy, /usr/lib/python3.14/site-packages/debugpy-1.8.22.dist-info, /usr/share/licenses/python3-debugpy.

Notes

The attach library is what debugpy --pid <pid> injects into a running interpreter to attach to it. The source distribution carries its source, attach.cpp, but no Linux build of it, so build.sh compiles it before pip runs and setup.py packs it with the rest of the pydevd tree.

The three checks at the end stop the build if the package lacks the debugpy command, the compiled pydevd_cython module or the attach library, any of which a quiet fallback would otherwise leave out.