Skip to content

feat(dsl): chainable .setup() on all toolchains (Python + TypeScript)#151

Merged
markovejnovic merged 5 commits into
mainfrom
feat/toolchain-setup-method
Jun 17, 2026
Merged

feat(dsl): chainable .setup() on all toolchains (Python + TypeScript)#151
markovejnovic merged 5 commits into
mainfrom
feat/toolchain-setup-method

Conversation

@markovejnovic

Copy link
Copy Markdown
Contributor

What

Adds a chainable .setup(cmd, *, cwd, label, cache, env) method to every install-bearing toolchain object in both DSLs, so users can splice a prep step (codegen, fixtures, extra tooling) between "toolchain installed" and the action leaves. Each call returns a new toolchain of the same type with its install cursor advanced; later actions (compile/test/build/…) fork from it.

hm.elixir(path="elixir").setup("mix proto.gen").compile()   # chainable, immutable

This replaces the dataclasses.replace(installed=…) internal hack consumers were forced into.

Coverage

All 8 install-bearing classes, per language:
ElixirProject, PythonToolchain, GoToolchain, JsProject, ZigProject, ZigToolchain, RustToolchain, CMakeToolchain.

  • Python: one shared advance_install() helper (dataclasses.replace preserves every other field); read-only _HasInstalled Protocol member so frozen dataclasses satisfy it.
  • TypeScript: per-class setup() reconstructing via the class constructor; JsProject now retains pm to rebuild faithfully.

RustProject/CMakeProject (warmup/built wrappers) are intentionally excluded — their install boundary is on the toolchain (the correct pre-warmup insertion point); use hm.rust.toolchain().setup(...).project(...).

Tests / gates

  • Python: ruff clean, ty clean, full suite 563 passed (+ new parametrized tests/test_setup.py, 9 cases).
  • TypeScript: tsc --noEmit clean, full suite 421 passed (+ new tests/setup.test.ts, 10 cases).

Follow-ups

  • DSL reference docs regenerate from the new docstrings at deploy (make docs-generate).
  • A new hm release is needed before consumers (e.g. simci's .hm/pipeline.py) can use .setup().

@markovejnovic markovejnovic merged commit b163aba into main Jun 17, 2026
16 of 17 checks passed
@markovejnovic markovejnovic deleted the feat/toolchain-setup-method branch June 17, 2026 15:18
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