4 ms·
tqdm & click make a nice CLI pairing for taking a simple idea and turning into a reusable tool that you can feel good about sharing in minutes.
by dwater 5y ago
tqdm & click make a nice CLI pairing for taking a simple idea and turning into a reusable tool that you can feel good about sharing in minutes.
- geenew 5y agoI wasn't aware of Click, it looks promising. For reference, it's a backronym for 'Command Line Interface Creation Kit': https://click.palletsprojects.com/en/8.0.x/ https://click.palletsprojects.com/en/8.0.x/
- nxpnsv 5y agoClick is really good, typer is great...
- abdusco 5y agoI love Typer, it's my go-to tool for building CLIs, but I'm worried about its future. It's developed by a single developer, there are too many issues left unattended, no development for months, lacking a good API to extend it or to interact with Click.
- deleted 5y ago[deleted]
- Spivak 5y agoI have such mixed feelings about Click; I've reached the point of using it so much that I now hate it. Which I think probably means that it's great but only as as stopgap until you learn how to bend argparse to your will. It's just too magic, too much global state, and too much spooky action at a distance.
- globular-toast 5y agoI went the opposite way. Used to do everything with argparse, then discovered click and never looked back. While argparse lets you do anything, click forces you to build a good CLI.
- formerly_proven 5y agoClick inherits the eternal argparse limitation of "you can't stick --verbose everywhere", doesn't it?
- skrtskrt 5y agoI actually don't think Click is too much global state and spookiness, at least in relation to a lot of popular Python libraries. I do wish I could hook into it to test better, the only thing you can really do right now is to have it print stuff out and assert the output string. It's not really necessary to just build a CLI with click, but I want to build a library that integrates with it and testing the integration is a PITA. I want to write a config-loading library for CLI apps like Golang's Viper lib, but for Python
- gbrindisi 5y agoMaybe Hydra? https://hydra.cc/docs/next/intro/ https://hydra.cc/docs/next/intro/
- pydry 5y agoI had the same feeling. I wish there were an equivalent that tried to minimize the magic and global state a bit while still letting you make decent CLIs with a tiny amount of code.
- rripken 5y agoI use tqdm (with argparse) in a pyinstaller packaged exe. 5-stars - Its great! I call the exe from Java to do some ML and forward the tqdm progress and status messages to a Swing progress bar. It makes the user experience seamless. Depending on the task and the user's settings the tool usually takes about 7-8 seconds(including the PyInstaller extract) but it can also take up to a minute. When its 7-8 seconds the progress messages fly by and the tool feels snappy. When its 50-60 seconds the users are very grateful for the progress bar. Meanwhile I can develop and test the tool from the command-line and see progress info and when I want to run the ML code in Jupyter notebooks the progress bars can still be made to work.
- d4rkp4ttern 5y agoPython Fire is my favorite tool for a dead simple way to create a CLI without using ugly argparse
- zbentley 5y agodoes click.progressbar use tqdm underneath? In Click projects I usually use that rather than tqdm directly.