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

56.3. python3-pip-26.2.1

Python package installer

Version 26.2.1, release 1
Shelf python — The python3 interpreter, tkinter, and Python build, packaging and extension tooling
Phase 30_foundation (Build Foundation), 38 of 127 in build order
Licence MIT AND Apache-2.0 AND BSD-2-Clause AND BSD-3-Clause AND ISC AND MPL-2.0 AND PSF-2.0
Homepage https://pip.pypa.io/
Build time 0.2 SBU
Installed size 12.0 MiB in 884 files
Recipe ports/core/python/python3-pip/kpkgbuild

About

pip is Python’s package installer. In KDOS it has two jobs. Recipes use it: almost every python3-* port installs itself with pip3 install --root="$PKG", from a source tree or from the port’s vendor bundle, and names python3-pip in its depends. And it supplies the pip that goes into a virtual environment: the system’s site-packages is kpkg’s (see Files kpkg keeps to itself), so Python software that is not a port is installed with python3 -m venv, and venv takes pip from the wheel this package puts in /usr/share/python-wheels.

pip builds with the backend flit_core, and no pip exists yet to install itself with. Its pyproject.toml requires flit-core >=3.11,<4, which the python3-flit-core port, a 4.x release built after pip, does not satisfy. build.sh therefore runs pip from its own source tree (PYTHONPATH=src python3 -m pip) against the port’s vendor bundle, a second tarball holding the flit_core 3.12.0 source distribution, which ports/fetch made in advance so that the build needs no network. pip builds its wheel in isolation, installing that flit_core into a temporary environment from the bundle; see Vendoring.

Sources

Dependencies

Depends on: python3, python3-setuptools.

Required by (228): asciidoc, astropy, bcnc, calibre, chirp, contact, coolprop, cura, deluge, epy, fonttools, git-cola, gnuhealth, gramps, ipython, jupyterlab, khal, khard, kolibri, liblouis, matplotlib, meson, nmap, nomadnet, notmuch, numpy, ocrmypdf, onnxruntime, pandas, picard, printrun, python3-adafruit-nrfutil, python3-asgiref, python3-astropy-iers-data, python3-attrs, python3-automat, python3-bcrypt, python3-beautifulsoup4, python3-blinker, 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-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-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-mako, python3-markdown, python3-markdown-it-py, python3-markupsafe, 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-pkgconfig, python3-platformdirs, python3-pluggy, python3-ply, python3-poetry-core, python3-protobuf, python3-psutil, python3-psycopg2, python3-pyarcus, 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-sip, python3-pyqt6-sip, python3-pyqtgraph, python3-pysavitar, python3-pyserial, python3-pysocks, python3-pytz, python3-pyusb, python3-pyvisa, python3-pyvisa-py, python3-pyxdg, python3-pyzmq, python3-qrcode, 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-rust, python3-setuptools-scm, python3-sgp4, python3-shapely, python3-sip, python3-six, python3-soupsieve, python3-sphinx, python3-tinycss2, 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-xlib, python3-yaml, python3-yapps, python3-ytmusicapi, python3-zope-interface, python3-zstandard, qutebrowser, radicale, ruff, scipy, scons, sideband, skyfield, spyder, sympy, thrift, toot, tryton, uranium, urh, vdirsyncer, veusz, visidata, yt-dlp, zenmap, zim.

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

What kpkg does

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

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-pip
echo 'f6ad667e89a1fe78046c8f13232b247200f5258d7828f3f7883d660878e0813f  python3-pip-26.2.1.tar.gz' | sha256sum -c -
echo '7570d0c81de42023f35dabc64458abdfd94382db7517a5b46366002241da6db6  python3-pip-vendor-26.2.1.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-pip
SRC=$SRC_ROOT/python3-pip-26.2.1
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf python3-pip-26.2.1.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:

mkdir -p vendor
tar -xf $PORT_SRC/$name-vendor-$version.tar.xz --strip-components=1 -C vendor
PYTHONPATH=src python3 -m pip install . --ignore-installed --no-deps --find-links=vendor --no-index --root="$PKG" --prefix=/usr

find "$PKG/usr/lib" -path '*/pip/_vendor/distlib/*.exe' -delete

install -d "$PKG/usr/share/python-wheels"
PYTHONPATH=src python3 -m pip wheel . --no-deps --no-index --find-links=vendor \
	-w "$PKG/usr/share/python-wheels"
chmod 644 "$PKG"/usr/share/python-wheels/pip-*.whl

_site=$(echo "$PKG"/usr/lib/python3*/site-packages)
install -d "$PKG/usr/share/bash-completion/completions"
for _pip in "$PKG"/usr/bin/pip*; do
	PYTHONPATH="$_site" "$_pip" completion --bash \
		> "$PKG/usr/share/bash-completion/completions/${_pip##*/}"
done

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

Contents

Installed programs: pip, pip3, pip3.14.

Installed directories: /usr/lib/python3.14/site-packages/pip, /usr/lib/python3.14/site-packages/pip-26.2.1.dist-info, /usr/share/licenses/python3-pip, /usr/share/python-wheels.

Notes

The wheel is followed by chmod 644. The bundle’s flit_core 3.12.0 writes it through tempfile.mkstemp, which creates the file with mode 0600, and pip moves it into place unchanged; the package lint refuses a regular file that not everyone can read, unless it is a listed credential.

pip’s vendored distlib carries Windows launcher executables (t32.exe, w64.exe and the others), which build.sh deletes from the package.

The bash completions are generated by running each installed pip command from $PKG with completion --bash, with PYTHONPATH pointing at the staged site-packages, so the script for pip, pip3 and the versioned name is the one this pip writes.