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

56.1. python3-3.14.8

The Python 3 interpreter and standard library, without tkinter

Version 3.14.8, release 1
Shelf python — The python3 interpreter, tkinter, and Python build, packaging and extension tooling
Phase 30_foundation (Build Foundation), 36 of 127 in build order
Licence PSF-2.0
Homepage https://www.python.org/
Build time 5.5 SBU
Installed size 93.0 MiB in 2630 files
Recipe ports/core/python/python3/kpkgbuild

About

CPython, the Python 3 interpreter, with its standard library and the shared libpython. It is one of the tools 30_foundation installs before any shelf (see the pinned run): meson is a Python program, many build systems run Python scripts to generate code, and every python3-* port is built and installed with it. Its depends line is the set of C libraries its standard extension modules link: _ctypes libffi, _decimal mpdecimal, _sqlite3 sqlite, pyexpat expat, _ssl and _hashlib openssl, the compression modules zlib, bzip2, xz and zstd, _curses ncurses, readline readline, _gdbm and _dbm gdbm, and _uuid util-linux’s libuuid.

The package has no Tk binding. python3 is built in 30_foundation, long before Tk exists, so _tkinter is turned off and the Tk-only parts of the standard library are deleted after the install. python3-tkinter configures the same tarball again once Tk is installed and packages that module with the Tk-only parts: the tkinter package, turtle, turtledemo, idlelib and the idle3 command; both recipes carry group = python3 so the version checker offers them as one bump, as A second build of the same source describes.

The system Python’s site-packages belongs to kpkg. build.sh writes the PEP 668 EXTERNALLY-MANAGED marker, so pip install outside a virtual environment is refused; see Files kpkg keeps to itself. pip itself is not part of this package. It is python3-pip, which also puts the pip wheel where python3 -m venv looks for it.

Why it is in KDOS

The comment above the 24 ports from fortify-headers to musl-utils in script/phases/30_foundation/packages.txt is quoted in The build foundation.

Sources

Dependencies

Depends on: libffi, mpdecimal, sqlite, expat, openssl, zlib, bzip2, xz, zstd, ncurses, readline, gdbm, util-linux.

Required by (458): android-tools, ardour, astropy, at-spi2-core, atkmm2.28, aubio, audiotube, avogadrolibs, bcc, bcnc, black-hole-solver, blender, blueprint-compiler, boost, botan, breeze-gtk, breeze-icons, brltty, brotli, byobu, cabal-install, cairomm, cairomm1.14, calcurse, calibre, cantor, chirp, chocolate-doom, chromium, cifs-utils, clamav, cncjs, compiler-rt, contact, coolprop, cppcheck, crawl-tiles, crispy-doom, cura, ddnet, deluge, doxygen, epy, falkon, firefox-esr, font-liberation, font-manager, fontconfig, fontforge, fonttools, freecad, freecell-solver, freeciv, freedoom, fwupd, fwupd-efi, gdal, gdb, gef, gexiv2, ghc, gimp, gimp-help, git, git-cola, glaxnimate, glibmm, glibmm2.66, glslang, gmsh, gn, gnuhealth, gnumeric, gnuradio, gobject-introspection, gpsd, gr-funcube, gr-iqbal, gr-osmosdr, gramps, gtk-doc, gtk-vnc, gtkmm3, gtkmm4, handbrake, hatari, horizon-eda, hplip, icestorm, icu, ifcopenshell, inkscape, ipython, iso-codes, ispc, itstool, jupyterlab, kajongg, kde-dev-scripts, kdev-python, kdos-addons, kdos-doc, kdos-kfs, kdos-plasma-look, khal, khard, khelpcenter, ki18n, kicad, kicad-symbols, kig, kodi, kolibri, krita, krohnkite, kwin, libblockdev, libcamera, libcec, libdisplay-info, libei, libevdev, libgusb, libixion, liblouis, libmbim, libnbd, liborcus, libpeas, libplacebo, libpsl, libqmi, libreoffice, librewolf, libsigc++2, libsigc++3, libsigrokdecode, libstoragemgmt, libtorrent-rasterbar, libunwind, libvirt, libvolk, libwacom, libxml2, libxslt, lilv, linuxcnc, lirc, lldb, llvm, llvm21, lyx, matplotlib, modemmanager, mpv, mumble, mupdf, netgen, netpbm, newt, nextpnr, ninja, nmap, nodejs, nomadnet, notmuch, noto-emoji, numpy, obs-studio, ocrmypdf, oidn, onnxruntime, opencc, opencv, openimageio, openmp, openmsx, openvdb, orca, organicmaps, pandas, pangomm, pangomm2.46, pcsc-lite, pdfium, perf, picard, pioneer, piper, pipewire, pivy, plasma-systemmonitor, podman, postgresql, powder-toy, ppsspp, printrun, prjtrellis, profanity, python3-adafruit-nrfutil, python3-asgiref, python3-astropy-iers-data, python3-attrs, python3-automat, python3-bcrypt, python3-beautifulsoup4, python3-blinker, python3-cairo, python3-calver, python3-cantools, python3-cattrs, python3-certifi, python3-cffi, python3-charset-normalizer, python3-click, python3-click-log, python3-cloudpickle, python3-colorama, python3-comm, python3-configobj, python3-constantly, python3-contourpy, python3-cppy, python3-cryptography, python3-cssselect, python3-cups, python3-cycler, python3-cython, python3-dasbus, python3-dateutil, python3-dbus, python3-debugpy, python3-decorator, python3-defusedxml, python3-distro, python3-docutils, python3-ecdsa, python3-esptool, python3-extension-helpers, python3-flask, python3-flask-cors, python3-flit-core, python3-glad2, python3-gmpy2, python3-gobject, python3-h5py, python3-hatch-jupyter-builder, python3-hatch-nodejs-version, python3-hatch-tryton, python3-hatch-vcs, python3-hatchling, python3-html5lib, python3-httplib2, python3-hyperlink, python3-idna, python3-iminuit, python3-incremental, python3-ipykernel, python3-isodate, python3-itsdangerous, python3-jellyfish, python3-jinja2, python3-jplephem, python3-jsonschema, python3-jsonschema-specifications, python3-jupyter-client, python3-jupyter-core, python3-jupyterlab-pygments, python3-keyring, python3-kivy, python3-kiwisolver, python3-lark, python3-libvirt, python3-lsp-ruff, python3-lsp-server, python3-lxmf, python3-lxml, python3-markdown, python3-markdown-it-py, python3-maturin, python3-mdurl, python3-meshtastic, python3-meson-python, python3-mpmath, python3-nanobind, python3-nbconvert, python3-nest-asyncio, python3-networkx, python3-obd, python3-opengl, python3-openpyxl, python3-orjson, python3-owslib, python3-packaging, python3-pathspec, python3-pathvalidate, python3-pefile, python3-pikepdf, python3-pillow, python3-pillow-heif, python3-pip, python3-pkgconfig, python3-platformdirs, python3-pluggy, python3-ply, python3-poetry-core, python3-protobuf, python3-psutil, python3-psycopg2, python3-pyarcus, python3-pyatspi, python3-pybind11, python3-pycparser, python3-pydantic-core, python3-pyemf3, python3-pyerfa, python3-pygccxml, python3-pygments, python3-pyicu, python3-pynest2d, python3-pyparsing, python3-pypdfium2, python3-pyproject-metadata, python3-pyqt-builder, python3-pyqt5, python3-pyqt5-sip, python3-pyqt6, python3-pyqt6-sip, python3-pyqt6-webengine, python3-pyqtgraph, python3-pysavitar, python3-pyserial, python3-pyside6, python3-pysocks, python3-pytz, python3-pyusb, python3-pyuvula, python3-pyvisa, python3-pyvisa-py, python3-pyxdg, python3-pyzmq, python3-qrcode, python3-qscintilla, python3-qtpy, python3-referencing, python3-requests, python3-rich, python3-rns, python3-rpds-py, python3-ruamel-yaml, python3-scikit-build-core, python3-scour, python3-semantic-version, python3-send2trash, python3-setuptools, python3-setuptools-rust, python3-setuptools-scm, python3-sgp4, python3-shapely, python3-sip, python3-six, python3-soupsieve, python3-sphinx, python3-tinycss2, python3-tkinter, python3-tomlkit, python3-tornado, python3-trove-classifiers, python3-truststore, python3-twisted, python3-typing-extensions, python3-uharfbuzz, python3-urllib3, python3-urwid, python3-vcs-versioning, python3-versioneer, python3-waitress, python3-wcwidth, python3-webencodings, python3-werkzeug, python3-wheel, python3-wxpython, python3-xlib, python3-yaml, python3-yapps, python3-ytmusicapi, python3-zope-interface, python3-zstandard, qemu, qgis, qmapshack, qt-creator, qt5-qtdeclarative, qt6-qtdeclarative, qt6-qtwebengine, qutebrowser, radicale, recoll, rhythmbox, rsync, ruff, rust, samba, scipy, scons, selenium-webdriver-at-spi, setconf, shaderc, sideband, skyfield, speech-dispatcher, spice, spice-gtk, spirv-tools, spyder, stellarium, switcheroo-control, symbiyosys, sympy, syntax-highlighting, system-config-printer, talloc, tdb, terminus-font, terminus-ttf, tevent, thrift, thunderbird, timewarrior, tlp-pd, toot, tryton, uhd, uranium, urh, usbutils, valgrind, vdirsyncer, verilator, veusz, virt-manager, visidata, vte3, vtk, webkitgtk, webkitgtk6, weechat, widelands, wireless-regdb, wireshark, xcb-proto, yasm, yosys, yt-dlp, z3, zenmap, zim, zziplib.

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/30_foundation/phase.env && kpkg install python3'

What kpkg does

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

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

./configure \
	--prefix=/usr \
	--enable-ipv6 \
	--enable-loadable-sqlite-extensions \
	--enable-optimizations \
	--enable-shared \
	--with-computed-gotos \
	--with-lto \
	--with-system-expat \
	--with-system-libmpdec \
	--with-readline=readline \
	--with-ensurepip=no \
	--with-wheel-pkg-dir=/usr/share/python-wheels \
	--with-tzpath=/usr/share/zoneinfo \
	--disable-test-modules \
	ac_cv_header_bluetooth_bluetooth_h=no \
	ac_cv_header_bluetooth_h=no \
	ac_cv_lib_intl_textdomain=no \
	py_cv_module__tkinter=n/a \
	ac_cv_prog_cc_g=no \
	OPT="-O3 -Wall" \
	CFLAGS_ALIASING=-fno-strict-aliasing \
	CPPFLAGS="$CPPFLAGS -DOPENSSL_NO_SSL3 -DOPENSSL_NO_SSL3_METHOD -DOPENSSL_NO_TLS1_METHOD -DOPENSSL_NO_TLS1_1_METHOD -DOPENSSL_NO_TLS1_2_METHOD"
make EXTRA_CFLAGS="$CFLAGS"
make EXTRA_CFLAGS="$CFLAGS" DESTDIR=$PKG install maninstall

rm -rf $PKG/usr/lib/python${_version}/test
rm -rf $PKG/usr/lib/python${_version}/ensurepip/_bundled
rm -rf $PKG/usr/lib/python${_version}/{tkinter,idlelib,turtledemo,turtle.py}
rm -f $PKG/usr/lib/python${_version}/__pycache__/turtle.*
rm -f $PKG/usr/bin/idle3 $PKG/usr/bin/idle${_version}
ln -s python3 $PKG/usr/bin/python
ln -s python3.1 $PKG/usr/share/man/man1/python.1

cat > "$PKG/usr/lib/python${_version}/EXTERNALLY-MANAGED" <<'EOF'
[externally-managed]
Error=The system Python belongs to kpkg: every package in its
 site-packages is a KDOS port, and pip installing over one leaves
 files the next kpkg upgrade or removal deletes or conflicts with.
 
 Install into a virtual environment instead:
 
 python3 -m venv ~/.venvs/NAME
 ~/.venvs/NAME/bin/pip install PACKAGE
 
 A Python package the system itself should carry is a port.
EOF

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

Contents

Installed programs: pydoc3, pydoc3.14, python, python3, python3-config, python3.14, python3.14-config.

Installed libraries: libpython3.14.so, libpython3.so.

Installed directories: /usr/include/python3.14, /usr/lib/python3.14/__phello__, /usr/lib/python3.14/_pyrepl, /usr/lib/python3.14/asyncio, /usr/lib/python3.14/collections, /usr/lib/python3.14/compression, /usr/lib/python3.14/concurrent, /usr/lib/python3.14/config-3.14-x86_64-linux-musl, /usr/lib/python3.14/ctypes, /usr/lib/python3.14/curses, /usr/lib/python3.14/dbm, /usr/lib/python3.14/email, /usr/lib/python3.14/encodings, /usr/lib/python3.14/ensurepip, /usr/lib/python3.14/html, /usr/lib/python3.14/http, /usr/lib/python3.14/importlib, /usr/lib/python3.14/json, /usr/lib/python3.14/logging, /usr/lib/python3.14/multiprocessing, /usr/lib/python3.14/pathlib, /usr/lib/python3.14/pydoc_data, /usr/lib/python3.14/re, /usr/lib/python3.14/sqlite3, /usr/lib/python3.14/string, /usr/lib/python3.14/sysconfig, /usr/lib/python3.14/tomllib, /usr/lib/python3.14/unittest, /usr/lib/python3.14/urllib, /usr/lib/python3.14/venv, /usr/lib/python3.14/wsgiref, /usr/lib/python3.14/xml, /usr/lib/python3.14/xmlrpc, /usr/lib/python3.14/zipfile, /usr/lib/python3.14/zoneinfo, /usr/share/licenses/python3.

Short descriptions

python3.14 an interpreted, interactive, object-oriented programming language
python-3.14.pc Build a C extension for Python
python-3.14-embed.pc Embed Python into an application

Notes

The interpreter is compiled at -O2, not -O3. PY_CFLAGS is OPT followed by the tree’s CFLAGS three times over, once as recorded by configure, once from the environment of make and once as EXTRA_CFLAGS, and GCC takes the last -O it is given. The recorded value is in sysconfig.get_config_var('PY_CFLAGS'). A C extension built later compiles with the recorded CFLAGS followed by the exported ones, and so at -O2 as well; see Python, Perl, Haskell, Node and OCaml modules.

--with-system-libmpdec does not make a missing mpdecimal an error. configure warns, “no system libmpdec found; falling back to bundled libmpdec”, and builds the copy from its own source. The depends line names mpdecimal, so it is installed before python3 builds; readelf -d on _decimal’s .so under lib-dynload shows a NEEDED entry for libmpdec when the build used it. --with-system-expat has no such fallback: configure links pyexpat with -lexpat without checking, so a missing expat fails the build.

After the install, build.sh removes tkinter, idlelib, turtledemo, turtle.py with its bytecode in __pycache__ and the idle3 commands, which need Tk and which python3-tkinter ships; links python to python3, and its manual page, so that both names work; and writes the EXTERNALLY-MANAGED file.