hatchling (Python)

The host owns pyproject.toml and points hatchling at the generated package with [tool.hatch.build.targets.wheel] packages.

Language Python
Build system hatchling
Idiom B -- your project owns the manifest
Regeneration None -- regeneration is an explicit step

Notes

The generated tree is an ordinary Python package, so pointing a backend at it is one line of configuration. dsdlc's own pyproject.toml is still sitting in generated/, inert -- nothing builds that directory.

Every Python recipe builds its own virtual environment and lets pip fetch the build backend into it. That is correct isolation regardless, and it is the only thing that works on a distribution that marks its interpreter externally managed (PEP 668) -- which the toolshed image does.

Prerequisites

Tool Why
python3 creates the virtual environment the backend installs into

Commands

Run these from the recipe directory, with dsdl/ and src/ copied alongside it. This is the exact sequence CI runs.

# generate
dsdlc --target-language python dsdl/lanyard --py-package lanyard --outdir generated
# virtual environment
python3 -m venv .venv
# install
.venv/bin/pip install -q .
# round-trip
.venv/bin/python src/python/test_roundtrip.py

The types this builds

The whole lanyard namespace -- twenty-four definitions, browsable from the showroom overview, where each one is paired with its wire-layout facts and a declaration excerpt in every language.

The build files

pyproject.toml

# The host owns this file. dsdlc also wrote a pyproject.toml into generated/, declaring setuptools;
# it is inert here because nothing builds that directory -- only the setuptools recipe uses it.
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"

[project]
name = "lanyard"
version = "0.1.0"
description = "Host project consuming generated DSDL types"
requires-python = ">=3.10"

# Point the backend at the package dsdlc generated. Everything under it -- the namespace packages,
# the runtime, py.typed -- comes along, because it is an ordinary Python package.
[tool.hatch.build.targets.wheel]
packages = ["generated/lanyard"]