Gorgeous. 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.
To be fair he only got married this month, so the jury is still out on where his productivity goes from here ;)
Click – Python library for command-line interfaces
61–70 of 105 posts
Re: Click – Python library for command-line interfaces
#62Gorgeous. 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
#63Earlier quoted context omitted.
> The biggest gripe I have with using Python for rich command-line tool is the startup time. What startup time? I even have a python script running on every shell prompt drawing (that checks mercurial on top of starting the python interpreter), and the latency is negligible.
I just tried on an app at work (Django app): > time python manage.py --help real 0m0.473s user 0m0.240s sys 0m0.148s Half of a second is very noticeable (and annoying). I had similar perception in my previous work. You can try to only load enough to display the help text without really loading everything, but that doesn't work that well (you have to organize things differently, and `--help` requires to load a lot of…
$ time python -S -c 'print "Hello World!"'
...
real 0m0.007s
user 0m0.004s
sys 0m0.003s
That's about the same speed it takes my system's cp command to show me an error page: $ time cp -fail
...
real 0m0.005s
user 0m0.003s
sys 0m0.002sRe: Click – Python library for command-line interfaces
#64https://readthedocs.org/projects/argh/
I also really like argh, though it seems the provided link documents an api the mandates decorators and in fact what I like about argh is that functions can remain clean. http://argh.readthedocs.org/en/latest/
Their example:
@click.command()
@click.option('--count', default=1, help='number of greetings')
@click.option('--name', prompt='Your name',
help='the person to greet', required=True)
def hello(count, name):
for x in range(count):
print('Hello %s!' % name)
Could be written as: def hello(count, name):
for x in range(count):
print('Hello %s!' % name
hello = click.option('--name', prompt='Your name',
help='the person to greet', required=True)(hello)
hello = click.option('--count', default=1, help='number of greetings')(hello)
hello = click.command(hello)Re: Click – Python library for command-line interfaces
#65Re: Click – Python library for command-line interfaces
#66Earlier quoted context omitted.
I also really like argh, though it seems the provided link documents an api the mandates decorators and in fact what I like about argh is that functions can remain clean. http://argh.readthedocs.org/en/latest/
You're never forced to use decorators, they're just syntactic sugar. Their example: @click.command() @click.option('--count', default=1, help='number of greetings') @click.option('--name', prompt='Your name', help='the person to greet', required=True) def hello(count, name): for x in range(count): print('Hello %s!' % name) Could be written as: def hello(count, name): for x in range(count): print('Hello %s!' % name he…
Re: Click – Python library for command-line interfaces
#67It seems to me that there are a few projects similar this. Here is another, https://pypi.python.org/pypi/Cogs/ (conceptualized as a "Makefile" replacement). I'm wondering if there could be a breakout at the next PyCon to see if we could discuss approaches and come up with a unified way to do convert Python libraries into command line scripts?
Yeah, plenty: - Cliff http://cliff.readthedocs.org/en/latest/ - docopt http://docopt.org - argparse - optparse etc etc etc...
Re: Click – Python library for command-line interfaces
#68It seems to me that there are a few projects similar this. Here is another, https://pypi.python.org/pypi/Cogs/ (conceptualized as a "Makefile" replacement). I'm wondering if there could be a breakout at the next PyCon to see if we could discuss approaches and come up with a unified way to do convert Python libraries into command line scripts?
Yeah, plenty: - Cliff http://cliff.readthedocs.org/en/latest/ - docopt http://docopt.org - argparse - optparse etc etc etc...
"There are many alternatives to click and you can have a look at them if you enjoy them better. The obvious ones are optparse and argparse from the standard library.
click is actually implemented as a wrapper around optparse and does not implement any parsing itself. The reason it’s not based on argparse is that argparse‘s design does not allow proper nesting of commands by design and has some deficiencies when it comes to POSIX compliant argument handling."
What I love about Pocoo is they always have stellar documentation and give clear rationale - from the beginning.
Re: Click – Python library for command-line interfaces
#69It seems to me that there are a few projects similar this. Here is another, https://pypi.python.org/pypi/Cogs/ (conceptualized as a "Makefile" replacement). I'm wondering if there could be a breakout at the next PyCon to see if we could discuss approaches and come up with a unified way to do convert Python libraries into command line scripts?
Yeah, plenty: - Cliff http://cliff.readthedocs.org/en/latest/ - docopt http://docopt.org - argparse - optparse etc etc etc...