Skip to content
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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Output of --help with too much information #377

Open
harimkang opened this issue Sep 11, 2023 · 2 comments
Open

Output of --help with too much information #377

harimkang opened this issue Sep 11, 2023 · 2 comments
Labels
enhancement New feature or request

Comments

@harimkang
Copy link

harimkang commented Sep 11, 2023

馃殌 Feature request

Hierarchy-level --help format:

There are many advantages to jsonargparse, and I'm a big fan of it.
However, jsonargparse also has its drawbacks, and I believe one of them is the --help message format.
So I think it would be nice to have a helpformatter(..?) that supports a simpler format and a verbose helpformatter that shows more details.
--help --verbose (or --help_detail..?)

Motivation

I'm a big fan of jsonargparse, as I've said before, and I think this project will only grow. Thank you for creating this library.
On the team, I'm working on adapting that library.
I think jsonargparse has a lot to offer to developers like me, with its API and CLI harmonization and flexible features.

However, if a class or method with many parameters and a long docstring is registered via jsonargparse, the user will be overwhelmed with too much --help output. (This makes '--help' too informative for open community users, and actually hinders help.)

I think this is an easy issue to encounter with jsonargparse. (This is because it is closely tied to the API.)
I thought it would be nice to have the ability to distinguish between --help messages that summarize the essentials and --help messages that go into more detail.

I'm hoping to get some ideas from the community, including repo maintainers, on this.

Pitch

For example, we support tons of hooks, but user don't need to know them all.
image
(The above output will make it difficult for light users to use.)

I'd like to keep this, but also have the ability to show shorter, more concise --help output.
I don't have any immediate suggestions, just that it would be nice to have a more customizable help formatter.

Alternatives

I've been thinking about disabling help altogether and providing it as a subcommand in the CLI. However, this would require quite a bit of effort and may not work well.

@harimkang harimkang added the enhancement New feature or request label Sep 11, 2023
@harimkang harimkang changed the title For various helpformatter support Outputting --help with too much information Sep 11, 2023
@harimkang harimkang changed the title Outputting --help with too much information Output of --help with too much information Sep 11, 2023
@mauvilsa
Copy link
Member

I agree that the help can have too much information. And the idea of multiple levels of details is an interesting one.

Currently the formatter class is a bit messy and not easy to extend to customize the formatting. I have thought of cleaning it up and decoupling the part about config comments. The cleanup might be convenient to implement something like multiple levels of details in the help. Though, most likely this would be a breaking change in the formatter, so would only happen for jsonargparse v5.

@harimkang
Copy link
Author

I agree that the help can have too much information. And the idea of multiple levels of details is an interesting one.

Currently the formatter class is a bit messy and not easy to extend to customize the formatting. I have thought of cleaning it up and decoupling the part about config comments. The cleanup might be convenient to implement something like multiple levels of details in the help. Though, most likely this would be a breaking change in the formatter, so would only happen for jsonargparse v5.

Thank you for your response. I'm very much looking forward to future updates. For now, I've solved this in my own simple way - it's still messy and requires refactoring, but I got it to work in a tricky way.

This is done by overriding the helpformatter class, defining a variable called verbose_level in that class and determining the output based on that. This is how we filter by verbose_level in add_usage and add_argument. (We need to define what we want to filter for, but for now i've run it and defined what command absolutely need so that only that is exposed).

(There's a link to an example below, but note that this is PoC-level code that hasn't been released yet and is subject to change.)
https://github.com/openvinotoolkit/training_extensions/blob/c27d73a57cb2b04b12f61210fe86255a8d0234dd/src/otx/v2/cli/utils/help_formatter.py#L105

I'll be sure to share this here we've adapted and released it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants