Earlier quoted context omitted.
Do you work with others? Do you code professionally?
Sure.
Easy Python CLI with Click
51–60 of 64 posts
Re: Easy Python CLI with Click
#52Earlier quoted context omitted.
Perhaps a non-starter for you if you don't want to involve Docker but I have had good experiences wrapping a docker invocation in a shell script shim with the same name as the program and forwarding everything I need into the container. Then folks just grab the shell script and they're off... added bonus it's really easy to add update functionality to your tools.
So you're replacing a single executable Python script with a dependency that requires four additional separate artefacts (Dockerfile, image, container and the shell script) to be executed...
1. Nothing stays a simple as time happens. New shit gets added.
2. Eventually people do want to use libraries so you're back to square 1.
3. It's "cross-platform" runnable now so those annoying macOS and Windows users can suddenly use it. Though depending on how you do the shim it might be tricky. I've taken to writing the shim in Go lately so I can poop out a static binary that does the rest of the work.
4. It's really easy to keep stuff up to date if your users are non-technical... simply have the shim docker pull a new version on startup.
To the end user it requires just a single artifact. For the developer there's a bit more stuff to manage but it's not exactly like any of this is hard stuff to figure out.
Re: Easy Python CLI with Click
#53Re: Easy Python CLI with Click
#54Earlier quoted context omitted.
> Most people first decide whether or not they want to use pypi packages, and then start evaluating which ones are appropriate. I don't think it's as binary as this. There should be, at least intuitively, a mild negative bias to adding a marginal dependency, even once you're dependent on pypi. We're lucky enough to not be dealing with a dumpster fire ecosystem like nodejs, but it's still a good habit. For me, writing…
Click is multiple order of magnitude better than argparse. I don't even start a CLI app with argparse anymore, because even with very simple interfaces you will hit it's limitations. You should try click.
Re: Easy Python CLI with Click
#55Earlier quoted context omitted.
When you do things you like, how does it impact others?
You mean things as trivial as string format methods ? No impact. This is not subject to discussion either, we avoid bikeshedding.
Sounds fun, great coworking environment.
Re: Easy Python CLI with Click
#56Earlier quoted context omitted.
You mean things as trivial as string format methods ? No impact. This is not subject to discussion either, we avoid bikeshedding.
So there are topics that are "not subject to discussion" and they're also the decisions you get to unilaterally make based on your preference, with no explanation needed. Sounds fun, great coworking environment.
Re: Easy Python CLI with Click
#57Earlier quoted context omitted.
So there are topics that are "not subject to discussion" and they're also the decisions you get to unilaterally make based on your preference, with no explanation needed. Sounds fun, great coworking environment.
Not sure what's going on, but you've posted so many low-quality comments and broken the site guidelines so many times in the last several hours that I'm rate-limiting your account again, until we get a commitment that this will stop and not recur.
Re: Easy Python CLI with Click
#58So many of these parsing libraries seem to forget that any positional parameter can stop options parsing not just '--' and that that parameter might appear arbitrarily deep in subcommands.
This is not only needed for commands like sudo and ssh but BSD style CLIs as well which all OSX users are probably intimately familiar and annoyed with.
Re: Easy Python CLI with Click
#59With every other tool I’ve tried, I end up writing a python API and a CLI and documenting it twice.
Defopt eliminates that almost completely (but with *args still allows for elegant interfaces)
Re: Easy Python CLI with Click
#60I've used Fire[0] for a few projects and have been meaning to give Click a try, but I'm not sure I like the syntax after reading through the article (holy moly decorators). Seems unwieldy to me, but does anyone have experience with both? [0] https://github.com/google/python-fire