Skip to content

Commit

Permalink
docs: update feature emphasis in README
Browse files Browse the repository at this point in the history
  • Loading branch information
neithere committed Dec 30, 2023
1 parent 6180ca9 commit b53b34e
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 32 deletions.
7 changes: 3 additions & 4 deletions CHANGES.rst
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
~~~~~~~~~
Changelog
~~~~~~~~~
=========

Version 0.31.0
--------------
Version 0.31.0 (2023-12-30)
---------------------------

Breaking changes:

Expand Down
45 changes: 17 additions & 28 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,20 @@ In a nutshell

`Argh`-powered applications are *simple* but *flexible*:

:Pythonic:
Commands are plain Python functions. No CLI-specific API to learn.

:Modular:
Declaration of commands can be decoupled from assembling and dispatching;

:Pythonic:
Commands are declared naturally, no complex API calls in most cases;

:Reusable:
Commands are plain functions, can be used directly outside of CLI context;
Endpoint functions can be used directly outside of CLI context;

:Static typing friendly:
100% of the code including endpoint functions can be type-checked.
Argh relies on type annotations while other libraries tend to rely on
decorators and namespace objects, sometimes even mangling function
signatures;

:Layered:
The complexity of code raises with requirements;
Expand All @@ -59,26 +65,24 @@ In a nutshell
The full power of argparse is available whenever needed;

:Namespaced:
Nested commands are a piece of cake, no messing with subparsers (though
they are of course used under the hood);

:Unobtrusive:
`Argh` can dispatch a subset of pure-`argparse` code, and pure-`argparse`
code can update and dispatch a parser assembled with `Argh`;
Nested commands are a piece of cake, Argh isolates the complexity of
subparsers;

:DRY:
Don't Repeat Yourself. The amount of boilerplate code is minimal.
Among other things, `Argh` will:

* infer command name from function name;
* infer arguments from function signature;
* infer argument type from the default value;
* infer argument action from the default value (for booleans);
* infer argument types, actions and much more from annotations.

:NIH free:
`Argh` supports *completion*, *progress bars* and everything else by being
friendly to excellent 3rd-party libraries. No need to reinvent the wheel.

:Compact:
No dependencies apart from Python's standard library.

Sounds good? Check the :doc:`quickstart` and the :doc:`tutorial`!

Relation to argparse
Expand Down Expand Up @@ -236,22 +240,7 @@ enough; in these cases the powerful API of `argparse` is also available:
def echo(text: str) -> None:
print text
The approaches can be safely combined even up to this level:

.. code-block:: python
# adding help to `foo` which is in the function signature:
@arg("foo", help="blah")
# these are not in the signature so they go to **kwargs:
@arg("baz")
@arg("-q", "--quux")
# the function itself:
def cmd(foo: str, bar: int = 1, *args, **kwargs) -> Iterator[str]:
yield foo
yield bar
yield ", ".join(args)
yield kwargs["baz"]
yield kwargs["quux"]
Please note that decorators will soon be fully replaced with annotations.

Links
-----
Expand Down

0 comments on commit b53b34e

Please sign in to comment.