Skip to content

Let runs carry a template and let ingredient runs own their name - #236

Closed
wjohnald wants to merge 1 commit into
mainfrom
improve/run-template-and-ingredient-name
Closed

wjohnald wants to merge 1 commit into
mainfrom
improve/run-template-and-ingredient-name

Conversation

@wjohnald

Copy link
Copy Markdown

Material, process, and measurement runs accept an optional template of their own. The template property returns the run's own template when it has one, and otherwise returns the template of its spec, as before. The attribute setters read that property, so they also check a run that has a template and no spec against its bounds.

Ingredient runs accept their own name and labels, and these take precedence over the values on the spec. When a run has neither, it reads the values from its spec, as before, and loading a run restores both values. Ingredient runs have no template of their own.

The change is additive. Existing objects behave as they did, with two corner cases. An ingredient run with no spec and no labels returns an empty list for labels instead of None. An ingredient run that kept the name and labels of an earlier spec keeps them when a later spec is assigned.

The template property lives on the spec mix-in. Each run class also inherits the template trait, which stores the value and checks its type. Python cannot merge one property from two mix-ins. The spec mix-in defines the getter and setter, and delegates storage to the template trait.

The version bump is minor, from 2.2.5 to 2.3.0.

Test commands run locally, all passing:

  • uv run ruff check gemd tests
  • uv run ruff format --check gemd tests
  • uv run flake8 gemd
  • uv run pytest --cov=gemd --cov-fail-under=100

🤖 Generated with Claude Code

MaterialRun, ProcessRun and MeasurementRun accept an optional template that takes precedence over the template of the spec. IngredientRun accepts its own name and labels and falls back to the values on the spec. The version moves from 2.2.5 to 2.3.0.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@wjohnald wjohnald closed this Oct 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant