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

71.44. python3-bcrypt-5.0.0

The bcrypt password hash for Python, in Rust

Version 5.0.0, release 1
Shelf python-libs — General-purpose python3-* runtime libraries: text, templating, markup, parsing, config, CLI, system, files, crypto, imaging
Phase 40_lang (Languages), 124 of 186 in build order
Licence Apache-2.0
Homepage https://github.com/pyca/bcrypt
Build time 0.5 SBU
Installed size 640.7 KiB in 13 files
Recipe ports/core/python-libs/python3-bcrypt/kpkgbuild

About

bcrypt is the bcrypt password hash for Python, implemented in Rust and built with setuptools and python3-setuptools-rust from the vendor bundle. spyder depends on it.

Sources

Dependencies

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

Required by (1): spyder.

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

What kpkg does

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

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-libs/python3-bcrypt
echo 'f748f7c2d6fd375cc93d3fba7ef4a9e3a092421b8dbf34d8d4dc06be9492dfdd  python3-bcrypt-5.0.0.tar.gz' | sha256sum -c -
echo 'dd877e16989e827b7ef5e7ba19a0036f76b259ca0c6607e32b0daf6e6c213909  python3-bcrypt-vendor-5.0.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-bcrypt
SRC=$SRC_ROOT/python3-bcrypt-5.0.0
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf python3-bcrypt-5.0.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 vendordir and the five paths PKGNAME, PORT_SRC, SRC_ROOT, SRC and PKG set as shell variables. Its body, verbatim:

tar xf $PORT_SRC/${name}-vendor-${version}.tar.xz
export CARGO_HOME="$SRC_ROOT/.cargo"
export RUSTFLAGS="-C target-feature=-crt-static"
export CARGO_NET_OFFLINE=true

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

Contents

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

Notes

The Rust crate is src/_bcrypt/Cargo.toml, the path in the package’s [[tool.setuptools-rust.ext-modules]], with its own Cargo.lock beside it, so the recipe’s vendordir = src/_bcrypt makes ports/fetch vendor there. build.sh unpacks the bundle at the top of the tree, where pip, and through it setuptools-rust, runs cargo, so the bundle’s .cargo/config.toml is found by cargo’s walk up from that directory; see Where the bundle goes.