poetry (Python)¶
The host owns pyproject.toml and points poetry-core at the generated package with packages = [{include = ..., from = ...}].
| Language | Python |
| Build system | poetry |
| Idiom | B -- your project owns the manifest |
| Regeneration | None -- regeneration is an explicit step |
Notes¶
Poetry splits the location across two keys -- include names the package, from names the directory to find it in. Metadata lives in the standard [project] table, which poetry-core 2.x reads; older poetry required everything under [tool.poetry].
Every Python recipe builds its own virtual environment and lets pip fetch the build backend into it. That is correct isolation regardless, and on a distribution that marks its interpreter externally managed (PEP 668) -- which the toolshed image does -- nothing else works.
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 --versioned-type-names 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; only the setuptools recipe uses it.
[build-system]
requires = ["poetry-core>=2.0"]
build-backend = "poetry.core.masonry.api"
[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.
[tool.poetry]
packages = [{include = "lanyard", from = "generated"}]