Live data from Hacker News

Click – Python library for command-line interfaces

click.pocoo.org

91–100 of 105 posts

Re: Click – Python library for command-line interfaces

#92
I should write up a comparison between:

- Cement (http://builtoncement.com)

- Cliff (http://cliff.readthedocs.org/en/latest/)

- Plumbum (http://plumbum.readthedocs.org)

- Argh (https://pypi.python.org/pypi/argh/0.24.1)

- Aaargh (https://github.com/wbolster/aaargh)

- Baker (https://pypi.python.org/pypi/Baker/)

So many more to choose from. Now we get to evaluate Click. Seems like the reason Armin wrote Click was to load options dynamically, but that's what Cliff does via stevedore (https://github.com/dreamhost/stevedore).

My favorite feature about Cliff though is: http://cliff.readthedocs.org/en/latest/complete.html which comes out of the box, but then again, there's Argcomplete (https://github.com/kislyuk/argcomplete).

EDIT: Updating from previous posters

- Naked (http://naked-py.com)

- Docopt (http://docopt.org)

- Clint (https://github.com/kennethreitz/clint)

- Argvard (https://github.com/DasIch/argvard)

- Commandr (https://github.com/tellapart/commandr)

- Argtools (https://pypi.python.org/pypi/argtools/0.1.2)

- Plac (https://pypi.python.org/pypi/plac)

Re: Click – Python library for command-line interfaces

#93
post #41
post #34

Earlier 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…

> Half of a second is very noticeable (and annoying). I had similar perception in my previous work.

That's because it has to load django and the whole django project. Here's click:

    > time python test.py --help
    Usage: test.py [OPTIONS]

    Options:
      --help  Show this message and exit.
    python test.py --help  0.06s user 0.02s system 95% cpu 0.078 total
and argparse:

    > time python test.py --help
    usage: test.py [-h]

    optional arguments:
      -h, --help  show this help message and exit
    python test.py --help  0.03s user 0.02s system 93% cpu 0.054 total
reference:

    > time python -c 'print "hello"'
     hello
    python -c 'print "hello"'  0.01s user 0.01s system 88% cpu 0.025 total

Re: Click – Python library for command-line interfaces

#94
post #17

The biggest gripe I have with using Python for rich command-line tool is the startup time. One of the first reason I like to write a nice command-line tool when I start a project, say foo, is to be able to do `foo --help` to quickly see and remember what the project can do (I have a very bad memory and doing this makes it possible for me to jump back faster to a project, even well documented. I can forget what I was…

I'm completely clueless about this, but would it be possible to have a persistent python interpreter always running in the background somehow, and submit the commands to it?

I think you want a pool of python interpreters read to go.

Re: Click – Python library for command-line interfaces

#96

I did not expect this to be on hackernews this early. I want to point out that I have not made a release yet and it's not yet feature complete. Mainly I want to ask for feedback on the general design.

Consider adding mechanisms to facilitate bash autocomplete. :-)

Re: Click – Python library for command-line interfaces

#98
post #71

A bit off-topic, but I like how pocoo.org uses different fonts for different projects: Flask: Georgia for text, Garamond for titles Werkzeug: Lucida Grande for text, Ubuntu for titles And now click: Ubuntu Mono for text, Open Sans for titles

I had the same thought, and will almost certainly be cribbing this page's body-text font stack...

font-family: 'Ubuntu Mono','Consolas','Menlo','Deja Vu Sans Mono','Bitstream Vera Sans Mono';

...(fulfilled by Menlo on my Mac) for a future project.

Re: Click – Python library for command-line interfaces

#99

I should write up a comparison between: - Cement ( http://builtoncement.com ) - Cliff ( http://cliff.readthedocs.org/en/latest/ ) - Plumbum ( http://plumbum.readthedocs.org ) - Argh ( https://pypi.python.org/pypi/argh/0.24.1 ) - Aaargh ( https://github.com/wbolster/aaargh ) - Baker ( https://pypi.python.org/pypi/Baker/ ) So many more to choose from. Now we get to evaluate Click. Seems like the reason Armin wrote Clic…

Clime (https://github.com/moskytw/clime)

Re: Click – Python library for command-line interfaces

#100
post #28

On a related note. Which python library would you recommend for text-based interfaces? I have never used ncurses, so I don't know how complex it is. What I would like to achieve is having a user launch my script from the command line, use the text based interface to select a source and destination folder, set a few parameters and show a progress bar.

It's also possible and very easy to do this with python-dialog[0] or with whiptail[1] (no progress bar).

downside: both need external binarys.

[0]: http://pythondialog.sourceforge.net/ [1]: https://github.com/marwano/whiptail

Post reply on HN