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

70.4. python3-cython-3.3.0

The C extension compiler numpy is written against

Version 3.3.0, release 1
Shelf python — The python3 interpreter, tkinter, and Python build, packaging and extension tooling
Phase 40_lang (Languages), 36 of 186 in build order
Licence Apache-2.0
Homepage https://pypi.org/project/Cython/
Build time 3.2 SBU
Installed size 15.8 MiB in 474 files
Recipe ports/core/python/python3-cython/kpkgbuild

About

Cython compiles Python with optional C type declarations into C extension modules. It is a build-time dependency of many of the tree’s Python packages with C code: numpy, pandas, scipy, python3-lxml and python3-debugpy among them.

It is a port, not a member of each consumer’s vendor bundle. Each consumer builds with --no-build-isolation against the installed Cython; with isolation, pip would fetch Cython and the rest of the backend chain from PyPI into a temporary environment for every build. See The three Python keys.

Why it is in KDOS

The comment above the 6 ports from python3-scikit-build-core to python3-pybind11 in script/phases/40_lang/packages.d/python.txt:

THE BUILD BACKENDS ARE PORTS, NOT VENDORED WHEELS. numpy and matplotlib build through mesonpy, pybind11, pikepdf and coolprop through scikit-build-core, and the rest through hatchling or setuptools. Under pip's build isolation each would fetch its backend from PyPI — whose own chain ends at the ninja wrapper, whose sdist COMPILES CMAKE FROM SOURCE. This tree has cmake, ninja and meson already. 30_foundation installs flit-core, hatchling, poetry-core, setuptools-scm and what they build with.

Sources

Dependencies

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

Required by (24): astropy, brltty, calibre, coolprop, cura, deluge, fonttools, numpy, pandas, printrun, python3-charset-normalizer, python3-debugpy, python3-h5py, python3-kivy, python3-lxml, python3-pyzmq, python3-shapely, python3-uharfbuzz, python3-wxpython, scipy, sideband, uranium, urh, vdirsyncer.

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-cython'

What kpkg does

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

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

pip3 install --ignore-installed --no-deps --no-index --no-build-isolation --root=$PKG --prefix=/usr .

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-cython, 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-cython-3.3.0-1.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-cython, and runs the triggers its paths call for.

Contents

Installed programs: cygdb, cython, cythonize.

Installed directories: /usr/lib/python3.14/site-packages/Cython, /usr/lib/python3.14/site-packages/cython-3.3.0.dist-info, /usr/lib/python3.14/site-packages/pyximport, /usr/share/licenses/python3-cython.

Notes

The Cython release here decides what the consumers’ .pyx sources must accept. python3-debugpy carries a patch for it, and python3-meshtastic skips dbus-fast’s optional Cython build because dbus-fast declares a Cython older than this one.