The major benefit is that click helps you describe the parameters you expect and injects them directly as function arguments. And then executes the function.
It takes the burden of explicitly calling a parser and invoking your own function.
This also makes it easy to nest functions without your intervention.
I also find the definition of arguments more intuitive, but that might be a matter of taste (I was never fluent in argparse).
In clicks documentation they have a whole page that compares them to argparse and optparse.
Thanks!
I really like and recommend using click.
It is a package that away some of the burden of defining an argument parser and running it.
Fire, requires even less effort, but it is not as flexible and configurable as click.
Yeah I've been meaning to try it out, just hard to get rid of old habits lol. I know exactly how to use argparse.
At first glance click looks a lot like argparse though, what are some of the benefits as oppose to using argparse?
The major benefit is that click helps you describe the parameters you expect and injects them directly as function arguments. And then executes the function.
It takes the burden of explicitly calling a parser and invoking your own function.
This also makes it easy to nest functions without your intervention.
I also find the definition of arguments more intuitive, but that might be a matter of taste (I was never fluent in argparse).
In
click
s documentation they have a whole page that compares them to argparse and optparse.Thanks for the info! I like the decorators and not having to use the parser explicitly. Will definitely give it a try on my next utility.