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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

reduce message width #9

Merged
merged 10 commits into from
Jun 4, 2019
Merged

reduce message width #9

merged 10 commits into from
Jun 4, 2019

Conversation

nsheff
Copy link
Member

@nsheff nsheff commented Jun 4, 2019

It would be nice if the logmuse options were very compact so they didn't clutter the help CLI output of a tool that uses logmuse. look at this:

version: 0.4.0-dev
usage: refgenie [-h] [-V] [-c GENOME_CONFIG] [--logdev]
                [--verbosity VERBOSITY] [--silent]
                {pull,build,list,init,listr} ...

refgenie - builds and manages reference genome assemblies

positional arguments:
  {pull,build,list,init,listr}
    pull                Download assets.
    build               Build genome assets
    list                List available local genomes.
    init                Initialize a genome configuration.
    listr               List available genomes and assets on server.

optional arguments:
  -h, --help            show this help message and exit
  -V, --version         show program's version number and exit
  -c GENOME_CONFIG, --genome-config GENOME_CONFIG
  --logdev              Expand content of logging message format.
  --verbosity VERBOSITY
                        Set logging level (integer from 0-5 or Python builtin)
  --silent              Silence logging. Overrides --verbosity.

In this PR I chagned the logdev and verbosity help messages to fit on one line, which is nice. However, because "VERBOSITY" is so long, it still takes up 2 lines regardless of size of the help message. See this question for a complete description of what I mean.

I propose: we change the dest for verbosity to be shorter... just V perhaps? that will solve this problem without requiring every tool that uses logmuse to have a custom help formatter.

@nsheff nsheff requested a review from vreuter June 4, 2019 14:39
@vreuter
Copy link
Member

vreuter commented Jun 4, 2019

It would be nice if the logmuse options were very compact so they didn't clutter the help CLI output of a tool that uses logmuse.
...
I propose: we change the dest for verbosity to be shorter... just V perhaps? that will solve this problem without requiring every tool that uses logmuse to have a custom help formatter.

Yep, sounds good to me. Here are the places I see locally that we're using logmuse and that may need to change, if the CLI namespace is accessing a verbosity attribute:

~/code/geofetch/requirements/requirements-all.txt:4:logmuse>=0.0.2
~/code/refgenie/requirements/requirements-all.txt:2:logmuse>=0.1
~/code/looper/requirements/requirements-all.txt:3:logmuse>=0.0.2
~/code/caravel/caravel/requirements/requirements-all.txt:6:logmuse
~/code/peppy/requirements/requirements-all.txt:5:logmuse>=0.0.2
~/code/lucidoc/requirements/requirements-all.txt:1:logmuse>=0.0.2
~/code/refgenieserver/requirements/requirements-all.txt:4:logmuse

Do you know any others?

return init_logger(name, level, stream, logfile,
make_root, propagate, silent, devmode,
verbosity, fmt, datefmt, plain_format, style)
return init_logger(**logs_cli_args)
Copy link
Member Author

Choose a reason for hiding this comment

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

much better, thanks.

@nsheff
Copy link
Member Author

nsheff commented Jun 4, 2019

just crossed my mind -- would it be possible to just name it "V" in the help, but then duplicate that over to verbosity after the fact? not sure if that's better than changing everything depending on this...

@vreuter
Copy link
Member

vreuter commented Jun 4, 2019

@nsheff tail of refgenie --help now looks like this for me:

optional arguments:
  -h, --help            show this help message and exit
  -V, --version         show program's version number and exit
  -c GENOME_CONFIG, --genome-config GENOME_CONFIG
  --logdev              Expand content of logging message format.
  --silent              Silence logging. Overrides --verbosity.
  --verbosity V         Set logging level (integer from 0-5 or Python builtin)

https://refgenie.databio.org

I think this will spare us needing to change all the dependents.

@nsheff
Copy link
Member Author

nsheff commented Jun 4, 2019

awesome, I forgot about metavar and its difference with dest... this is exactly what we want! sweet.

logmuse/est.py Outdated
"metavar": "V",
"help": "Set logging level (integer from 0-5 or Python builtin)"},
"metavar": "V", "choices": [str(x) for x in range(0, 6)] + LEVEL_BY_VERBOSITY + ["WARNING"],
"help": "Set logging level (0-5 or logging module level name)"},
Copy link
Member Author

Choose a reason for hiding this comment

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

🏆 !

@nsheff nsheff merged commit 951a07c into master Jun 4, 2019
@vreuter vreuter deleted the dev branch July 2, 2019 19:45
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.

2 participants