from Hacker News

Show HN: Arguably – The best Python CLI library, arguably

by jfktrey on 6/20/23, 1:31 PM with 1 comments

I spent the past few weeks working on arguably. It uses your function signatures and docstrings to create a CLI.

I built it to have the most common features of other libraries (and a few extra) in a much more concise syntax - no need for @click.option or typer.Option.

It succeeds when you barely notice it's there.

For most cases, you decorate a function with @arguably.command, and it just does what you'd expect:

  * Positional args for the function become positional CLI args
  * Keyword-only args become --options
  * Type hints set up parsing
  * Docstrings provide help messages for each command and argument
This also means it's good at making a script into a CLI without any integration at all, like Python Fire does. Just run `python3 -m arguably your_script.py` to give your script a CLI.

This is my first time making an open-source project with real testing and documentation, definitely a learning experience. mkdocs didn't work for me at first, so I wrote some wild workarounds: https://treykeown.github.io/arguably/contributing/#building-...

  • by lourot on 6/20/23, 9:00 PM

    So nice!