Skip to content

Implement --config for various commands - #2041

Open
victorlin wants to merge 11 commits into
victorlin/refine-configfrom
victorlin/ancestral-config
Open

victorlin wants to merge 11 commits into
victorlin/refine-configfrom
victorlin/ancestral-config

Conversation

@victorlin

@victorlin victorlin commented Aug 17, 2026 •

Copy link
Copy Markdown
Member

Description of proposed changes

Adds the --config option to align, ancestral, frequencies, mask, traits, translate, and tree using patterns from #2040.

Docs preview: https://nextstrain--2041.org.readthedocs.build/projects/augur/en/2041/usage/cli/ancestral.html#configuration

Review threads

Checklist

  • Automated checks pass
  • Check if you need to add a changelog message
  • Check if you need to add tests
  • Check if you need to update docs
  • PR nextstrain.org for schema routes

@victorlin victorlin self-assigned this Aug 17, 2026
@victorlin victorlin mentioned this pull request Aug 17, 2026
7 tasks
@codecov

codecov Bot commented Aug 17, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 74.56%. Comparing base (895e092) to head (130695c).

Additional details and impacted files
@@                     Coverage Diff                     @@
##           victorlin/refine-config    #2041      +/-   ##
===========================================================
+ Coverage                    74.54%   74.56%   +0.01%     
===========================================================
  Files                           86       86              
  Lines                        10874    10882       +8     
  Branches                      2123     2123              
===========================================================
+ Hits                          8106     8114       +8     
  Misses                        2373     2373              
  Partials                       395      395              

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@victorlin
victorlin force-pushed the victorlin/ancestral-config branch from 84a4cf1 to cf04a1a Compare August 18, 2026 00:24
@jameshadfield jameshadfield mentioned this pull request Aug 18, 2026
4 of 5 tasks
@victorlin
victorlin force-pushed the victorlin/ancestral-config branch from cf04a1a to 83f7695 Compare August 28, 2026 23:19
@victorlin
victorlin force-pushed the victorlin/ancestral-config branch from 83f7695 to 3ae0ba4 Compare September 1, 2026 23:27
@victorlin victorlin changed the title ancestral: Implement --config Implement --config for various commands Sep 1, 2026
@victorlin
victorlin force-pushed the victorlin/ancestral-config branch from 3ae0ba4 to 471f841 Compare September 2, 2026 00:05
Comment thread augur/translate.py
@victorlin
victorlin force-pushed the victorlin/ancestral-config branch 2 times, most recently from 4f26088 to 279a49d Compare September 5, 2026 00:41
@victorlin
victorlin force-pushed the victorlin/ancestral-config branch from 279a49d to 02ba681 Compare September 5, 2026 00:46
@victorlin
victorlin force-pushed the victorlin/ancestral-config branch 2 times, most recently from 7312956 to db08e96 Compare September 15, 2026 23:58
@victorlin
victorlin force-pushed the victorlin/ancestral-config branch from db08e96 to bade472 Compare September 18, 2026 22:11
Comment thread augur/data/schema-export-v2-config.json Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looking at the addition of color_by_metadata in nextstrain/measles#148 and this PR, I think the --config option for export really highlights the need for cleaning up + documenting the interactions between the Auspice config JSON and the CLI/YAML options. However, that's a bigger project that I don't want to block this work...

For now, maybe there's a way to add the description from the argument group to the schema (with minor edits to refer to config YAML options):

augur/augur/export_v2.py

Lines 912 to 915 in 0d28749

description="These control the display settings for auspice. \
Config JSON(s) allow customisation of all available options whereas individual command line arguments are more limited but great to get started. \
Supplying both is fine too, command line args will overrule what is set in the config file. \
Multiple JSONs will be merged together, and lists present in multiple configs will be merged by extending the original list."

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The auspice-config JSON is (conceptually!) the config YAML we're now introducing elsewhere, and in the long run we could/should probably replace the auspice-config JSON with a --config YAML. Pragmatically, here are the CLI args not currently exposed in the JSON:

Files:

  • tree, metadata, output, node-data # part of the typical snakemake pipeline
  • description markdown, warning text # should be in auspice-config json:
  • colors TSV, auspice-config JSON

