Hacker News new | ask | show | jobs
by iloveyoudearly 360 days ago
Not sure if it's on par with Clap, but for Python I don't see enough people talk about SimpleParsing: https://github.com/lebrice/SimpleParsing

It has quirks once you try to do something more complex/advanced, but for most of the simple stuff it's very nice to use.

3 comments

People are used to the `click` way, where you can define args as function parameters. It's little more verbose but it helps click is a very established library which also provides many other things needed by CLI tools.

There's also `typer` from the creator of `fastapi` which relies on type annotations. I have not had the opportunity to use it.

In Python you can use pydantic to create a cli:

https://docs.pydantic.dev/latest/concepts/pydantic_settings/...

Nice. I had made something similar (but less featureful), funnily enough also for an ML training script usecase. Here it is in a gist:

https://gist.github.com/porridgewithraisins/313a26ee3b827f73...

I love the ergonomics of this method, and I was going to improve it to support subcommands, etc, but now I think I will use the library you posted.