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.
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.
It looks really well done.<p>I still prefer docopt (<a href="https://github.com/docopt/docopt" rel="nofollow">https://github.com/docopt/docopt</a>) . It is so much simpler to use.
Click seems to be a bit overengineered.
Does anybody know docopt? I really like it because you simply write the help/usage as text and docopt automatically generates the parser for it.<p>Take a look at the example in the README: <a href="https://github.com/docopt/docopt" rel="nofollow">https://github.com/docopt/docopt</a>
It seems to me that there are a few projects similar this. Here is another, <a href="https://pypi.python.org/pypi/Cogs/" rel="nofollow">https://pypi.python.org/pypi/Cogs/</a> (conceptualized as a "Makefile" replacement).<p>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?
Kudos again to the pocoo team for creating such a simple and useful library. It sure beats optparse :)<p>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?
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.
>You can get the library directly from PyPI:<p>>pip install click<p>Well... no you cannot. See the page: <a href="https://pypi.python.org/pypi/click" rel="nofollow">https://pypi.python.org/pypi/click</a><p>The package hasn't been uploaded yet. However one can install it straight from the git repo:<p>> pip install git+ssh://git@github.com:mitsuhiko/click.git
A bit off-topic, but I like how pocoo.org uses different fonts for different projects:<p>Flask: Georgia for text, Garamond for titles<p>Werkzeug: Lucida Grande for text, Ubuntu for titles<p>And now click: Ubuntu Mono for text, Open Sans for titles
Why is it that (nearly) every description I read about some random new Python command wrapper fails to get the "python" and ".py" out of the command examples, even in Linux?<p>I don't blame this particular offering, since I don't think release was actually planned just yet and any number of other projects have made the same subtle mistake.<p>Command Name Extensions are Harmful. Don't expose such an implementation detail in every example, lest everyone actually follow them. Use the "#!/usr/bin/env python" or whatever at the top of your scripts. And yes, you can keep the .py if what you have is a library, not just a command (but it's nice to then make a wrapper the doesn't expose the implementation language). And obviously in other OSes where the command extension can be omitted and still work this isn't such a big deal.<p>But in Unix/Linux, commands should be reimplementable in a different language without making some .(extension) a like, retained to keep from breaking other things that depend on it. Just say no :-)
I should write up a comparison between:<p>- Cement (<a href="http://builtoncement.com" rel="nofollow">http://builtoncement.com</a>)<p>- Cliff (<a href="http://cliff.readthedocs.org/en/latest/" rel="nofollow">http://cliff.readthedocs.org/en/latest/</a>)<p>- Plumbum (<a href="http://plumbum.readthedocs.org" rel="nofollow">http://plumbum.readthedocs.org</a>)<p>- Argh (<a href="https://pypi.python.org/pypi/argh/0.24.1" rel="nofollow">https://pypi.python.org/pypi/argh/0.24.1</a>)<p>- Aaargh (<a href="https://github.com/wbolster/aaargh" rel="nofollow">https://github.com/wbolster/aaargh</a>)<p>- Baker (<a href="https://pypi.python.org/pypi/Baker/" rel="nofollow">https://pypi.python.org/pypi/Baker/</a>)<p>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 (<a href="https://github.com/dreamhost/stevedore" rel="nofollow">https://github.com/dreamhost/stevedore</a>).<p>My favorite feature about Cliff though is: <a href="http://cliff.readthedocs.org/en/latest/complete.html" rel="nofollow">http://cliff.readthedocs.org/en/latest/complete.html</a> which comes out of the box, but then again, there's Argcomplete (<a href="https://github.com/kislyuk/argcomplete" rel="nofollow">https://github.com/kislyuk/argcomplete</a>).<p>EDIT: Updating from previous posters<p>- Naked (<a href="http://naked-py.com" rel="nofollow">http://naked-py.com</a>)<p>- Docopt (<a href="http://docopt.org" rel="nofollow">http://docopt.org</a>)<p>- Clint (<a href="https://github.com/kennethreitz/clint" rel="nofollow">https://github.com/kennethreitz/clint</a>)<p>- Argvard (<a href="https://github.com/DasIch/argvard" rel="nofollow">https://github.com/DasIch/argvard</a>)<p>- Commandr (<a href="https://github.com/tellapart/commandr" rel="nofollow">https://github.com/tellapart/commandr</a>)<p>- Argtools (<a href="https://pypi.python.org/pypi/argtools/0.1.2" rel="nofollow">https://pypi.python.org/pypi/argtools/0.1.2</a>)<p>- Plac (<a href="https://pypi.python.org/pypi/plac" rel="nofollow">https://pypi.python.org/pypi/plac</a>)
This looks pretty similar to aargvard [1] (which is, as stated in the README, inspired by flask).<p>[1] <a href="https://github.com/DasIch/argvard" rel="nofollow">https://github.com/DasIch/argvard</a>
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 doing in just a few days and so I add a lot of small commands).<p>In short running `foo --help` should be instant and if it loads all its modules to list the different sub-commands and their respective description it is really too slow.<p>A possibility is to cache some information (e.g. generate a text file or a small Python script).
Ahh.. I really like pocoo's products. But I've found manage.py (<a href="https://github.com/Birdback/manage.py" rel="nofollow">https://github.com/Birdback/manage.py</a>) to be far leaner and simple. What do you guys think?
This doesn't look much different than argh, which has been around for ages: <a href="http://argh.readthedocs.org/en/latest/tutorial.html" rel="nofollow">http://argh.readthedocs.org/en/latest/tutorial.html</a>
Looks nice but the example looks almost exactly like <a href="https://pypi.python.org/pypi/argtools/0.1.2" rel="nofollow">https://pypi.python.org/pypi/argtools/0.1.2</a>
Reminds me of Commandr. Both use decorators. <a href="https://github.com/tellapart/commandr" rel="nofollow">https://github.com/tellapart/commandr</a>
Little unfortunate naming. Isn't Click a trademark of ASF? <a href="http://click.apache.org/" rel="nofollow">http://click.apache.org/</a>
Looks like a nice wrapper around argparse: <a href="https://docs.python.org/3/library/argparse.html" rel="nofollow">https://docs.python.org/3/library/argparse.html</a>
user@uweb1:/$ pip install click
Downloading/unpacking click
Could not find any downloads that satisfy the requirement click
No distributions at all found for click