11# Why ` arguably ` ?
22
3- With plenty of other tools out there, why use ` arguably ` ? Aren't ` click ` and ` typer ` good enough?
3+ With plenty of other tools out there, why use ` arguably ` ? Aren't other ones ( ` click ` , ` typer ` , etc) good enough?
44
5- The short answer is: yeah, probably! They're really great tools. But they still make you write quite a bit of code.
6- That's where ` arguably ` comes in.
5+ The short answer is: yeah, probably! Python already has great tools for building CLIs . But they still make you write
6+ quite a bit of code. That's where ` arguably ` comes in.
77
88## An unobtrusive API
99
10- What ` arguably ` does best is get out of your way. Set up a function signature and docstring, annotate with
11- ` @arguably.command ` , and you've set up a CLI. That's it, that's the API. No need for ` typer.Option() ` or
12- ` click.option() ` . That's because ` arguably ` was built from the ground-up with a focus on providing most of the features
13- of these libraries (and a few extra) with few code changes necessary on your part.
10+ What ` arguably ` does best is get out of your way.
1411
15- Your decorated functions still look and behave like regular functions.
12+ Set up a * function signature* and * docstring* , annotate with ` @arguably.command ` , and you've set up a CLI. That's it,
13+ that's the API.
14+
15+ No need for ` typer.Option() ` or ` click.option() ` . That's because ` arguably ` was built from the ground-up with a focus on
16+ providing most of the features of these libraries (and a few extra) with few code changes necessary on your part.
17+ Because of this, your CLI functions still look and behave like regular functions.
1618
1719<div align =" right " class =" code-source " ><sub >
1820 <a href="https://github.com/treykeown/arguably/blob/main/etc/scripts/intro.py">[source]</a>
@@ -39,12 +41,6 @@ if __name__ == "__main__":
3941 arguably.run()
4042```
4143
42- ``` pycon
43- >>> from intro import some_function
44- >>> some_function(" asdf" , 0 , 7 , 8 , 9 , option = 2.71 )
45- required='asdf', not_required=0, others=(7, 8, 9), option=2.71
46- ```
47-
4844``` console
4945user@machine:~ $ ./intro.py -h
5046usage: intro.py [-h] [-x OPTION] required [not-required] [others ...]
@@ -61,6 +57,17 @@ options:
6157 -x, --option OPTION an option, short name is in brackets (type: float, default: 3.14)
6258```
6359
60+ ``` pycon
61+ >>> from intro import some_function
62+ >>> some_function(" asdf" , 0 , 7 , 8 , 9 , option = 2.71 )
63+ required='asdf', not_required=0, others=(7, 8, 9), option=2.71
64+ ```
65+
66+ ``` console
67+ user@machine:~ $ ./intro.py " asdf" 0 7 8 9 --option 2.71
68+ required='asdf', not_required=0, others=(7, 8, 9), option=2.71
69+ ```
70+
6471## Zero-effort CLI
6572
6673Taking inspiration from [ Python Fire] ( https://google.github.io/python-fire/guide/#version-4-fire-without-code-changes ) ,
0 commit comments