repomatic.tooling.nuitka module¶

What repomatic run nuitka adds to a Nuitka build.

The nuitka entry of TOOL_REGISTRY reads two hooks from here:

  • nuitka_params(), its computed parameters: the modules the binary leaves out, and the options of the build target this machine compiles for.

  • prepare_nuitka_build(), its preparation: the extras to install, the compile cache to trim and configure, and the environment of the target.

Each of them reads the machine it runs on, so the release workflow hands a compile job nothing but the entry point to build.

repomatic.tooling.nuitka.MEBIBYTE: Final[int] = 1048576¶

Bytes in a mebibyte, the unit the cache size is logged in.

repomatic.tooling.nuitka.COMPILE_CACHE_CAP: Final[int] = 2147483648¶

Size past which prepare_compile_cache() resets the compile cache.

Nuitka’s internal clcache prunes by age alone and has no size cap (ccache prunes itself at 5 GiB), so a restore-then-save cycle can still grow the cache. Past this size, the cache starts a fresh lineage.

repomatic.tooling.nuitka.CCACHE_CONFIG: Final[str] = 'ccache.conf'¶

The file ccache reads its settings from, inside its cache directory.

repomatic.tooling.nuitka.nuitka_params(metadata)[source]¶

Build the options repomatic run nuitka passes after the shared ones.

Parameters:

metadata (Metadata) – The project the binary is built from.

Return type:

list[str]

Returns:

A --nofollow-import-to option per module of [tool.repomatic] nuitka.nofollow-imports, then the options of the build target this machine compiles for (see nuitka_flags).

repomatic.tooling.nuitka.install_extras(extras)[source]¶

Install the optional dependency groups extras into the project venv.

The binary only bundles what the build virtualenv holds, which by default is the base dependencies of the project. An extra listed in [tool.repomatic] nuitka.extras adds the packages of an optional feature.

The sync is inexact: it adds the extras and removes nothing, so a developer’s virtualenv keeps the dependency groups it had.

Parameters:

extras (Sequence[str]) – Names of [project.optional-dependencies] groups.

Raises:

UvError – When uv cannot install them.

Return type:

None

repomatic.tooling.nuitka.prepare_compile_cache(cache_dir, ccache_dir, work_root)[source]¶

Trim the Nuitka compile cache, then write the settings of ccache.

Two duties. The trim resets a cache past COMPILE_CACHE_CAP. The settings land in the CCACHE_CONFIG file of ccache_dir, which ccache always reads, and which the cache step of the workflow saves with the objects:

  • compiler_check = content hashes the compiler binary’s content. The default check reads its modification time and size, which runner VMs do not keep stable.

  • base_dir makes ccache hash every path below work_root as a relative path, so a work root that moves between machines keeps its keys. Nuitka sets no base_dir of its own.

Parameters:
  • cache_dir (Path) – The directory NUITKA_CACHE_DIR names.

  • ccache_dir (Path) – The directory CCACHE_DIR names.

  • work_root (Path | None) – The directory holding every checkout of the runner, or None to leave base_dir unset.

Return type:

None

repomatic.tooling.nuitka.prepare_nuitka_build(metadata)[source]¶

Ready this machine for the Nuitka build repomatic run nuitka starts.

Installs the [tool.repomatic] nuitka.extras, then prepares the compile cache when the job relocated it under NUITKA_CACHE_DIR and the target keeps one (see compile_cache). Outside CI the variable is unset, and the cache is left alone.

Parameters:

metadata (Metadata) – The project the binary is built from.

Return type:

dict[str, str]

Returns:

The environment variables the build of this machine’s target needs, from build_env.