Click – Python library for command-line interfaces
click.pocoo.org
Click – Python library for command-line interfaces
1–10 of 105 posts
Re: Click – Python library for command-line interfaces
#2Re: Click – Python library for command-line interfaces
#3Gorgeous. This guy has a full time job, a wife, and wrote Flask and Werkzeug, ItsDangerous, Sphinx, Markupsafe, Jinja2 (and Jinja) and that's just some of the well known stuff. Handsome and young too. Bastard. He probably saves the world in a dinner jacket in his spare time.
Re: Click – Python library for command-line interfaces
#4Does anybody know docopt? I really like it because you simply write the help/usage as text and docopt automatically generates the parser for it.
Take a look at the example in the README: https://github.com/docopt/docopt
Re: Click – Python library for command-line interfaces
#5Kudos again to the pocoo team for creating such a simple and useful library. It sure beats optparse :)
On a side note, however, does anyone know why the team prefers to wrap functions in decorators? Flask also uses them, but what's the design decision behind them?
Re: Click – Python library for command-line interfaces
#6Kudos again to the pocoo team for creating such a simple and useful library. It sure beats optparse :) On a side note, however, does anyone know why the team prefers to wrap functions in decorators? Flask also uses them, but what's the design decision behind them?
Decorators are so simple and minimalistic and elegant and easy to understand. They can surface an arbitrary amount of extra functionality with a single statement. For example, ensure a function is only accessible to authenticated users by simply saying something like @requires_authenticated_user. Another example would be to create a logging decorator to wrap a function or a class to create a log of every time the function is accessed @log_function_access. Or to wrap a function to ensure that every access to the properties of that function are pushed through some sort of validation or transformation @validate_set or @transform_get. Decorators allow encapsulation of functions within other functional concepts with almost no code, that's the design decision for using them.
Re: Click – Python library for command-line interfaces
#7Looks like a nice wrapper around argparse: https://docs.python.org/3/library/argparse.html
Re: Click – Python library for command-line interfaces
#8It looks really well done.
I still prefer docopt (https://github.com/docopt/docopt) . It is so much simpler to use. Click seems to be a bit overengineered.
Re: Click – Python library for command-line interfaces
#9This looks pretty similar to aargvard [1] (which is, as stated in the README, inspired by flask).
Re: Click – Python library for command-line interfaces
#10Time to rewrite some of my dirty command-line programs