3 ms·
The Python module I learned to love this year is Click. Gets me better command line interfaces fast. URL is http://click.pocoo.org http://click.pocoo.org. It d
by rffn 11y ago
The Python module I learned to love this year is Click. Gets me better command line interfaces fast. URL is http://click.pocoo.org http://click.pocoo.org.
It does progress bars too...
- danso 11y agoWow, thanks for this...I was literally in the middle of writing a CLI tool to fetch a URL and parse out metadata and was getting a little tired of the argparse route. I browsed the documentation and honestly can't say that I immediately grok the advantages but given who its author is, I'm more than happy to switch libraries in mid-coding :)
- w_t_payne 11y agoI'm loving Click too.
- agumonkey 11y agodocopt was inspiring in its own way, but click was 'simpler' do toy with.
- gh02t 11y agoI find click to be much more natural too. Docopt was always touchy about more complicated CLIs when I used it (probably because a lot of "magic" happens behind the scenes), whereas click lets you drill down and arrange things just so. It also feels very well designed, hats of to Ronacher as usual for being good at designing Python libraries. I also find myself using click even when I don't want a CLI. The pretty-printer (`secho`) and progress bars are extremely handy, plus some of the other stuff in utilities. It's quite nice that they handle detecting when output is an interactive terminal versus piping to a file.
- ibejoeb 11y agoI'm looking for a new CLI library. I like Click because it does very simple things very well. It gets hairy when you want to build more complex CLIs. For example, value options and validators don't play nicely because Click doesn't distinguish between the absence of a value and an invalid value, so you wind up dropping Click features and rewriting your own plumbing for that kind of stuff. The alternative is writing a more verbose CLI grammar, which leads to a really clunky UI.
- deleted 11y ago[deleted]