New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Visibility of parameter options across subcommands with defaults #17
Comments
Hi Mark, Thanks for giving tyro a try! My guess is that this is possible with some The main reason is that each flag is only applied to the most recent preceding subcommand. This is how most CLI conventions (consider: A question/suggestion pair below -- please let me know if any of it's unclear! (I'm overseas at the moment though, so responses might be slow) (1) So while running
would print the help message for
to print the help message and options for (2) The easiest option would likely be with environment variables: you might pull tyro.cli(
tyro.conf.AvoidSubcommands[FullModelConfig],
default=FullModelConfig(
suba=submoda_defaults[os.environ['SUBA']],
subb=submodb_defaults[os.environ['SUBB']],
)
) To avoid environment variables, you can also do some manual |
Yes, actually I've been making do with suggestion (1) for now! In some ways, I am starting to prefer this, since it makes the help screens a bit shorter and more specific. However, (2) is a fantastic suggestion that I will probably explore (leaning towards the manual sys.argv parsing), since I haven't been using the tab completion as much. Thanks for your help! |
Hi Brent,
First off, I'm really liking this framework! I have a use case that kind of combines "base configs as subcommands" with "sequenced subcommands".
Say I have a module that has two submodules, A and B. Furthermore, say each submodule has several possible "typical" configurations, e.g. A1, A2..., B1, B2,...
What I would like to do is simultaneously:
-h
, the possible options for both submodules A and B.Is there currently a way of doing this? I've attached 2 examples. The first one sets up all base configs for both, but doesn't list all options with
-h
(it only lists options for the most recent subcommand). The second one will display all the possible parameter options for both A and B with-h
(after one of the subcommands is specified).I'm not even sure if what I'm trying to do is possible in a "subcommand" sense? I've also tried the AvoidSubcommands type but I can't really make that work either.
Thanks,
Mark
a.py:
Output:
b.py
Output:
The text was updated successfully, but these errors were encountered: