File: PKG-INFO

package info (click to toggle)
python-argh 0.31.3-1
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 352 kB
  • sloc: python: 3,234; makefile: 4
file content (224 lines) | stat: -rw-r--r-- 7,384 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
Metadata-Version: 2.1
Name: argh
Version: 0.31.3
Summary: Plain Python functions as CLI commands without boilerplate
Keywords: cli,command line,argparse,optparse,argument,option
Author-email: Andy Mikhaylenko <neithere@gmail.com>
Maintainer-email: Andy Mikhaylenko <neithere@gmail.com>
Requires-Python: >=3.8
Description-Content-Type: text/x-rst
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Information Technology
Classifier: License :: OSI Approved :: GNU Library or Lesser General Public License (LGPL)
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Programming Language :: Python :: Implementation :: PyPy
Classifier: Topic :: Software Development :: User Interfaces
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Dist: argcomplete >= 2.0 ; extra == "completion"
Requires-Dist: sphinx >= 7.2 ; extra == "docs"
Requires-Dist: sphinx-pyproject == 0.3 ; extra == "docs"
Requires-Dist: sphinx_rtd_theme >= 2.0 ; extra == "docs"
Requires-Dist: readthedocs-sphinx-search == 0.3.2 ; extra == "docs"
Requires-Dist: pre-commit >= 3.4.0 ; extra == "linters"
Requires-Dist: tox >= 4.11.3 ; extra == "test"
Requires-Dist: pytest >= 7.4 ; extra == "test"
Requires-Dist: pytest-cov >= 4.1 ; extra == "test"
Project-URL: Discussions, https://github.com/neithere/argh/discussions
Project-URL: Documentation, https://argh.readthedocs.io/en/latest
Project-URL: Homepage, https://github.com/neithere/argh
Project-URL: Issue Tracker, https://github.com/neithere/argh/issues
Project-URL: Releases, https://github.com/neithere/argh/releases
Provides-Extra: completion
Provides-Extra: docs
Provides-Extra: linters
Provides-Extra: test

Argh: The Effortless CLI
========================

.. image:: https://github.com/neithere/argh/actions/workflows/lint-and-test.yml/badge.svg
    :target: https://github.com/neithere/argh/actions/workflows/lint-and-test.yml

.. image:: https://img.shields.io/pypi/format/argh.svg
    :target: https://pypi.python.org/pypi/argh

.. image:: https://img.shields.io/pypi/status/argh.svg
    :target: https://pypi.python.org/pypi/argh

.. image:: https://img.shields.io/pypi/v/argh.svg
    :target: https://pypi.python.org/pypi/argh

.. image:: https://img.shields.io/pypi/pyversions/argh.svg
    :target: https://pypi.python.org/pypi/argh

.. image:: https://img.shields.io/pypi/dd/argh.svg
    :target: https://pypi.python.org/pypi/argh

.. image:: https://readthedocs.org/projects/argh/badge/?version=stable
    :target: http://argh.readthedocs.org/en/stable/

.. image:: https://readthedocs.org/projects/argh/badge/?version=latest
    :target: http://argh.readthedocs.org/en/latest/

**The power of Argparse with plain Python functions!**

Building a command-line interface?  Found yourself uttering "argh!" while
struggling with the API of `argparse`?  Don't like the complexity but need
the power?

`Argh` builds on the power of `argparse` (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 argh

Example
-------

.. code-block:: python

    import argh

    def verify_paths(paths: list[str], *, verbose: bool = False):
        """
        Verify that all given paths exist.
        """
        for path in paths:
            if verbose:
                print(f"Checking {path}...")
            assert os.path.exists(path)

    argh.dispatch_command(verify_paths)

Now you can run the script like this:

.. code-block:: bash

    $ python app.py foo.txt bar/quux.txt

    $ python app.py foo.txt bar/quux.txt --verbose
    Checking foo.txt...
    Checking bar/quux.txt...

    $ python app.py -h
    usage: app.py [-h] [-v] [paths ...]

    Verify that all given paths exist.

    positional arguments:
      paths          -

    options:
      -h, --help     show this help message and exit
      -v, --verbose  False

Please check the documentation for examples of multiple commands, modularity,
help generation, advanced type annotations inspection, decorators and more:

* `Quick Start <https://argh.readthedocs.io/en/latest/quickstart.html>`_
* `Tutorial <https://argh.readthedocs.io/en/latest/tutorial.html>`_

Why Argh?
---------

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

: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, `Argh` will:

    * 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 access `argparse.ArgumentParser` if needed.

:Subcommands:
    Easily nested commands.  Argh isolates the complexity of subparsers.

: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.

Links
-----

See also the `project page on GitHub`_, `documentation`_ and `PyPI page`_.

.. _project page on GitHub: http://github.com/neithere/argh/
.. _documentation: http://argh.readthedocs.org
.. _PyPI page: http://pypi.python.org/pypi/argh

Author
------

Developed by Andrey Mikhaylenko since 2010.

See `contributors <https://argh.readthedocs.io/en/latest/contributors.html>`_
for a list of contributors to this library.

Contribute
----------

The fastest way to improve this project is to submit tested and documented
patches or detailed bug reports.

Donate
------

You can `donate via Liberapay`_.  This may speed up development or simply
make the original author happy :)

.. _donate via Liberapay: https://liberapay.com/neithere/donate

Licensing
---------

Argh 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/>.