Skip to content

chore: add the local-setup.sh environment hook - #394

Open
tschm wants to merge 5 commits into
janushendersonassetallocation:masterfrom
tschm:chore/add-local-setup-hook
Open

chore: add the local-setup.sh environment hook#394
tschm wants to merge 5 commits into
janushendersonassetallocation:masterfrom
tschm:chore/add-local-setup-hook

Conversation

@tschm

@tschm tschm commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

What

Adds local-setup.sh at the repository root — the repo-owned environment hook that rhiza-task's setup task execs when it exists. Copied from markrichardson/dummyrepo.

Why

setup is a prerequisite of install, which is a prerequisite of essentially every gate, so this hook runs on local make test, on every CI job invoking uvx rhiza-task <gate>, and on the devcontainer's make install. loman had no such hook: nothing has provisioned graphviz since rhiza v1.4.0 retired the make layer and orphaned .rhiza/scripts/customisations/build-extras.sh, which did the same job (apt-only, and assumed sudo).

graphviz is needed by docs/notebooks/notebook-extras.py, which builds a loman.Computation and draws it by shelling out to dot. Nothing in src/ or tests/ needs it.

Behaviour

  • Exits early — within milliseconds — when dot is already on PATH, which is the common case.
  • Resolves sudo once, handling both root containers (no sudo) and GitHub runners (sudo required).
  • Covers apt-get, brew (never under sudo), dnf and apk.
  • A missing package manager warns rather than fails: every gate reaches this hook and only one notebook needs the dependency, so failing would block make test on a machine with no use for it. The warning names what is missing and what breaks.
  • A package manager that exits 0 without putting dot on PATH is still an error — that is the silent-green outcome the hook exists to remove.

Note

Windows cannot run this: setup execs the hook directly and Windows refuses to start a .sh, which the task reports as a failure. Documented in the file's own header.

Closes #390.

🤖 Generated with Claude Code

tschm and others added 5 commits September 3, 2026 06:44
`rhiza-task`'s `setup` task execs a repo-owned `local-setup.sh` from the
repository root if one exists; loman had none, so nothing provisioned
graphviz after v1.4.0 retired the make layer and orphaned
`.rhiza/scripts/customisations/build-extras.sh`.

The hook installs graphviz — needed by
`docs/notebooks/notebook-extras.py`, which renders a `loman.Computation`
by shelling out to `dot`. It exits early when `dot` is already on PATH,
resolves `sudo` once for root and non-root, and covers apt-get, brew,
dnf and apk. A missing package manager warns rather than fails, since
every gate reaches this hook and only one notebook needs the
dependency; a package manager that exits 0 without putting `dot` on
PATH is still an error.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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.

Follow the hook approach to install graphviz

1 participant