DEV Community

Discussion on: Part 4 Argparse and Script Entry Points

Collapse
orenovadia profile image
orenovadia

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.

Thread Thread
thefern profile image
Fernando B 🚀 Author

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.