Add a --out flag so a caller can choose the output path - #21
Merged
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #20, and bumps the version to 0.2.0.
What changed
--out PATHon the CLI, resolved relative to the working directory rather than to the spec file, and mutually exclusive with the spec's ownout— exactly one must be given:--outonlyoutonlyInputErrornaming both valuesInputErrorasking for oneThe 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.outleavesspec.SHARED_KEYSfor the newOUT_KEY, staying inOPTION_KEYSand in the allowed top-level keys.Spec.outis still a required dataclass field, populated from whichever source gave it, so nothing downstream changes:renderalready derives the report path fromspec.out, and<stem>_report.txttherefore follows--out,.htmlcheck included.Existing specs are unaffected — a spec that names its own
outstays valid — soexamples/*/spec.yamlandscripts/build_examples.share untouched. Theinputssubcommand 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 fromdocs/index.mdanddocs/python-api.md. The CLI docstring's "every option lives in that file rather than in a flag" andCLAUDE.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--outalone (page plus report), CWD-relative resolution against a spec in a subdirectory, both → error, neither → error, and--out foo.htm→ error. DroppingoutfromSHARED_KEYSremoves its case from the parametrizedtest_missing_shared_key_is_fatal; the two dedicatedtest_spec.pytests replace that coverage.examples/1f8b_active_site.scripts/build_examples.shre-rendersexamples/output/byte-identically.scripts/build_docs.sh(mkdocs build --strict) builds clean and resolves the new#where-the-page-is-writtenanchor.No
viewer.pyor template change, so no browser check applies.🤖 Generated with Claude Code