Skip to content

Add a --out flag so a caller can choose the output path - #21

Merged
jbloom merged 1 commit into
mainfrom
add-out-flag
Sep 2, 2026
Merged

jbloom merged 1 commit into
mainfrom
add-out-flag

Conversation

@jbloom

@jbloom jbloom commented Sep 2, 2026

Copy link
Copy Markdown
Member

Closes #20, and bumps the version to 0.2.0.

What changed

--out PATH on the CLI, resolved relative to the working directory rather than to the spec file, and mutually exclusive with the spec's own out — exactly one must be given:

given result
--out only renders there
spec out only unchanged from 0.1.0
both InputError naming both values
neither InputError asking for one

The check lives in load_spec(path, out=None), the one place the CLI and the Python API both pass through, so they cannot disagree; render_file(spec_path, out=None) threads it. out leaves spec.SHARED_KEYS for the new OUT_KEY, staying in OPTION_KEYS and in the allowed top-level keys. Spec.out is still a required dataclass field, populated from whichever source gave it, so nothing downstream changes: render already derives the report path from spec.out, and <stem>_report.txt therefore follows --out, .html check included.

Existing specs are unaffected — a spec that names its own out stays valid — so examples/*/spec.yaml and scripts/build_examples.sh are untouched. The inputs subcommand discussed in the issue is deliberately not here.

Docs

Meaning is written once, in a new Where the page is written section of docs/spec.md, with the intro paragraph and the required-keys table corrected and one cross-reference each from docs/index.md and docs/python-api.md. The CLI docstring's "every option lives in that file rather than in a flag" and CLAUDE.md's "there are no flags" both stopped being true and are fixed.

Verification

  • scripts/check.sh: 243 passed, ruff and black clean. New tests cover --out alone (page plus report), CWD-relative resolution against a spec in a subdirectory, both → error, neither → error, and --out foo.htm → error. Dropping out from SHARED_KEYS removes its case from the parametrized test_missing_shared_key_is_fatal; the two dedicated test_spec.py tests replace that coverage.
  • All four cases exercised by hand against examples/1f8b_active_site.
  • scripts/build_examples.sh re-renders examples/output/ byte-identically.
  • scripts/build_docs.sh (mkdocs build --strict) builds clean and resolves the new #where-the-page-is-written anchor.

No viewer.py or template change, so no browser check applies.

🤖 Generated with Claude Code

Closes #20. The output path is the one path a spec names that does not sit
beside it: every other -- csv, title_md, chain_representation, a local
structure -- is an input in the spec's own directory, so resolving out the
same way forces a caller whose build system owns the output tree to write
repository layout (`../../../results/...`) into a data file, and forces a
Snakemake rule to parse the spec at DAG-construction time to learn its own
output.

--out resolves relative to the working directory, and is mutually exclusive
with the spec's own out: exactly one must be given, checked in load_spec so
the CLI and the Python API cannot disagree. out therefore leaves
spec.SHARED_KEYS for the new OUT_KEY. Nothing downstream changes -- render
already derives the report path from spec.out, so <stem>_report.txt follows
--out and the .html check applies to it too.

Existing specs are unaffected: a spec that names its own out stays valid, so
the examples and scripts/build_examples.sh are untouched.

Released as 0.2.0.

Verified with scripts/check.sh, scripts/build_docs.sh (mkdocs --strict, which
resolves the new anchor), and scripts/build_examples.sh, which re-renders
examples/output/ byte-identically.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@jbloom
jbloom merged commit 30ba448 into main Sep 2, 2026
4 checks passed
@jbloom
jbloom deleted the add-out-flag branch September 2, 2026 13:14
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.

Add a --out flag so a caller can choose the output path

1 participant