Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## victorlin/resolve-input-file-paths #2040 +/- ##
======================================================================
+ Coverage 74.39% 74.54% +0.15%
======================================================================
Files 86 86
Lines 10743 10874 +131
Branches 2093 2123 +30
======================================================================
+ Hits 7992 8106 +114
- Misses 2365 2373 +8
- Partials 386 395 +9 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
0d1ed80 to
8d72633
Compare
joverlee521
left a comment
There was a problem hiding this comment.
Kudos for designing a way to create the config schema from the parser! I left some open questions for discussion, but I do really like this direction.
8d72633 to
c0e909f
Compare
jameshadfield
left a comment
There was a problem hiding this comment.
Really cool to see this Victor. I tried to dive as deep as I could, although argparse constantly confuses me! It was nice to see how simple this work made it to add this capability to further commands in #2041
| "metadata": { | ||
| "description": "sequence metadata", | ||
| "type": "string" | ||
| }, |
There was a problem hiding this comment.
Aside: I imagine we'll use this schema for a general get_referenced_files function. That function (I think!) wants to see filepaths declared in the schema (if prop_schema.get("format") == "filepath") which are present in the subsampling schema:
augur/augur/data/schema-subsample-config.json
Lines 60 to 65 in 0aed098
should we be adding them here?
There was a problem hiding this comment.
Good point. There's nothing in the current argparse usage that marks arguments as filepaths, so I've added a custom InputFile type for the schema generating script:
augur/devel/regenerate-config-schemas
Lines 116 to 118 in 7838bb3
There was a problem hiding this comment.
One related point -- some arguments are files or non-files. At least, I think we have some of them! We can leave their handling until we encounter them tho.
There was a problem hiding this comment.
I've encountered this in #2041 for augur translate --genes. Leaving it as-is for now, but I think it would be clarifying to split into --genes/--genes-file so that we can type the latter as InputFile.
There was a problem hiding this comment.
Yeah, I'm on board with that separation -- it'll make our lives much easier!
3bdd7f3 to
11a6933
Compare
11a6933 to
b3796ea
Compare
joverlee521
left a comment
There was a problem hiding this comment.
This is a good base for all of the other config based commands and I think it's in a good place to merge.
|
Thanks for reviewing @joverlee521! As mentioned in dev chat, I think it'd be good to implement |
b3796ea to
7531eae
Compare
7531eae to
03c4e8d
Compare
09fe0a7 to
aa9d0e7
Compare
5278ff5 to
d56cf2f
Compare
d56cf2f to
f0ebe4b
Compare
895e092 to
b1c0439
Compare
Enables configuration via a YAML file in addition to CLI arguments. All options available in the CLI are also available in the YAML file, but an option cannot be set in both simultaneously. Updated help text to reference both CLI and YAML syntax, now that both are valid options. Implemented using a new dependency, ConfigArgParse. It handles the YAML configuration within argparse so that the rest of the code can continue referencing the values from argparse. Lots of behavioral customization was added in CustomArgumentParser. Note that it doesn't make sense to use ConfigArgParse with augur subsample because the YAML config used in that command has a nested structure, opposed to the flat structure implicitly supported by the CLI. This commit just adds the functionality and a test. More to come in the following commits.
This will be useful as a basis for documentation, and validation by pathogen workflows. Done with a new script that inspects the argparse parser object so that all the logic and help text can stay in register_parser(). Added a new type=InputFile for argparse so that the schema can mark certain properties as filepaths.
The schema by itself isn't very useful for users. A table describing the available options is much more decipherable. Luckily we already do something for augur subsample's config docs. I've generalized an existing helper function to work with any flat JSON schema.
`covariance: False` accomplishes the same thing in a more intuitive syntax for the config file. Done by marking the option as CLI-only using a custom param in argparse's add_argument().
This was likely always the intention, but they were allowed together without the mutually exclusive group. The injection of cli_only in CustomArgumentParser.add_argument() is no longer sufficient as previously noted. Instead of monkeypatching the underlying add_argument() call, I chose to apply the same treatment to individual custom classes – more code but less hacky.
b1c0439 to
9c8f2f7
Compare
Description of proposed changes
This PR implements
augur refine --config, an option similar toaugur subsample --configbut foraugur refine's own CLI options. See commits for details and #1987 for the motivation.The implementation was written in a way that should make it easy to add
--configto other commands in the future.Docs preview: https://nextstrain--2040.org.readthedocs.build/projects/augur/en/2040/usage/cli/refine.html#configuration
Notable review threads
no_covariancefrom config file? yesChecklist