Closed thebigmunch closed 4 years ago
Thanks for this. I have been having some issues with Click recently that have made me question how much I'm gaining from using it. I'm repeatedly asking myself the question "how do I make this work the Click way?"
I'm using argparse in another project and finding it a little easier to work with so far. As I continue to use the two I may hit a point where I consider migrating 😄
I've been programming in Python for nearly 2 decades. For almost as long as that, I've been searching for something better than what the stdlib provided. In that search, I've tried out most Python CLI packages large and small. Yet I always ended up back at optparse and now argparse.
That not to say I'm evangelical one way or another; I always end up using what works best for me. Take two of my projects as examples: google-music-scripts and thorod. Both of them started out using docopt. When that became hard to maintain/didn't support something I needed, I siwtched them to click. Eventually that became hard to maintain/didn't support something I needed. So back to argparse. In fact, I was able to split out a good portion of the CLI stuff into my utility package for reusability. Now I don't have to copy/paste and test the code in every CLI app I make.
The warts of click start showing even with relatively small, simple scripts. And they come to a head once you reach a CLI of moderate size/complexity. Some of the issues I've run into:
There are more that I've run into involving subcommands that may not be applicable to ward. And I'm sure there's plenty I've forgotten. There are definitely some articles out there expressing these and more.
Just wanted to share my experiences from similar situations in case it strikes a chord.
** Example output of one of google-music-script's commands: