85.2. ipython-9.17.1
Interactive Python shell
| Version | 9.17.1, release 1 |
| Shelf | editors — Text editors, IDEs, notebooks and REPLs |
| Phase | 41_system (System), 449 of 1047 in build order |
| Licence | BSD-3-Clause |
| Homepage | https://pypi.org/project/ipython/ |
| Build time | 2.6 SBU |
| Installed size | 25.0 MiB in 6655 files |
| Recipe | ports/core/editors/ipython/kpkgbuild |
About
IPython is an interactive Python shell: completion as you type, syntax highlighting, a history kept across sessions, ? and ?? for an object’s documentation and source, and the % magic commands for timing, running files and calling the shell. Jupyter’s Python kernel and Spyder’s console are built on it, so python3-ipykernel, spyder, jupyterlab and several other Python ports depend on it. The port installs IPython with the pure-Python packages it needs that no other port provides, its manual page, and a desktop entry, Python Shell, that opens it in a terminal.
Why it is in KDOS
The comment above it in script/phases/41_system/packages.d/editors.txt:
The REPL people actually compute in.
Sources
ipython-9.17.1.tar.gz(4.3 MiB)
sha2568919be8c27f20a6f4423145028063f6637b42a03ce57665bb12015ee1f073529
upstream: https://files.pythonhosted.org/packages/source/i/ipython/ipython-9.17.1.tar.gz
archive copy: sources-2/editors--ipython-9.17.1.tar.gzipython-vendor-9.17.1.tar.xz(13.6 MiB)
sha2560bf64a61957040760b1101403041921c78cf4cb5b0e338937306f22ab7098647
a vendor bundle: the dependencies upstream’s own tool would download, packed once
archive copy: sources-2/editors--ipython-vendor-9.17.1.tar.xz
Dependencies
Depends on: python3, python3-setuptools, python3-pip, python3-pygments, python3-psutil, python3-wcwidth.
Required by (8): jupyterlab, python3-comm, python3-ipykernel, python3-jupyter-client, python3-jupyter-core, python3-lsp-server, python3-nbconvert, 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/41_system/phase.env && kpkg install ipython'
What kpkg does
kpkg runs these steps, in this order, as root inside the chroot. The port directory is /ports/core/editors/ipython.
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/editors/ipython
echo '8919be8c27f20a6f4423145028063f6637b42a03ce57665bb12015ee1f073529 ipython-9.17.1.tar.gz' | sha256sum -c -
echo '0bf64a61957040760b1101403041921c78cf4cb5b0e338937306f22ab7098647 ipython-vendor-9.17.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/ipython
SRC=$SRC_ROOT/ipython-9.17.1
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf ipython-9.17.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
pip3 install --ignore-installed --no-deps --no-index --find-links=vendor --root=$PKG --prefix=/usr \
asttokens executing ipython-pygments-lexers jedi matplotlib-inline parso \
pexpect prompt-toolkit ptyprocess pure-eval stack-data traitlets .
install -Dm644 docs/man/ipython.1 -t "$PKG/usr/share/man/man1"
install -d "$PKG/usr/share/applications"
cat > "$PKG/usr/share/applications/ipython.desktop" <<'EOF'
[Desktop Entry]
Type=Application
Name=Python Shell
GenericName=Interactive Python
Comment=A Python prompt with completion and history
Exec=ipython
Icon=system-run
Terminal=true
Categories=Development;
Keywords=python;repl;shell;notebook;ipython;
EOF
chmod 644 "$PKG/usr/share/applications/ipython.desktop"
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/ipython, 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 ipython-9.17.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/ipython, and runs the triggers its paths call for.
Contents
Installed programs: ipython, ipython3.
Installed directories: /usr/lib/python3.14/site-packages/IPython, /usr/lib/python3.14/site-packages/asttokens, /usr/lib/python3.14/site-packages/asttokens-3.0.2.dist-info, /usr/lib/python3.14/site-packages/executing, /usr/lib/python3.14/site-packages/executing-2.2.1.dist-info, /usr/lib/python3.14/site-packages/ipython-9.17.1.dist-info, /usr/lib/python3.14/site-packages/ipython_pygments_lexers-1.1.1.dist-info, /usr/lib/python3.14/site-packages/jedi, /usr/lib/python3.14/site-packages/jedi-0.20.0.dist-info, /usr/lib/python3.14/site-packages/matplotlib_inline, /usr/lib/python3.14/site-packages/matplotlib_inline-0.2.2.dist-info, /usr/lib/python3.14/site-packages/parso, /usr/lib/python3.14/site-packages/parso-0.8.7.dist-info, /usr/lib/python3.14/site-packages/pexpect, /usr/lib/python3.14/site-packages/pexpect-4.9.0.dist-info, /usr/lib/python3.14/site-packages/prompt_toolkit, /usr/lib/python3.14/site-packages/prompt_toolkit-3.0.53.dist-info, /usr/lib/python3.14/site-packages/ptyprocess, /usr/lib/python3.14/site-packages/ptyprocess-0.7.0.dist-info, /usr/lib/python3.14/site-packages/pure_eval, /usr/lib/python3.14/site-packages/pure_eval-0.2.4.dist-info, /usr/lib/python3.14/site-packages/stack_data, /usr/lib/python3.14/site-packages/stack_data-0.6.3.dist-info, /usr/lib/python3.14/site-packages/traitlets, /usr/lib/python3.14/site-packages/traitlets-5.16.1.dist-info, /usr/share/licenses/ipython.
Short descriptions
ipython |
Tools for Interactive Computing in Python. |
Notes
- The bundle’s packages are named one by one. The vendor bundle holds IPython’s whole dependency set as source distributions, with the build backends they need.
build.shinstalls with--no-depsand names each package that no other port provides (jedi,parso,prompt-toolkit,traitlets,pexpectand the rest) plus IPython itself. Pygments, psutil and wcwidth are imported by other programs too, so they are ports of their own independs, and the bundle’s copies of them are never installed. A resolving install would instead package whatever the build root happened to lack, and which package owned those three would follow build order. The rule is in The three Python keys. - Nothing is installed into the build root. pip builds each source distribution in an isolated environment whose backends (setuptools, flit-core, hatchling, poetry-core and their helpers) also come from the bundle, through
--no-index --find-links=vendor, and--ignore-installedkeeps pip from touching the copies already in the build root. - A new IPython can need a new name in the list. When a version adds a dependency, the bundle
ports/fetchmakes carries it, butbuild.shinstalls only what it names, so the package would lack the module andipythonwould fail on its import.