Skip to content

List pipeline-level config keys in CLI help (closes #320)#381

Merged
mmcdermott merged 5 commits intodevfrom
fix/pipeline-args-in-help
Apr 20, 2026
Merged

List pipeline-level config keys in CLI help (closes #320)#381
mmcdermott merged 5 commits intodevfrom
fix/pipeline-args-in-help

Conversation

@mmcdermott
Copy link
Copy Markdown
Owner

@mmcdermott mmcdermott commented Apr 17, 2026

Summary

Closes #320. Users had no way to discover pipeline-level keys (input_dir, output_dir, parallelize.*, stages, description) from -h; they had to grep runner.py.

Both CLIs now append the same table after their usage:

Pipeline-level configuration keys (settable in the pipeline YAML; `--overrides` is accepted by `MEDS_transform-pipeline`):
  input_dir                    Root MEDS directory to read from ...
  output_dir                   Root directory to write stage outputs into.
  stages                       List of stage configs defining the pipeline ...
  description                  Optional free-text pipeline description.
  parallelize.n_workers        Number of parallel workers to launch per stage (default 1).
  parallelize.launcher         Hydra launcher to use (e.g. 'joblib', 'slurm').
  parallelize.launcher_params  Launcher-specific keyword arguments forwarded to Hydra.

The table is defined once in src/MEDS_transforms/_cli_help.py (PIPELINE_CONFIG_KEYS) and consumed by both entrypoints. runner.main() imports only _cli_help so the pipeline runner's help path stays free of the Hydra/ConfigStore imports that __main__ pulls in.

Test plan

  • Manual: MEDS_transform-pipeline -h and MEDS_transform-stage -h both show the new block.
  • test_pipeline_help extended and new test_stage_help_lists_pipeline_keys asserts the block.
  • Full non-parallel suite passes.

Closes #320

🤖 Generated with Claude Code

Both MEDS_transform-pipeline -h and MEDS_transform-stage -h now list the
accepted pipeline-level configuration keys (input_dir, output_dir,
stages, description, parallelize.*) alongside the argparse/stage usage,
so users can discover them without reading runner.py.

Closes #320.
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 17, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.24%. Comparing base (daeecca) to head (cb256da).
⚠️ Report is 28 commits behind head on dev.

Additional details and impacted files
@@            Coverage Diff             @@
##              dev     #381      +/-   ##
==========================================
+ Coverage   98.16%   98.24%   +0.07%     
==========================================
  Files          54       55       +1     
  Lines        2510     2619     +109     
==========================================
+ Hits         2464     2573     +109     
  Misses         46       46              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds discoverability for pipeline-level YAML/--overrides keys by surfacing a shared “Pipeline-level configuration keys …” table in both the pipeline runner (MEDS_transform-pipeline -h) and the stage dispatcher help.

Changes:

  • Define PIPELINE_CONFIG_KEYS and a formatter helper to render a consistent help-text block.
  • Append the help block to MEDS_transform-stage help output.
  • Add the help block as an argparse epilog for MEDS_transform-pipeline -h.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
src/MEDS_transforms/runner.py Adds an argparse epilog to include the pipeline-level config keys table in -h output.
src/MEDS_transforms/__main__.py Defines the shared keys table + help-block builder and prints it in stage CLI help.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/MEDS_transforms/runner.py
Comment thread src/MEDS_transforms/__main__.py Outdated
Comment thread src/MEDS_transforms/runner.py Outdated
- Move PIPELINE_CONFIG_KEYS and the help-block formatter into a
  new, dependency-light module src/MEDS_transforms/_cli_help.py.
  runner.main() no longer imports __main__ (and therefore Hydra) just
  to format its epilog; __main__.print_help_stage imports the helper
  lazily at call time.
- Rename the function to pipeline_keys_help_block (dropped the leading
  underscore): it's deliberately a cross-module helper.
- Extend test_pipeline_help to assert the new block appears, and add
  test_stage_help_lists_pipeline_keys for the stage dispatcher.
@mmcdermott
Copy link
Copy Markdown
Owner Author

All three comments addressed in a64a03d:

  • Private helper imported from another module: moved PIPELINE_CONFIG_KEYS and the formatter into a new dependency-light module src/MEDS_transforms/_cli_help.py. Renamed the function to pipeline_keys_help_block (no leading underscore) — it's deliberately a cross-module helper.
  • Heavy import chain for runner -h: runner.main() now imports _cli_help instead of main. main still pulls Hydra for the stage dispatcher, but that's no longer in the pipeline runner's help path.
  • Missing help-block test coverage: extended test_pipeline_help and added test_stage_help_lists_pipeline_keys so both CLI help surfaces regress-check for the keys block.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/MEDS_transforms/_cli_help.py Outdated
Comment thread src/MEDS_transforms/_cli_help.py
Reword the help-block header so it no longer implies --overrides works
for MEDS_transform-stage. New phrasing: keys are settable in the
pipeline YAML; --overrides is specifically the pipeline runner's flag.
@mmcdermott
Copy link
Copy Markdown
Owner Author

Both round-2 comments addressed:

  • Header implies --overrides works for the stage CLI (bde4b11): reworded to "settable in the pipeline YAML; --overrides is accepted by MEDS_transform-pipeline" — no longer implies the stage CLI accepts that flag.
  • PR description / code mismatch: updated the PR description to say _cli_help.PIPELINE_CONFIG_KEYS instead of __main__.PIPELINE_CONFIG_KEYS.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/MEDS_transforms/_cli_help.py
Clarify in the help-block header that dot-notation (e.g. `parallelize.n_workers`)
is the Hydra override path accepted by `--overrides`, and that pipeline YAML
needs nested mappings (`parallelize:` → `n_workers:`). Keeps the compact table
while removing the implication that `parallelize.n_workers:` is valid YAML.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Comment thread src/MEDS_transforms/_cli_help.py Outdated
is written as a nested mapping (``parallelize:`` with ``n_workers:`` indented beneath).

Examples:
>>> block = pipeline_keys_help_block()
Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just show the block.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in cb256da — doctest now calls print(pipeline_keys_help_block()) and locks in the full rendered block verbatim. Makes the expected output self-documenting and catches any accidental wording/spacing drift.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Replaces the three piecewise assertions (startswith / in / in) with a
single `print(pipeline_keys_help_block())` that shows the whole block.
Locks in the exact rendered text and doubles as documentation.

Also split the header into three wrapped lines so long CLI help renders
without line-wrapping midword; this is the form the doctest now shows.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@mmcdermott mmcdermott merged commit e1e31d6 into dev Apr 20, 2026
9 checks passed
@mmcdermott mmcdermott deleted the fix/pipeline-args-in-help branch April 20, 2026 03:37
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.

2 participants