Skip to content

Add generic get_referenced_files() - #2049

Closed
victorlin wants to merge 4 commits into
victorlin/ancestral-configfrom
victorlin/get_referenced_files
Closed

victorlin wants to merge 4 commits into
victorlin/ancestral-configfrom
victorlin/get_referenced_files

Conversation

@victorlin

@victorlin victorlin commented Sep 16, 2026 •

Copy link
Copy Markdown
Member

Description of proposed changes

This PR contains 3 prep commits and 1 main commit. Message from main commit:

Now that other commands accept config files with filepaths marked in schema, the generic get_referenced_files() function is necessary for adoption in Snakemake workflows where referenced files are to be listed as inputs for file change detection.

Some changes were necessary as the previous subsample-specific function hardcoded the schema within the function. The generic function solves this by requiring the $schema key in the config.

Keeping the subsample-specific function around because it's used by some workflows. Will remove once those workflows are updated to use the generic function.

Related issue(s)

Follow-up to #2041 (comment)

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

@victorlin victorlin self-assigned this Sep 16, 2026
@victorlin
victorlin added this pull request to stack #2042 September 16, 2026 00:02
@victorlin
victorlin force-pushed the victorlin/ancestral-config branch from db08e96 to bade472 Compare September 18, 2026 22:11
@victorlin
victorlin force-pushed the victorlin/get_referenced_files branch 2 times, most recently from 5fa766e to b77213d Compare September 18, 2026 22:44
@victorlin
victorlin force-pushed the victorlin/get_referenced_files branch 3 times, most recently from c38407b to f57365e Compare September 22, 2026 23:29
@codecov

codecov Bot commented Sep 22, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 91.20000% with 11 lines in your changes missing coverage. Please review.
✅ Project coverage is 74.64%. Comparing base (130695c) to head (b1e78b7).

Files with missing lines Patch % Lines
augur/config.py 94.38% 2 Missing and 3 partials ⚠️
augur/subsample.py 66.66% 4 Missing ⚠️
augur/validate.py 90.90% 2 Missing ⚠️
Additional details and impacted files
@@                      Coverage Diff                       @@
##           victorlin/ancestral-config    #2049      +/-   ##
==============================================================
+ Coverage                       74.56%   74.64%   +0.08%     
==============================================================
  Files                              86       86              
  Lines                           10882    10898      +16     
  Branches                         2123     2122       -1     
==============================================================
+ Hits                             8114     8135      +21     
+ Misses                           2373     2370       -3     
+ Partials                          395      393       -2     

☔ 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

Copy link
Copy Markdown
Member Author

The newest commit f57365e is necessary for proper nextstrain run support. It's a big change and I'm inclined to move it + all type=InputFile additions to (yes, another) PR at the beginning of the stack. This way, it could be merged first to see the immediate side effects, and would simplify existing workflows by removing the need to call resolve_config_path in many places.

@victorlin victorlin mentioned this pull request Sep 23, 2026
5 tasks
@victorlin

Copy link
Copy Markdown
Member Author

Moved f57365e and related changes to #2051.

would simplify existing workflows by removing the need to call resolve_config_path in many places.

I was wrong about this. We'd still need resolve_config_path in the inputs block just like how we need get_referenced_files in the input block when using --config.

@victorlin
victorlin force-pushed the victorlin/get_referenced_files branch from f57365e to a071931 Compare September 23, 2026 21:53
@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/get_referenced_files branch from a071931 to 9b23556 Compare September 23, 2026 22:07
@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/get_referenced_files branch from 9b23556 to 2eb799b Compare September 23, 2026 22:26
@victorlin victorlin changed the title Move get_referenced_files() and helpers to augur.config Add generic get_referenced_files() Sep 23, 2026
@victorlin
victorlin force-pushed the victorlin/get_referenced_files branch from 2eb799b to b1e78b7 Compare September 23, 2026 22:37
@victorlin

Copy link
Copy Markdown
Member Author

After some more thought, I think #2051 is the wrong direction. We can resolve file paths for just values in YAML without affecting CLI. I'll plan to update this PR with that approach and close #2051.

@victorlin
victorlin force-pushed the victorlin/get_referenced_files branch from b1e78b7 to e9162c8 Compare September 26, 2026 00:46
@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
$schema is used in the schema to refer to the meta-schema,¹ but it is
also common practice to use the same key in schema-adherent files for
strictness, similar to typing a variable in code.

One benefit is IDE hints² for users who open these config files in a
editor that understands this key, but more importantly we can use it in
our own processing of config files.

¹ https://json-schema.org/understanding-json-schema/reference/schema#schema
² https://code.visualstudio.com/docs/languages/json#_json-schemas-and-settings
Split the Augur-loading functionality of `load_json_schema()` into a
higher level function `load_augur_json_schema()` so that the former can
be kept lower level.

There are now two external facing functions with clear intent:
`load_augur_json_schema()` and `load_json_schema_locally()`
This will be useful for loading from URLs from a $schema key.
Now that other commands accept config files with filepaths marked in schema, the
generic get_referenced_files() function is necessary for adoption in Snakemake
workflows where referenced files are to be listed as inputs for file change
detection.

Some changes were necessary as the previous subsample-specific function
hardcodes the schema within the function. The generic function solves this by
requiring the $schema key in the config.

Keeping the subsample-specific function around because it's used by some
workflows. Will remove once those workflows are updated to use the
generic function.
@victorlin
victorlin force-pushed the victorlin/ancestral-config branch from 70a97ed to e2737ae Compare September 26, 2026 00:51
@victorlin
victorlin force-pushed the victorlin/get_referenced_files branch from e9162c8 to bb28bc5 Compare September 26, 2026 00:51
@victorlin

Copy link
Copy Markdown
Member Author

Moving these changes to #2040 since they're required for that PR to work.

@victorlin victorlin closed this Oct 14, 2026
@victorlin
victorlin deleted the victorlin/get_referenced_files branch October 14, 2026 18:52
@victorlin
victorlin removed this pull request from stack #2054 October 14, 2026 18:58
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.

1 participant