Package: argh
The power of Argparse with plain Python functions!Building a command-line interface?  Found yourself uttering “argh!” while
struggling with the API ofargparse?  Don’t like the complexity but need
the power?Arghbuilds on the power ofargparse(which comes with Python) and makes it
really easy to use.  It eliminates the complex API and lets you “dispatch”
ordinary Python functions as CLI commands.Installation$ pip install arghExampleimportarghdefverify_paths(paths:list[str],*,verbose:bool=False):"""
    Verify that all given paths exist.
    """forpathinpaths:ifverbose:print(f"Checking{path}...")assertos.path.exists(path)argh.dispatch_command(verify_paths)Now you can run the script like this:$pythonapp.pyfoo.txtbar/quux.txt$pythonapp.pyfoo.txtbar/quux.txt--verboseCheckingfoo.txt...Checkingbar/quux.txt...$pythonapp.py-husage:app.py[-h][-v][paths...]Verifythatallgivenpathsexist.positionalarguments:paths-options:-h,--helpshowthishelpmessageandexit-v,--verboseFalsePlease check the documentation for examples of multiple commands, modularity,
help generation, advanced type annotations inspection, decorators and more:Quick StartTutorialWhy Argh?Argh-powered applications aresimplebutflexible:Pythonic, KISS:Commands are plain Python functions.  Almost no CLI-specific API to learn.Reusable: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 is driven primarily by type annotations.DRY:Don’t Repeat Yourself.  The amount of boilerplate code is minimal.
Among other things,Arghwill:infer command name from function name;infer arguments from function signature;infer argument types, actions and much more from annotations.Modular:Declaration of commands can be decoupled from assembling and dispatching.Layered:The complexity of code raises with requirements.Transparent:You can directly accessargparse.ArgumentParserif needed.Subcommands:Easily nested commands.  Argh isolates the complexity of subparsers.NIH free:Arghsupportscompletion,progress barsand 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.LinksSee also theproject page on GitHub,documentationandPyPI page.AuthorDeveloped by Andrey Mikhaylenko since 2010.Seecontributorsfor a list of contributors to this library.ContributeThe fastest way to improve this project is to submit tested and documented
patches or detailed bug reports.DonateYou candonate via Liberapay.  This may speed up development or simply
make the original author happy :)LicensingArgh is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.Argh is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU Lesser General Public License for more details.You should have received a copy of the GNU Lesser General Public License
along with Argh.  If not, see <http://gnu.org/licenses/>.