Hacker News new | ask | show | jobs
by bradwood 1254 days ago
The `click` library would be a nice replacement to `argparse`
2 comments

"Click" and "DocOpt" are the 'argparse' replacements. They're the most semantic and intuitive way of developing command-line apps.
I've found Typer [1] pretty intuitive to integrate with existing code, it uses type hints to generate the CLI arguments.

[1] https://typer.tiangolo.com/

I find `typer` way more ergonomic than either argparse or click (which it uses under the hood).

If you're developing something more complex, you might find the feature set too small, but you can get surprisingly far with what's there.

The benefits from its type safety and lack of boilerplate alone are enough to keep me using it in favour of anything else.

Thanks for sharing Typer, I was completely oblivious!

> Typer uses Click internally. That's the only dependency.

Pretty clever way to walk on giants shoulders!

Which is fine when building a complex CLI tool which requires other external libraries; but otherwise the compexity of argparse is simply not significant enough to justify the cost of adding external dependencies.