Language Page

kbuild for Python

This page is assembled from markdown in ktools-python. GitHub links point to the workspace repo and the relevant source files or directories.

2 markdown sections
QM-Code/ktools-python primary repo
HTML static output

kbuild` In `ktools-python

ktools-python/docs/kbuild.md

The Python workspace uses the shared kbuild command model for batch builds and workspace orchestration.

Current Status

  • the checked-out workspace does not currently contain a separate kbuild/ implementation directory
  • the documented workflow assumes the shared kbuild command is available on PATH
  • Python component docs still describe direct python3 -m unittest execution where that is the clearest validation path

Kbuild Documentation

kbuild/docs/index.md

kbuild is a strict Python build and repo orchestration tool for ktools-style projects. It handles five related jobs:

  • creating and validating repo-local kbuild config
  • building core targets into named build slots
  • building ordered demo trees against the core SDK and dependency SDKs
  • scaffolding and helper operations such as repo initialization, git setup, and repo-local vcpkg
  • batch-forwarding commands into child repos

Start Here

Typical Flow

Fresh directory:

kbuild --kbuild-config
# edit .kbuild.json
kbuild --kbuild-init
kbuild --vcpkg-install

Existing repo:

kbuild --build-latest
kbuild --build-demos
kbuild --clean-latest

kbuild selects exactly one backend from the repo config. The shared tree currently supports:

  • cmake
  • cargo
  • java
  • swift
  • kotlin
  • csharp
  • javascript

Core Concepts

Repo root

  • kbuild only runs from a directory containing ./.kbuild.json.

Primary config

  • ./.kbuild.json is the required repo marker and primary config file.

Optional shared base

  • ./kbuild.json is optional. When present, kbuild deep-merges ./.kbuild.json on top of it.

Build slots

  • Core builds live under build/<slot>/.
  • Demo builds live under demo/<demo>/build/<slot>/.
  • The default slot is latest.

SDK-first demos

  • Root builds install an SDK under build/<slot>/sdk.
  • Demos consume that SDK, optional dependency SDKs, and optionally earlier demo SDK outputs in the requested order.

Repo-local vcpkg

  • When the effective config defines vcpkg, kbuild expects a repo-local checkout under ./vcpkg/src and integrates it through CMake manifest mode.

Which Command Should I Reach For?

  • Use kbuild --build-latest for the normal build path.
  • Use kbuild --build-demos when you want explicit demo validation.
  • Use kbuild --cmake-no-configure only for cmake repos when the target build directory already contains CMakeCache.txt.
  • Use kbuild --vcpkg-install only for cmake repos the first time a repo-local vcpkg project is prepared.
  • Use kbuild --git-initialize only once, after scaffold generation and remote creation.

Working References

If you want the code behind the behavior, start with:

If you want the exhaustive CLI and schema rules, use the full operator reference.