Skip to content

Commit

Permalink
Update why.md, bump version number
Browse files Browse the repository at this point in the history
  • Loading branch information
treykeown committed Jun 20, 2023
1 parent 8e0544e commit 036d29f
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 15 deletions.
35 changes: 21 additions & 14 deletions docs/why.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
# Why `arguably`?

With plenty of other tools out there, why use `arguably`? Aren't `click` and `typer` good enough?
With plenty of other tools out there, why use `arguably`? Aren't other ones (`click`, `typer`, etc) good enough?

The short answer is: yeah, probably! They're really great tools. But they still make you write quite a bit of code.
That's where `arguably` comes in.
The short answer is: yeah, probably! Python already has great tools for building CLIs. But they still make you write
quite a bit of code. That's where `arguably` comes in.

## An unobtrusive API

What `arguably` does best is get out of your way. Set up a function signature and docstring, annotate with
`@arguably.command`, and you've set up a CLI. That's it, that's the API. No need for `typer.Option()` or
`click.option()`. That's because `arguably` was built from the ground-up with a focus on providing most of the features
of these libraries (and a few extra) with few code changes necessary on your part.
What `arguably` does best is get out of your way.

Your decorated functions still look and behave like regular functions.
Set up a *function signature* and *docstring*, annotate with `@arguably.command`, and you've set up a CLI. That's it,
that's the API.

No need for `typer.Option()` or `click.option()`. That's because `arguably` was built from the ground-up with a focus on
providing most of the features of these libraries (and a few extra) with few code changes necessary on your part.
Because of this, your CLI functions still look and behave like regular functions.

<div align="right" class="code-source"><sub>
<a href="https://github.com/treykeown/arguably/blob/main/etc/scripts/intro.py">[source]</a>
Expand All @@ -39,12 +41,6 @@ if __name__ == "__main__":
arguably.run()
```

```pycon
>>> from intro import some_function
>>> some_function("asdf", 0, 7, 8, 9, option=2.71)
required='asdf', not_required=0, others=(7, 8, 9), option=2.71
```

```console
user@machine:~$ ./intro.py -h
usage: intro.py [-h] [-x OPTION] required [not-required] [others ...]
Expand All @@ -61,6 +57,17 @@ options:
-x, --option OPTION an option, short name is in brackets (type: float, default: 3.14)
```

```pycon
>>> from intro import some_function
>>> some_function("asdf", 0, 7, 8, 9, option=2.71)
required='asdf', not_required=0, others=(7, 8, 9), option=2.71
```

```console
user@machine:~$ ./intro.py "asdf" 0 7 8 9 --option 2.71
required='asdf', not_required=0, others=(7, 8, 9), option=2.71
```

## Zero-effort CLI

Taking inspiration from [Python Fire](https://google.github.io/python-fire/guide/#version-4-fire-without-code-changes),
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "arguably"
version = "1.2.2"
version = "1.2.3"
description = "The best Python CLI library, arguably."
authors = ["treykeown <[email protected]>"]
readme = "etc/pypi/PYPI_README.md"
Expand Down

0 comments on commit 036d29f

Please sign in to comment.