Misc:

  • minification
  • validation mode
  • metadata strain column / delimeters

If we put the description markdown & warning text files into the auspice-config JSON, then we're down to a handful of possible options we (the workflow) want to expose as user-config. I think these are feasible to do the old-fashioned way. Which is to say, short term I don't think we need a config YAML at the moment and long term the config YAML can replace the auspice config JSON

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Because the JSON is nested, a full switch from JSON to YAML is not possible with the ConfigArgParse implementation, just like how augur subsample --config must be handled separately. I think we all agree the full switch is the best solution. We have the following short term options:

  1. Leave export as CLI + JSON only, with some CLI options exposed through YAML on the workflow level.
  2. Expose all CLI options through YAML with --config. JSON is still the only option for data_provenance, etc.

f9e1672 is (2). It allows for more flexibility, and our workflow config is a half-baked implementation of this (nextstrain/measles#148 baked it a little more). But it is also confusing to have both --config and --auspice-config under augur export v2 --help.
(1) makes export v2 a loner when everything else has been moved over.

Maybe it's reasonable to block the --config work on the full switch from JSON to YAML for export v2.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Because the JSON is nested, a full switch from JSON to YAML is not possible with the ConfigArgParse implementation, just like how augur subsample --config must be handled separately.

Oh hmm, does this mean we would also remove the CLI options for params that are provided via the YAML?


An alternative to (1) (similar to what James is proposing), is making sure all Auspice configs are available via the JSON. Then in the YAML exclude all display configuration options that are not auspice_config, i.e. disabling CLI overrides in workflows that use --config. In practice, this would probably look like replacing nextstrain/measles#148 with multiple layered JSONs that are provided via auspice_config.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Oh hmm, does this mean we would also remove the CLI options for params that are provided via the YAML?

We could keep them. It won't be as simple as with ConfigArgParse, but we could apply the overrides in a similar fashion as the existing implementation.

Alternatively, we could implement something like Snakemake's --config to allow generic overrides via CLI, but that would be a new pattern and we'd need another name for the option.

@victorlin
victorlin force-pushed the victorlin/ancestral-config branch from bade472 to 087da7d Compare September 23, 2026 21:53
@victorlin
victorlin removed this pull request from stack #2042 September 23, 2026 22:01
@victorlin
victorlin added this pull request to stack #2052 September 23, 2026 22:01
@victorlin
victorlin force-pushed the victorlin/ancestral-config branch from 087da7d to 130695c Compare September 23, 2026 22:07
@victorlin
victorlin force-pushed the victorlin/ancestral-config branch from 130695c to 70a97ed Compare September 26, 2026 00:46
@victorlin
victorlin removed this pull request from stack #2052 September 26, 2026 00:46
@victorlin
victorlin added this pull request to stack #2054 September 26, 2026 00:47
Adds the --config option to augur ancestral using patterns from augur
refine's --config option.

Updated help text to reference both CLI and YAML syntax, now that both
are valid options.

Added code to handle enums in the schema generating script, since enums
are used in ancestral and not refine.
Change the default from False to implicit None, since the option should
take a file path not boolean.
The default is already rendered in both CLI help text and docs.
Adds the --config option to augur align using patterns from augur
refine's --config option.
Adds the --config option to augur mask using patterns from augur
refine's --config option.
Adds the --config option to augur tree using patterns from augur
refine's --config option.

Updated help text to reference both CLI and YAML syntax, now that both
are valid options.
Adds the --config option to augur translate using patterns from augur
refine's --config option.

Updated help text to reference both CLI and YAML syntax, now that both
are valid options.
This keeps the test focused on command-specific functionality rather
than parser specifics which change over time.
Adds the --config option to augur traits using patterns from augur
refine's --config option.
Adds the --config option to augur frequencies using patterns from augur
refine's --config option.

The schema generating script was updated to handle the min/max_date
options which take either a string or number.
@victorlin
victorlin force-pushed the victorlin/ancestral-config branch from 70a97ed to e2737ae Compare September 26, 2026 00:51
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.

3 participants