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

72.23. python3-twisted-26.4.0

Event-driven networking engine for Python: TCP, UDP, TLS, HTTP, SSH, DNS and mail protocols

Version 26.4.0, release 1
Shelf python-net — python3-* HTTP, web-framework, TLS-trust and network-stack modules
Phase 40_lang (Languages), 159 of 186 in build order
Licence MIT
Homepage https://twisted.org/
Build time 0.4 SBU
Installed size 30.3 MiB in 1766 files
Recipe ports/core/python-net/python3-twisted/kpkgbuild

About

Twisted is an event-driven networking engine for Python: a reactor over the system’s event interfaces, with TCP, UDP, TLS and Unix-socket transports, and protocol implementations for HTTP, DNS, SSH, IRC, SMTP, IMAP and others. It installs the twistd, twist and trial commands. kajongg runs its game server and client over Twisted’s Perspective Broker.

Its run-time imports are ports of their own in depends: python3-attrs, python3-automat, python3-constantly, python3-hyperlink, python3-incremental, python3-typing-extensions and python3-zope-interface.

Sources

Dependencies

Depends on: python3, python3-pip, python3-hatchling, python3-incremental, python3-attrs, python3-automat, python3-constantly, python3-hyperlink, python3-typing-extensions, python3-zope-interface.

Required by (2): deluge, kajongg.

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

What kpkg does

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

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-net/python3-twisted
echo 'dbfd0fe1ee409d0243fdd7a6a6ff14f4948cec1fd78e0376291f805e1501fae9  python3-twisted-26.4.0.tar.gz' | sha256sum -c -
echo '91aed379e05beb237e828af194f3a50f6fc6ee67bc85bfcb2d91a27d7f7452da  python3-twisted-vendor-26.4.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-twisted
SRC=$SRC_ROOT/python3-twisted-26.4.0
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf python3-twisted-26.4.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
export PYTHONPATH="$_back${PYTHONPATH:+:$PYTHONPATH}"
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-twisted, 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-twisted-26.4.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-twisted, and runs the triggers its paths call for.

Contents

Installed programs: cftp, ckeygen, conch, mailmail, pyhtmlizer, tkconch, trial, twist, twistd.

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

Notes

Twisted builds with python3-hatchling, takes its version from python3-incremental’s hatchling plugin, and assembles its long description with hatch-fancy-pypi-readme. That last plugin is not a port, and it is the one entry of the recipe’s pypackages. build.sh installs it from the bundle into $SRC_ROOT/backends and puts that directory on PYTHONPATH for the build, so the plugin is used and nothing of it lands in the build root or the package; see The three Python keys. The other sdists in the bundle are the plugin’s own build requirements, which this build does not use, because both installs run with --no-build-isolation.

The optional extras are not in depends: TLS (pyopenssl, service_identity), Conch’s SSH (cryptography, bcrypt), HTTP/2 (h2, priority) and serial ports (pyserial). Twisted imports each only when a program uses the feature, and raises ImportError then.

The test packages (twisted/test and each subpackage’s test) stay in the package: other Twisted modules import them, so removing them breaks those modules.