@formaggio-software/rhtop-linux-amd64 0.0.0-stage → 0.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +16 -4
- package/payload/LICENSE.txt +95 -0
- package/payload/NOTICE +16 -0
- package/payload/THIRD_PARTY_NOTICES/altgraph-0.17.5.dist-info/LICENSE +18 -0
- package/payload/THIRD_PARTY_NOTICES/altgraph-0.17.5.dist-info/METADATA +307 -0
- package/payload/THIRD_PARTY_NOTICES/annotated_types-0.8.0.dist-info/METADATA +295 -0
- package/payload/THIRD_PARTY_NOTICES/annotated_types-0.8.0.dist-info/licenses/LICENSE +21 -0
- package/payload/THIRD_PARTY_NOTICES/anyio-4.16.0.dist-info/METADATA +108 -0
- package/payload/THIRD_PARTY_NOTICES/anyio-4.16.0.dist-info/licenses/LICENSE +20 -0
- package/payload/THIRD_PARTY_NOTICES/attrs-26.1.0.dist-info/METADATA +199 -0
- package/payload/THIRD_PARTY_NOTICES/attrs-26.1.0.dist-info/licenses/LICENSE +21 -0
- package/payload/THIRD_PARTY_NOTICES/build-1.6.1.dist-info/METADATA +142 -0
- package/payload/THIRD_PARTY_NOTICES/build-1.6.1.dist-info/licenses/LICENSE +20 -0
- package/payload/THIRD_PARTY_NOTICES/cffi-2.1.1.dist-info/METADATA +67 -0
- package/payload/THIRD_PARTY_NOTICES/cffi-2.1.1.dist-info/licenses/LICENSE +23 -0
- package/payload/THIRD_PARTY_NOTICES/click-8.5.1.dist-info/METADATA +83 -0
- package/payload/THIRD_PARTY_NOTICES/click-8.5.1.dist-info/licenses/LICENSE.txt +28 -0
- package/payload/THIRD_PARTY_NOTICES/cryptography-50.0.2.dist-info/METADATA +111 -0
- package/payload/THIRD_PARTY_NOTICES/cryptography-50.0.2.dist-info/licenses/LICENSE +3 -0
- package/payload/THIRD_PARTY_NOTICES/cryptography-50.0.2.dist-info/licenses/LICENSE.APACHE +202 -0
- package/payload/THIRD_PARTY_NOTICES/cryptography-50.0.2.dist-info/licenses/LICENSE.BSD +27 -0
- package/payload/THIRD_PARTY_NOTICES/h11-0.16.0.dist-info/METADATA +202 -0
- package/payload/THIRD_PARTY_NOTICES/h11-0.16.0.dist-info/licenses/LICENSE.txt +22 -0
- package/payload/THIRD_PARTY_NOTICES/hatchling-1.33.0.dist-info/METADATA +81 -0
- package/payload/THIRD_PARTY_NOTICES/hatchling-1.33.0.dist-info/licenses/LICENSE.txt +9 -0
- package/payload/THIRD_PARTY_NOTICES/httpcore2-2.16.2.dist-info/METADATA +798 -0
- package/payload/THIRD_PARTY_NOTICES/httpcore2-2.16.2.dist-info/licenses/LICENSE.md +28 -0
- package/payload/THIRD_PARTY_NOTICES/httpx2-2.16.2.dist-info/METADATA +227 -0
- package/payload/THIRD_PARTY_NOTICES/httpx2-2.16.2.dist-info/licenses/LICENSE.md +13 -0
- package/payload/THIRD_PARTY_NOTICES/idna-3.20.dist-info/METADATA +176 -0
- package/payload/THIRD_PARTY_NOTICES/idna-3.20.dist-info/licenses/LICENSE.md +31 -0
- package/payload/THIRD_PARTY_NOTICES/iniconfig-2.3.1.dist-info/METADATA +84 -0
- package/payload/THIRD_PARTY_NOTICES/iniconfig-2.3.1.dist-info/licenses/LICENSE +21 -0
- package/payload/THIRD_PARTY_NOTICES/jaraco.classes-3.4.0.dist-info/LICENSE +17 -0
- package/payload/THIRD_PARTY_NOTICES/jaraco.classes-3.4.0.dist-info/METADATA +60 -0
- package/payload/THIRD_PARTY_NOTICES/jaraco_context-6.1.2.dist-info/METADATA +81 -0
- package/payload/THIRD_PARTY_NOTICES/jaraco_context-6.1.2.dist-info/licenses/LICENSE +18 -0
- package/payload/THIRD_PARTY_NOTICES/jaraco_functools-4.6.0.dist-info/METADATA +68 -0
- package/payload/THIRD_PARTY_NOTICES/jaraco_functools-4.6.0.dist-info/licenses/LICENSE +18 -0
- package/payload/THIRD_PARTY_NOTICES/jeepney-0.9.0.dist-info/METADATA +35 -0
- package/payload/THIRD_PARTY_NOTICES/jeepney-0.9.0.dist-info/licenses/LICENSE +21 -0
- package/payload/THIRD_PARTY_NOTICES/jsonschema-4.26.0.dist-info/METADATA +170 -0
- package/payload/THIRD_PARTY_NOTICES/jsonschema-4.26.0.dist-info/licenses/COPYING +19 -0
- package/payload/THIRD_PARTY_NOTICES/jsonschema_specifications-2025.9.1.dist-info/METADATA +54 -0
- package/payload/THIRD_PARTY_NOTICES/jsonschema_specifications-2025.9.1.dist-info/licenses/COPYING +19 -0
- package/payload/THIRD_PARTY_NOTICES/keyring-25.7.0.dist-info/METADATA +554 -0
- package/payload/THIRD_PARTY_NOTICES/keyring-25.7.0.dist-info/licenses/LICENSE +18 -0
- package/payload/THIRD_PARTY_NOTICES/linkify_it_py-2.2.0.dist-info/METADATA +262 -0
- package/payload/THIRD_PARTY_NOTICES/linkify_it_py-2.2.0.dist-info/licenses/LICENSE +48 -0
- package/payload/THIRD_PARTY_NOTICES/markdown_it_py-4.3.0.dist-info/METADATA +237 -0
- package/payload/THIRD_PARTY_NOTICES/markdown_it_py-4.3.0.dist-info/licenses/LICENSE +21 -0
- package/payload/THIRD_PARTY_NOTICES/markdown_it_py-4.3.0.dist-info/licenses/LICENSE.markdown-it +22 -0
- package/payload/THIRD_PARTY_NOTICES/mcp-2.3.0.dist-info/METADATA +172 -0
- package/payload/THIRD_PARTY_NOTICES/mcp-2.3.0.dist-info/licenses/LICENSE +21 -0
- package/payload/THIRD_PARTY_NOTICES/mcp_types-2.3.0.dist-info/METADATA +43 -0
- package/payload/THIRD_PARTY_NOTICES/mcp_types-2.3.0.dist-info/licenses/LICENSE +21 -0
- package/payload/THIRD_PARTY_NOTICES/mdit_py_plugins-0.7.0.dist-info/METADATA +60 -0
- package/payload/THIRD_PARTY_NOTICES/mdit_py_plugins-0.7.0.dist-info/licenses/LICENSE +21 -0
- package/payload/THIRD_PARTY_NOTICES/mdurl-0.1.2.dist-info/LICENSE +46 -0
- package/payload/THIRD_PARTY_NOTICES/mdurl-0.1.2.dist-info/METADATA +32 -0
- package/payload/THIRD_PARTY_NOTICES/more_itertools-11.2.1.dist-info/METADATA +302 -0
- package/payload/THIRD_PARTY_NOTICES/more_itertools-11.2.1.dist-info/licenses/LICENSE +19 -0
- package/payload/THIRD_PARTY_NOTICES/opentelemetry_api-1.45.2.dist-info/METADATA +43 -0
- package/payload/THIRD_PARTY_NOTICES/opentelemetry_api-1.45.2.dist-info/licenses/LICENSE +201 -0
- package/payload/THIRD_PARTY_NOTICES/packaging-26.3.dist-info/METADATA +112 -0
- package/payload/THIRD_PARTY_NOTICES/packaging-26.3.dist-info/licenses/LICENSE +3 -0
- package/payload/THIRD_PARTY_NOTICES/packaging-26.3.dist-info/licenses/LICENSE.APACHE +177 -0
- package/payload/THIRD_PARTY_NOTICES/packaging-26.3.dist-info/licenses/LICENSE.BSD +23 -0
- package/payload/THIRD_PARTY_NOTICES/pathspec-1.1.1.dist-info/METADATA +392 -0
- package/payload/THIRD_PARTY_NOTICES/pathspec-1.1.1.dist-info/licenses/LICENSE +373 -0
- package/payload/THIRD_PARTY_NOTICES/pip-26.2.2.dist-info/METADATA +110 -0
- package/payload/THIRD_PARTY_NOTICES/pip-26.2.2.dist-info/licenses/AUTHORS.txt +888 -0
- package/payload/THIRD_PARTY_NOTICES/pip-26.2.2.dist-info/licenses/LICENSE.txt +20 -0
- package/payload/THIRD_PARTY_NOTICES/pip-26.2.2.dist-info/licenses/src/pip/_vendor/cachecontrol/LICENSE.txt +13 -0
- package/payload/THIRD_PARTY_NOTICES/pip-26.2.2.dist-info/licenses/src/pip/_vendor/certifi/LICENSE +20 -0
- package/payload/THIRD_PARTY_NOTICES/pip-26.2.2.dist-info/licenses/src/pip/_vendor/distlib/LICENSE.txt +284 -0
- package/payload/THIRD_PARTY_NOTICES/pip-26.2.2.dist-info/licenses/src/pip/_vendor/distro/LICENSE +202 -0
- package/payload/THIRD_PARTY_NOTICES/pip-26.2.2.dist-info/licenses/src/pip/_vendor/idna/LICENSE.md +31 -0
- package/payload/THIRD_PARTY_NOTICES/pip-26.2.2.dist-info/licenses/src/pip/_vendor/msgpack/COPYING +14 -0
- package/payload/THIRD_PARTY_NOTICES/pip-26.2.2.dist-info/licenses/src/pip/_vendor/packaging/LICENSE +3 -0
- package/payload/THIRD_PARTY_NOTICES/pip-26.2.2.dist-info/licenses/src/pip/_vendor/packaging/LICENSE.APACHE +177 -0
- package/payload/THIRD_PARTY_NOTICES/pip-26.2.2.dist-info/licenses/src/pip/_vendor/packaging/LICENSE.BSD +23 -0
- package/payload/THIRD_PARTY_NOTICES/pip-26.2.2.dist-info/licenses/src/pip/_vendor/pkg_resources/LICENSE +17 -0
- package/payload/THIRD_PARTY_NOTICES/pip-26.2.2.dist-info/licenses/src/pip/_vendor/platformdirs/LICENSE +21 -0
- package/payload/THIRD_PARTY_NOTICES/pip-26.2.2.dist-info/licenses/src/pip/_vendor/pygments/LICENSE +25 -0
- package/payload/THIRD_PARTY_NOTICES/pip-26.2.2.dist-info/licenses/src/pip/_vendor/pyproject_hooks/LICENSE +21 -0
- package/payload/THIRD_PARTY_NOTICES/pip-26.2.2.dist-info/licenses/src/pip/_vendor/requests/LICENSE +175 -0
- package/payload/THIRD_PARTY_NOTICES/pip-26.2.2.dist-info/licenses/src/pip/_vendor/resolvelib/LICENSE +13 -0
- package/payload/THIRD_PARTY_NOTICES/pip-26.2.2.dist-info/licenses/src/pip/_vendor/rich/LICENSE +19 -0
- package/payload/THIRD_PARTY_NOTICES/pip-26.2.2.dist-info/licenses/src/pip/_vendor/tomli/LICENSE +21 -0
- package/payload/THIRD_PARTY_NOTICES/pip-26.2.2.dist-info/licenses/src/pip/_vendor/tomli_w/LICENSE +21 -0
- package/payload/THIRD_PARTY_NOTICES/pip-26.2.2.dist-info/licenses/src/pip/_vendor/truststore/LICENSE +21 -0
- package/payload/THIRD_PARTY_NOTICES/pip-26.2.2.dist-info/licenses/src/pip/_vendor/urllib3/LICENSE.txt +21 -0
- package/payload/THIRD_PARTY_NOTICES/platformdirs-4.14.7.dist-info/METADATA +114 -0
- package/payload/THIRD_PARTY_NOTICES/platformdirs-4.14.7.dist-info/licenses/LICENSE +21 -0
- package/payload/THIRD_PARTY_NOTICES/pluggy-1.7.0.dist-info/METADATA +152 -0
- package/payload/THIRD_PARTY_NOTICES/pluggy-1.7.0.dist-info/licenses/LICENSE +21 -0
- package/payload/THIRD_PARTY_NOTICES/pycparser-3.12.dist-info/METADATA +286 -0
- package/payload/THIRD_PARTY_NOTICES/pycparser-3.12.dist-info/licenses/LICENSE +27 -0
- package/payload/THIRD_PARTY_NOTICES/pydantic-2.14.3.dist-info/METADATA +1646 -0
- package/payload/THIRD_PARTY_NOTICES/pydantic-2.14.3.dist-info/licenses/LICENSE +21 -0
- package/payload/THIRD_PARTY_NOTICES/pydantic_core-2.50.4.dist-info/METADATA +172 -0
- package/payload/THIRD_PARTY_NOTICES/pydantic_core-2.50.4.dist-info/licenses/LICENSE +21 -0
- package/payload/THIRD_PARTY_NOTICES/pygments-2.21.0.dist-info/METADATA +58 -0
- package/payload/THIRD_PARTY_NOTICES/pygments-2.21.0.dist-info/licenses/AUTHORS +296 -0
- package/payload/THIRD_PARTY_NOTICES/pygments-2.21.0.dist-info/licenses/LICENSE +25 -0
- package/payload/THIRD_PARTY_NOTICES/pyinstaller-6.22.3.dist-info/METADATA +213 -0
- package/payload/THIRD_PARTY_NOTICES/pyinstaller-6.22.3.dist-info/licenses/COPYING.txt +648 -0
- package/payload/THIRD_PARTY_NOTICES/pyinstaller_hooks_contrib-2026.10.dist-info/METADATA +373 -0
- package/payload/THIRD_PARTY_NOTICES/pyinstaller_hooks_contrib-2026.10.dist-info/licenses/LICENSE +521 -0
- package/payload/THIRD_PARTY_NOTICES/pyjwt-2.15.1.dist-info/METADATA +94 -0
- package/payload/THIRD_PARTY_NOTICES/pyjwt-2.15.1.dist-info/licenses/AUTHORS.rst +7 -0
- package/payload/THIRD_PARTY_NOTICES/pyjwt-2.15.1.dist-info/licenses/LICENSE +21 -0
- package/payload/THIRD_PARTY_NOTICES/pyproject_hooks-1.3.3.dist-info/METADATA +27 -0
- package/payload/THIRD_PARTY_NOTICES/pyproject_hooks-1.3.3.dist-info/licenses/LICENSE +21 -0
- package/payload/THIRD_PARTY_NOTICES/pytest-9.2.0.dist-info/METADATA +217 -0
- package/payload/THIRD_PARTY_NOTICES/pytest-9.2.0.dist-info/licenses/LICENSE +21 -0
- package/payload/THIRD_PARTY_NOTICES/pytest_asyncio-1.5.0.dist-info/METADATA +100 -0
- package/payload/THIRD_PARTY_NOTICES/pytest_asyncio-1.5.0.dist-info/licenses/LICENSE +201 -0
- package/payload/THIRD_PARTY_NOTICES/python_multipart-0.0.34.dist-info/METADATA +179 -0
- package/payload/THIRD_PARTY_NOTICES/python_multipart-0.0.34.dist-info/licenses/LICENSE.txt +202 -0
- package/payload/THIRD_PARTY_NOTICES/pyyaml-6.0.3.dist-info/METADATA +59 -0
- package/payload/THIRD_PARTY_NOTICES/pyyaml-6.0.3.dist-info/licenses/LICENSE +20 -0
- package/payload/THIRD_PARTY_NOTICES/referencing-0.37.0.dist-info/METADATA +64 -0
- package/payload/THIRD_PARTY_NOTICES/referencing-0.37.0.dist-info/licenses/COPYING +19 -0
- package/payload/THIRD_PARTY_NOTICES/rich-15.0.0.dist-info/METADATA +479 -0
- package/payload/THIRD_PARTY_NOTICES/rich-15.0.0.dist-info/licenses/LICENSE +19 -0
- package/payload/THIRD_PARTY_NOTICES/rpds_py-2026.9.1.dist-info/METADATA +99 -0
- package/payload/THIRD_PARTY_NOTICES/rpds_py-2026.9.1.dist-info/licenses/LICENSE +19 -0
- package/payload/THIRD_PARTY_NOTICES/ruff-0.17.5.dist-info/METADATA +484 -0
- package/payload/THIRD_PARTY_NOTICES/ruff-0.17.5.dist-info/licenses/LICENSE +430 -0
- package/payload/THIRD_PARTY_NOTICES/secretstorage-3.5.0.dist-info/METADATA +109 -0
- package/payload/THIRD_PARTY_NOTICES/secretstorage-3.5.0.dist-info/licenses/LICENSE +25 -0
- package/payload/THIRD_PARTY_NOTICES/setuptools/_vendor/autocommand-2.2.2.dist-info/LICENSE +166 -0
- package/payload/THIRD_PARTY_NOTICES/setuptools/_vendor/autocommand-2.2.2.dist-info/METADATA +420 -0
- package/payload/THIRD_PARTY_NOTICES/setuptools/_vendor/backports.tarfile-1.2.0.dist-info/LICENSE +17 -0
- package/payload/THIRD_PARTY_NOTICES/setuptools/_vendor/backports.tarfile-1.2.0.dist-info/METADATA +46 -0
- package/payload/THIRD_PARTY_NOTICES/setuptools/_vendor/importlib_metadata-8.7.1.dist-info/METADATA +133 -0
- package/payload/THIRD_PARTY_NOTICES/setuptools/_vendor/importlib_metadata-8.7.1.dist-info/licenses/LICENSE +73 -0
- package/payload/THIRD_PARTY_NOTICES/setuptools/_vendor/jaraco.text-4.0.0.dist-info/LICENSE +17 -0
- package/payload/THIRD_PARTY_NOTICES/setuptools/_vendor/jaraco.text-4.0.0.dist-info/METADATA +96 -0
- package/payload/THIRD_PARTY_NOTICES/setuptools/_vendor/jaraco_context-6.1.0.dist-info/METADATA +82 -0
- package/payload/THIRD_PARTY_NOTICES/setuptools/_vendor/jaraco_context-6.1.0.dist-info/licenses/LICENSE +18 -0
- package/payload/THIRD_PARTY_NOTICES/setuptools/_vendor/jaraco_functools-4.4.0.dist-info/METADATA +69 -0
- package/payload/THIRD_PARTY_NOTICES/setuptools/_vendor/jaraco_functools-4.4.0.dist-info/licenses/LICENSE +18 -0
- package/payload/THIRD_PARTY_NOTICES/setuptools/_vendor/more_itertools-10.8.0.dist-info/METADATA +283 -0
- package/payload/THIRD_PARTY_NOTICES/setuptools/_vendor/more_itertools-10.8.0.dist-info/licenses/LICENSE +19 -0
- package/payload/THIRD_PARTY_NOTICES/setuptools/_vendor/packaging-26.3.dist-info/METADATA +112 -0
- package/payload/THIRD_PARTY_NOTICES/setuptools/_vendor/packaging-26.3.dist-info/licenses/LICENSE +3 -0
- package/payload/THIRD_PARTY_NOTICES/setuptools/_vendor/packaging-26.3.dist-info/licenses/LICENSE.APACHE +177 -0
- package/payload/THIRD_PARTY_NOTICES/setuptools/_vendor/packaging-26.3.dist-info/licenses/LICENSE.BSD +23 -0
- package/payload/THIRD_PARTY_NOTICES/setuptools/_vendor/platformdirs-4.4.0.dist-info/METADATA +350 -0
- package/payload/THIRD_PARTY_NOTICES/setuptools/_vendor/platformdirs-4.4.0.dist-info/licenses/LICENSE +21 -0
- package/payload/THIRD_PARTY_NOTICES/setuptools/_vendor/tomli-2.4.0.dist-info/METADATA +270 -0
- package/payload/THIRD_PARTY_NOTICES/setuptools/_vendor/tomli-2.4.0.dist-info/licenses/LICENSE +21 -0
- package/payload/THIRD_PARTY_NOTICES/setuptools/_vendor/wheel-0.46.3.dist-info/METADATA +69 -0
- package/payload/THIRD_PARTY_NOTICES/setuptools/_vendor/wheel-0.46.3.dist-info/licenses/LICENSE.txt +21 -0
- package/payload/THIRD_PARTY_NOTICES/setuptools/_vendor/zipp-3.23.0.dist-info/METADATA +106 -0
- package/payload/THIRD_PARTY_NOTICES/setuptools/_vendor/zipp-3.23.0.dist-info/licenses/LICENSE +18 -0
- package/payload/THIRD_PARTY_NOTICES/setuptools-84.2.1.dist-info/METADATA +140 -0
- package/payload/THIRD_PARTY_NOTICES/setuptools-84.2.1.dist-info/licenses/LICENSE +17 -0
- package/payload/THIRD_PARTY_NOTICES/sse_starlette-3.7.0.dist-info/METADATA +493 -0
- package/payload/THIRD_PARTY_NOTICES/sse_starlette-3.7.0.dist-info/licenses/AUTHORS +10 -0
- package/payload/THIRD_PARTY_NOTICES/sse_starlette-3.7.0.dist-info/licenses/LICENSE +27 -0
- package/payload/THIRD_PARTY_NOTICES/starlette-1.10.0.dist-info/METADATA +181 -0
- package/payload/THIRD_PARTY_NOTICES/starlette-1.10.0.dist-info/licenses/LICENSE.md +27 -0
- package/payload/THIRD_PARTY_NOTICES/textual-6.12.0.dist-info/LICENSE +21 -0
- package/payload/THIRD_PARTY_NOTICES/textual-6.12.0.dist-info/METADATA +265 -0
- package/payload/THIRD_PARTY_NOTICES/tomlkit-0.15.2.dist-info/METADATA +93 -0
- package/payload/THIRD_PARTY_NOTICES/tomlkit-0.15.2.dist-info/licenses/LICENSE +20 -0
- package/payload/THIRD_PARTY_NOTICES/trove_classifiers-2026.9.21.13.dist-info/METADATA +82 -0
- package/payload/THIRD_PARTY_NOTICES/trove_classifiers-2026.9.21.13.dist-info/licenses/LICENSE +201 -0
- package/payload/THIRD_PARTY_NOTICES/truststore-0.10.5.dist-info/METADATA +110 -0
- package/payload/THIRD_PARTY_NOTICES/truststore-0.10.5.dist-info/licenses/LICENSE +21 -0
- package/payload/THIRD_PARTY_NOTICES/typing_extensions-4.16.0.dist-info/METADATA +73 -0
- package/payload/THIRD_PARTY_NOTICES/typing_extensions-4.16.0.dist-info/licenses/LICENSE +279 -0
- package/payload/THIRD_PARTY_NOTICES/typing_inspection-0.4.5.dist-info/METADATA +49 -0
- package/payload/THIRD_PARTY_NOTICES/typing_inspection-0.4.5.dist-info/licenses/LICENSE +21 -0
- package/payload/THIRD_PARTY_NOTICES/uvicorn-0.54.0.dist-info/METADATA +189 -0
- package/payload/THIRD_PARTY_NOTICES/uvicorn-0.54.0.dist-info/licenses/LICENSE.md +27 -0
- package/payload/rhtop +0 -0
- package/README.md +0 -3
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
GNU LESSER GENERAL PUBLIC LICENSE
|
|
2
|
+
Version 3, 29 June 2007
|
|
3
|
+
|
|
4
|
+
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
|
5
|
+
Everyone is permitted to copy and distribute verbatim copies
|
|
6
|
+
of this license document, but changing it is not allowed.
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
This version of the GNU Lesser General Public License incorporates
|
|
10
|
+
the terms and conditions of version 3 of the GNU General Public
|
|
11
|
+
License, supplemented by the additional permissions listed below.
|
|
12
|
+
|
|
13
|
+
0. Additional Definitions.
|
|
14
|
+
|
|
15
|
+
As used herein, "this License" refers to version 3 of the GNU Lesser
|
|
16
|
+
General Public License, and the "GNU GPL" refers to version 3 of the GNU
|
|
17
|
+
General Public License.
|
|
18
|
+
|
|
19
|
+
"The Library" refers to a covered work governed by this License,
|
|
20
|
+
other than an Application or a Combined Work as defined below.
|
|
21
|
+
|
|
22
|
+
An "Application" is any work that makes use of an interface provided
|
|
23
|
+
by the Library, but which is not otherwise based on the Library.
|
|
24
|
+
Defining a subclass of a class defined by the Library is deemed a mode
|
|
25
|
+
of using an interface provided by the Library.
|
|
26
|
+
|
|
27
|
+
A "Combined Work" is a work produced by combining or linking an
|
|
28
|
+
Application with the Library. The particular version of the Library
|
|
29
|
+
with which the Combined Work was made is also called the "Linked
|
|
30
|
+
Version".
|
|
31
|
+
|
|
32
|
+
The "Minimal Corresponding Source" for a Combined Work means the
|
|
33
|
+
Corresponding Source for the Combined Work, excluding any source code
|
|
34
|
+
for portions of the Combined Work that, considered in isolation, are
|
|
35
|
+
based on the Application, and not on the Linked Version.
|
|
36
|
+
|
|
37
|
+
The "Corresponding Application Code" for a Combined Work means the
|
|
38
|
+
object code and/or source code for the Application, including any data
|
|
39
|
+
and utility programs needed for reproducing the Combined Work from the
|
|
40
|
+
Application, but excluding the System Libraries of the Combined Work.
|
|
41
|
+
|
|
42
|
+
1. Exception to Section 3 of the GNU GPL.
|
|
43
|
+
|
|
44
|
+
You may convey a covered work under sections 3 and 4 of this License
|
|
45
|
+
without being bound by section 3 of the GNU GPL.
|
|
46
|
+
|
|
47
|
+
2. Conveying Modified Versions.
|
|
48
|
+
|
|
49
|
+
If you modify a copy of the Library, and, in your modifications, a
|
|
50
|
+
facility refers to a function or data to be supplied by an Application
|
|
51
|
+
that uses the facility (other than as an argument passed when the
|
|
52
|
+
facility is invoked), then you may convey a copy of the modified
|
|
53
|
+
version:
|
|
54
|
+
|
|
55
|
+
a) under this License, provided that you make a good faith effort to
|
|
56
|
+
ensure that, in the event an Application does not supply the
|
|
57
|
+
function or data, the facility still operates, and performs
|
|
58
|
+
whatever part of its purpose remains meaningful, or
|
|
59
|
+
|
|
60
|
+
b) under the GNU GPL, with none of the additional permissions of
|
|
61
|
+
this License applicable to that copy.
|
|
62
|
+
|
|
63
|
+
3. Object Code Incorporating Material from Library Header Files.
|
|
64
|
+
|
|
65
|
+
The object code form of an Application may incorporate material from
|
|
66
|
+
a header file that is part of the Library. You may convey such object
|
|
67
|
+
code under terms of your choice, provided that, if the incorporated
|
|
68
|
+
material is not limited to numerical parameters, data structure
|
|
69
|
+
layouts and accessors, or small macros, inline functions and templates
|
|
70
|
+
(ten or fewer lines in length), you do both of the following:
|
|
71
|
+
|
|
72
|
+
a) Give prominent notice with each copy of the object code that the
|
|
73
|
+
Library is used in it and that the Library and its use are
|
|
74
|
+
covered by this License.
|
|
75
|
+
|
|
76
|
+
b) Accompany the object code with a copy of the GNU GPL and this license
|
|
77
|
+
document.
|
|
78
|
+
|
|
79
|
+
4. Combined Works.
|
|
80
|
+
|
|
81
|
+
You may convey a Combined Work under terms of your choice that,
|
|
82
|
+
taken together, effectively do not restrict modification of the
|
|
83
|
+
portions of the Library contained in the Combined Work and reverse
|
|
84
|
+
engineering for debugging such modifications, if you also do each of
|
|
85
|
+
the following:
|
|
86
|
+
|
|
87
|
+
a) Give prominent notice with each copy of the Combined Work that
|
|
88
|
+
the Library is used in it and that the Library and its use are
|
|
89
|
+
covered by this License.
|
|
90
|
+
|
|
91
|
+
b) Accompany the Combined Work with a copy of the GNU GPL and this license
|
|
92
|
+
document.
|
|
93
|
+
|
|
94
|
+
c) For a Combined Work that displays copyright notices during
|
|
95
|
+
execution, include the copyright notice for the Library among
|
|
96
|
+
these notices, as well as a reference directing the user to the
|
|
97
|
+
copies of the GNU GPL and this license document.
|
|
98
|
+
|
|
99
|
+
d) Do one of the following:
|
|
100
|
+
|
|
101
|
+
0) Convey the Minimal Corresponding Source under the terms of this
|
|
102
|
+
License, and the Corresponding Application Code in a form
|
|
103
|
+
suitable for, and under terms that permit, the user to
|
|
104
|
+
recombine or relink the Application with a modified version of
|
|
105
|
+
the Linked Version to produce a modified Combined Work, in the
|
|
106
|
+
manner specified by section 6 of the GNU GPL for conveying
|
|
107
|
+
Corresponding Source.
|
|
108
|
+
|
|
109
|
+
1) Use a suitable shared library mechanism for linking with the
|
|
110
|
+
Library. A suitable mechanism is one that (a) uses at run time
|
|
111
|
+
a copy of the Library already present on the user's computer
|
|
112
|
+
system, and (b) will operate properly with a modified version
|
|
113
|
+
of the Library that is interface-compatible with the Linked
|
|
114
|
+
Version.
|
|
115
|
+
|
|
116
|
+
e) Provide Installation Information, but only if you would otherwise
|
|
117
|
+
be required to provide such information under section 6 of the
|
|
118
|
+
GNU GPL, and only to the extent that such information is
|
|
119
|
+
necessary to install and execute a modified version of the
|
|
120
|
+
Combined Work produced by recombining or relinking the
|
|
121
|
+
Application with a modified version of the Linked Version. (If
|
|
122
|
+
you use option 4d0, the Installation Information must accompany
|
|
123
|
+
the Minimal Corresponding Source and Corresponding Application
|
|
124
|
+
Code. If you use option 4d1, you must provide the Installation
|
|
125
|
+
Information in the manner specified by section 6 of the GNU GPL
|
|
126
|
+
for conveying Corresponding Source.)
|
|
127
|
+
|
|
128
|
+
5. Combined Libraries.
|
|
129
|
+
|
|
130
|
+
You may place library facilities that are a work based on the
|
|
131
|
+
Library side by side in a single library together with other library
|
|
132
|
+
facilities that are not Applications and are not covered by this
|
|
133
|
+
License, and convey such a combined library under terms of your
|
|
134
|
+
choice, if you do both of the following:
|
|
135
|
+
|
|
136
|
+
a) Accompany the combined library with a copy of the same work based
|
|
137
|
+
on the Library, uncombined with any other library facilities,
|
|
138
|
+
conveyed under the terms of this License.
|
|
139
|
+
|
|
140
|
+
b) Give prominent notice with the combined library that part of it
|
|
141
|
+
is a work based on the Library, and explaining where to find the
|
|
142
|
+
accompanying uncombined form of the same work.
|
|
143
|
+
|
|
144
|
+
6. Revised Versions of the GNU Lesser General Public License.
|
|
145
|
+
|
|
146
|
+
The Free Software Foundation may publish revised and/or new versions
|
|
147
|
+
of the GNU Lesser General Public License from time to time. Such new
|
|
148
|
+
versions will be similar in spirit to the present version, but may
|
|
149
|
+
differ in detail to address new problems or concerns.
|
|
150
|
+
|
|
151
|
+
Each version is given a distinguishing version number. If the
|
|
152
|
+
Library as you received it specifies that a certain numbered version
|
|
153
|
+
of the GNU Lesser General Public License "or any later version"
|
|
154
|
+
applies to it, you have the option of following the terms and
|
|
155
|
+
conditions either of that published version or of any later version
|
|
156
|
+
published by the Free Software Foundation. If the Library as you
|
|
157
|
+
received it does not specify a version number of the GNU Lesser
|
|
158
|
+
General Public License, you may choose any version of the GNU Lesser
|
|
159
|
+
General Public License ever published by the Free Software Foundation.
|
|
160
|
+
|
|
161
|
+
If the Library as you received it specifies that a proxy can decide
|
|
162
|
+
whether future versions of the GNU Lesser General Public License shall
|
|
163
|
+
apply, that proxy's public statement of acceptance of any version is
|
|
164
|
+
permanent authorization for you to choose that version for the
|
|
165
|
+
Library.
|
|
166
|
+
|
|
@@ -0,0 +1,420 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: autocommand
|
|
3
|
+
Version: 2.2.2
|
|
4
|
+
Summary: A library to create a command-line program from a function
|
|
5
|
+
Home-page: https://github.com/Lucretiel/autocommand
|
|
6
|
+
Author: Nathan West
|
|
7
|
+
License: LGPLv3
|
|
8
|
+
Project-URL: Homepage, https://github.com/Lucretiel/autocommand
|
|
9
|
+
Project-URL: Bug Tracker, https://github.com/Lucretiel/autocommand/issues
|
|
10
|
+
Platform: any
|
|
11
|
+
Classifier: Development Status :: 6 - Mature
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: License :: OSI Approved :: GNU Lesser General Public License v3 (LGPLv3)
|
|
14
|
+
Classifier: Programming Language :: Python
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
17
|
+
Classifier: Topic :: Software Development
|
|
18
|
+
Classifier: Topic :: Software Development :: Libraries
|
|
19
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
20
|
+
Requires-Python: >=3.7
|
|
21
|
+
Description-Content-Type: text/markdown
|
|
22
|
+
License-File: LICENSE
|
|
23
|
+
|
|
24
|
+
[](https://badge.fury.io/py/autocommand)
|
|
25
|
+
|
|
26
|
+
# autocommand
|
|
27
|
+
|
|
28
|
+
A library to automatically generate and run simple argparse parsers from function signatures.
|
|
29
|
+
|
|
30
|
+
## Installation
|
|
31
|
+
|
|
32
|
+
Autocommand is installed via pip:
|
|
33
|
+
|
|
34
|
+
```
|
|
35
|
+
$ pip install autocommand
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Usage
|
|
39
|
+
|
|
40
|
+
Autocommand turns a function into a command-line program. It converts the function's parameter signature into command-line arguments, and automatically runs the function if the module was called as `__main__`. In effect, it lets your create a smart main function.
|
|
41
|
+
|
|
42
|
+
```python
|
|
43
|
+
from autocommand import autocommand
|
|
44
|
+
|
|
45
|
+
# This program takes exactly one argument and echos it.
|
|
46
|
+
@autocommand(__name__)
|
|
47
|
+
def echo(thing):
|
|
48
|
+
print(thing)
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
```
|
|
52
|
+
$ python echo.py hello
|
|
53
|
+
hello
|
|
54
|
+
$ python echo.py -h
|
|
55
|
+
usage: echo [-h] thing
|
|
56
|
+
|
|
57
|
+
positional arguments:
|
|
58
|
+
thing
|
|
59
|
+
|
|
60
|
+
optional arguments:
|
|
61
|
+
-h, --help show this help message and exit
|
|
62
|
+
$ python echo.py hello world # too many arguments
|
|
63
|
+
usage: echo.py [-h] thing
|
|
64
|
+
echo.py: error: unrecognized arguments: world
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
As you can see, autocommand converts the signature of the function into an argument spec. When you run the file as a program, autocommand collects the command-line arguments and turns them into function arguments. The function is executed with these arguments, and then the program exits with the return value of the function, via `sys.exit`. Autocommand also automatically creates a usage message, which can be invoked with `-h` or `--help`, and automatically prints an error message when provided with invalid arguments.
|
|
68
|
+
|
|
69
|
+
### Types
|
|
70
|
+
|
|
71
|
+
You can use a type annotation to give an argument a type. Any type (or in fact any callable) that returns an object when given a string argument can be used, though there are a few special cases that are described later.
|
|
72
|
+
|
|
73
|
+
```python
|
|
74
|
+
@autocommand(__name__)
|
|
75
|
+
def net_client(host, port: int):
|
|
76
|
+
...
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
Autocommand will catch `TypeErrors` raised by the type during argument parsing, so you can supply a callable and do some basic argument validation as well.
|
|
80
|
+
|
|
81
|
+
### Trailing Arguments
|
|
82
|
+
|
|
83
|
+
You can add a `*args` parameter to your function to give it trailing arguments. The command will collect 0 or more trailing arguments and supply them to `args` as a tuple. If a type annotation is supplied, the type is applied to each argument.
|
|
84
|
+
|
|
85
|
+
```python
|
|
86
|
+
# Write the contents of each file, one by one
|
|
87
|
+
@autocommand(__name__)
|
|
88
|
+
def cat(*files):
|
|
89
|
+
for filename in files:
|
|
90
|
+
with open(filename) as file:
|
|
91
|
+
for line in file:
|
|
92
|
+
print(line.rstrip())
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
```
|
|
96
|
+
$ python cat.py -h
|
|
97
|
+
usage: ipython [-h] [file [file ...]]
|
|
98
|
+
|
|
99
|
+
positional arguments:
|
|
100
|
+
file
|
|
101
|
+
|
|
102
|
+
optional arguments:
|
|
103
|
+
-h, --help show this help message and exit
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
### Options
|
|
107
|
+
|
|
108
|
+
To create `--option` switches, just assign a default. Autocommand will automatically create `--long` and `-s`hort switches.
|
|
109
|
+
|
|
110
|
+
```python
|
|
111
|
+
@autocommand(__name__)
|
|
112
|
+
def do_with_config(argument, config='~/foo.conf'):
|
|
113
|
+
pass
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
```
|
|
117
|
+
$ python example.py -h
|
|
118
|
+
usage: example.py [-h] [-c CONFIG] argument
|
|
119
|
+
|
|
120
|
+
positional arguments:
|
|
121
|
+
argument
|
|
122
|
+
|
|
123
|
+
optional arguments:
|
|
124
|
+
-h, --help show this help message and exit
|
|
125
|
+
-c CONFIG, --config CONFIG
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
The option's type is automatically deduced from the default, unless one is explicitly given in an annotation:
|
|
129
|
+
|
|
130
|
+
```python
|
|
131
|
+
@autocommand(__name__)
|
|
132
|
+
def http_connect(host, port=80):
|
|
133
|
+
print('{}:{}'.format(host, port))
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
```
|
|
137
|
+
$ python http.py -h
|
|
138
|
+
usage: http.py [-h] [-p PORT] host
|
|
139
|
+
|
|
140
|
+
positional arguments:
|
|
141
|
+
host
|
|
142
|
+
|
|
143
|
+
optional arguments:
|
|
144
|
+
-h, --help show this help message and exit
|
|
145
|
+
-p PORT, --port PORT
|
|
146
|
+
$ python http.py localhost
|
|
147
|
+
localhost:80
|
|
148
|
+
$ python http.py localhost -p 8080
|
|
149
|
+
localhost:8080
|
|
150
|
+
$ python http.py localhost -p blah
|
|
151
|
+
usage: http.py [-h] [-p PORT] host
|
|
152
|
+
http.py: error: argument -p/--port: invalid int value: 'blah'
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
#### None
|
|
156
|
+
|
|
157
|
+
If an option is given a default value of `None`, it reads in a value as normal, but supplies `None` if the option isn't provided.
|
|
158
|
+
|
|
159
|
+
#### Switches
|
|
160
|
+
|
|
161
|
+
If an argument is given a default value of `True` or `False`, or
|
|
162
|
+
given an explicit `bool` type, it becomes an option switch.
|
|
163
|
+
|
|
164
|
+
```python
|
|
165
|
+
@autocommand(__name__)
|
|
166
|
+
def example(verbose=False, quiet=False):
|
|
167
|
+
pass
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
```
|
|
171
|
+
$ python example.py -h
|
|
172
|
+
usage: example.py [-h] [-v] [-q]
|
|
173
|
+
|
|
174
|
+
optional arguments:
|
|
175
|
+
-h, --help show this help message and exit
|
|
176
|
+
-v, --verbose
|
|
177
|
+
-q, --quiet
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
Autocommand attempts to do the "correct thing" in these cases- if the default is `True`, then supplying the switch makes the argument `False`; if the type is `bool` and the default is some other `True` value, then supplying the switch makes the argument `False`, while not supplying the switch makes the argument the default value.
|
|
181
|
+
|
|
182
|
+
Autocommand also supports the creation of switch inverters. Pass `add_nos=True` to `autocommand` to enable this.
|
|
183
|
+
|
|
184
|
+
```
|
|
185
|
+
@autocommand(__name__, add_nos=True)
|
|
186
|
+
def example(verbose=False):
|
|
187
|
+
pass
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
```
|
|
191
|
+
$ python example.py -h
|
|
192
|
+
usage: ipython [-h] [-v] [--no-verbose]
|
|
193
|
+
|
|
194
|
+
optional arguments:
|
|
195
|
+
-h, --help show this help message and exit
|
|
196
|
+
-v, --verbose
|
|
197
|
+
--no-verbose
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
Using the `--no-` version of a switch will pass the opposite value in as a function argument. If multiple switches are present, the last one takes precedence.
|
|
201
|
+
|
|
202
|
+
#### Files
|
|
203
|
+
|
|
204
|
+
If the default value is a file object, such as `sys.stdout`, then autocommand just looks for a string, for a file path. It doesn't do any special checking on the string, though (such as checking if the file exists); it's better to let the client decide how to handle errors in this case. Instead, it provides a special context manager called `smart_open`, which behaves exactly like `open` if a filename or other openable type is provided, but also lets you use already open files:
|
|
205
|
+
|
|
206
|
+
```python
|
|
207
|
+
from autocommand import autocommand, smart_open
|
|
208
|
+
import sys
|
|
209
|
+
|
|
210
|
+
# Write the contents of stdin, or a file, to stdout
|
|
211
|
+
@autocommand(__name__)
|
|
212
|
+
def write_out(infile=sys.stdin):
|
|
213
|
+
with smart_open(infile) as f:
|
|
214
|
+
for line in f:
|
|
215
|
+
print(line.rstrip())
|
|
216
|
+
# If a file was opened, it is closed here. If it was just stdin, it is untouched.
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
```
|
|
220
|
+
$ echo "Hello World!" | python write_out.py | tee hello.txt
|
|
221
|
+
Hello World!
|
|
222
|
+
$ python write_out.py --infile hello.txt
|
|
223
|
+
Hello World!
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
### Descriptions and docstrings
|
|
227
|
+
|
|
228
|
+
The `autocommand` decorator accepts `description` and `epilog` kwargs, corresponding to the `description <https://docs.python.org/3/library/argparse.html#description>`_ and `epilog <https://docs.python.org/3/library/argparse.html#epilog>`_ of the `ArgumentParser`. If no description is given, but the decorated function has a docstring, then it is taken as the `description` for the `ArgumentParser`. You can also provide both the description and epilog in the docstring by splitting it into two sections with 4 or more - characters.
|
|
229
|
+
|
|
230
|
+
```python
|
|
231
|
+
@autocommand(__name__)
|
|
232
|
+
def copy(infile=sys.stdin, outfile=sys.stdout):
|
|
233
|
+
'''
|
|
234
|
+
Copy an the contents of a file (or stdin) to another file (or stdout)
|
|
235
|
+
----------
|
|
236
|
+
Some extra documentation in the epilog
|
|
237
|
+
'''
|
|
238
|
+
with smart_open(infile) as istr:
|
|
239
|
+
with smart_open(outfile, 'w') as ostr:
|
|
240
|
+
for line in istr:
|
|
241
|
+
ostr.write(line)
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
```
|
|
245
|
+
$ python copy.py -h
|
|
246
|
+
usage: copy.py [-h] [-i INFILE] [-o OUTFILE]
|
|
247
|
+
|
|
248
|
+
Copy an the contents of a file (or stdin) to another file (or stdout)
|
|
249
|
+
|
|
250
|
+
optional arguments:
|
|
251
|
+
-h, --help show this help message and exit
|
|
252
|
+
-i INFILE, --infile INFILE
|
|
253
|
+
-o OUTFILE, --outfile OUTFILE
|
|
254
|
+
|
|
255
|
+
Some extra documentation in the epilog
|
|
256
|
+
$ echo "Hello World" | python copy.py --outfile hello.txt
|
|
257
|
+
$ python copy.py --infile hello.txt --outfile hello2.txt
|
|
258
|
+
$ python copy.py --infile hello2.txt
|
|
259
|
+
Hello World
|
|
260
|
+
```
|
|
261
|
+
|
|
262
|
+
### Parameter descriptions
|
|
263
|
+
|
|
264
|
+
You can also attach description text to individual parameters in the annotation. To attach both a type and a description, supply them both in any order in a tuple
|
|
265
|
+
|
|
266
|
+
```python
|
|
267
|
+
@autocommand(__name__)
|
|
268
|
+
def copy_net(
|
|
269
|
+
infile: 'The name of the file to send',
|
|
270
|
+
host: 'The host to send the file to',
|
|
271
|
+
port: (int, 'The port to connect to')):
|
|
272
|
+
|
|
273
|
+
'''
|
|
274
|
+
Copy a file over raw TCP to a remote destination.
|
|
275
|
+
'''
|
|
276
|
+
# Left as an exercise to the reader
|
|
277
|
+
```
|
|
278
|
+
|
|
279
|
+
### Decorators and wrappers
|
|
280
|
+
|
|
281
|
+
Autocommand automatically follows wrapper chains created by `@functools.wraps`. This means that you can apply other wrapping decorators to your main function, and autocommand will still correctly detect the signature.
|
|
282
|
+
|
|
283
|
+
```python
|
|
284
|
+
from functools import wraps
|
|
285
|
+
from autocommand import autocommand
|
|
286
|
+
|
|
287
|
+
def print_yielded(func):
|
|
288
|
+
'''
|
|
289
|
+
Convert a generator into a function that prints all yielded elements
|
|
290
|
+
'''
|
|
291
|
+
@wraps(func)
|
|
292
|
+
def wrapper(*args, **kwargs):
|
|
293
|
+
for thing in func(*args, **kwargs):
|
|
294
|
+
print(thing)
|
|
295
|
+
return wrapper
|
|
296
|
+
|
|
297
|
+
@autocommand(__name__,
|
|
298
|
+
description= 'Print all the values from START to STOP, inclusive, in steps of STEP',
|
|
299
|
+
epilog= 'STOP and STEP default to 1')
|
|
300
|
+
@print_yielded
|
|
301
|
+
def seq(stop, start=1, step=1):
|
|
302
|
+
for i in range(start, stop + 1, step):
|
|
303
|
+
yield i
|
|
304
|
+
```
|
|
305
|
+
|
|
306
|
+
```
|
|
307
|
+
$ seq.py -h
|
|
308
|
+
usage: seq.py [-h] [-s START] [-S STEP] stop
|
|
309
|
+
|
|
310
|
+
Print all the values from START to STOP, inclusive, in steps of STEP
|
|
311
|
+
|
|
312
|
+
positional arguments:
|
|
313
|
+
stop
|
|
314
|
+
|
|
315
|
+
optional arguments:
|
|
316
|
+
-h, --help show this help message and exit
|
|
317
|
+
-s START, --start START
|
|
318
|
+
-S STEP, --step STEP
|
|
319
|
+
|
|
320
|
+
STOP and STEP default to 1
|
|
321
|
+
```
|
|
322
|
+
|
|
323
|
+
Even though autocommand is being applied to the `wrapper` returned by `print_yielded`, it still retreives the signature of the underlying `seq` function to create the argument parsing.
|
|
324
|
+
|
|
325
|
+
### Custom Parser
|
|
326
|
+
|
|
327
|
+
While autocommand's automatic parser generator is a powerful convenience, it doesn't cover all of the different features that argparse provides. If you need these features, you can provide your own parser as a kwarg to `autocommand`:
|
|
328
|
+
|
|
329
|
+
```python
|
|
330
|
+
from argparse import ArgumentParser
|
|
331
|
+
from autocommand import autocommand
|
|
332
|
+
|
|
333
|
+
parser = ArgumentParser()
|
|
334
|
+
# autocommand can't do optional positonal parameters
|
|
335
|
+
parser.add_argument('arg', nargs='?')
|
|
336
|
+
# or mutually exclusive options
|
|
337
|
+
group = parser.add_mutually_exclusive_group()
|
|
338
|
+
group.add_argument('-v', '--verbose', action='store_true')
|
|
339
|
+
group.add_argument('-q', '--quiet', action='store_true')
|
|
340
|
+
|
|
341
|
+
@autocommand(__name__, parser=parser)
|
|
342
|
+
def main(arg, verbose, quiet):
|
|
343
|
+
print(arg, verbose, quiet)
|
|
344
|
+
```
|
|
345
|
+
|
|
346
|
+
```
|
|
347
|
+
$ python parser.py -h
|
|
348
|
+
usage: write_file.py [-h] [-v | -q] [arg]
|
|
349
|
+
|
|
350
|
+
positional arguments:
|
|
351
|
+
arg
|
|
352
|
+
|
|
353
|
+
optional arguments:
|
|
354
|
+
-h, --help show this help message and exit
|
|
355
|
+
-v, --verbose
|
|
356
|
+
-q, --quiet
|
|
357
|
+
$ python parser.py
|
|
358
|
+
None False False
|
|
359
|
+
$ python parser.py hello
|
|
360
|
+
hello False False
|
|
361
|
+
$ python parser.py -v
|
|
362
|
+
None True False
|
|
363
|
+
$ python parser.py -q
|
|
364
|
+
None False True
|
|
365
|
+
$ python parser.py -vq
|
|
366
|
+
usage: parser.py [-h] [-v | -q] [arg]
|
|
367
|
+
parser.py: error: argument -q/--quiet: not allowed with argument -v/--verbose
|
|
368
|
+
```
|
|
369
|
+
|
|
370
|
+
Any parser should work fine, so long as each of the parser's arguments has a corresponding parameter in the decorated main function. The order of parameters doesn't matter, as long as they are all present. Note that when using a custom parser, autocommand doesn't modify the parser or the retrieved arguments. This means that no description/epilog will be added, and the function's type annotations and defaults (if present) will be ignored.
|
|
371
|
+
|
|
372
|
+
## Testing and Library use
|
|
373
|
+
|
|
374
|
+
The decorated function is only called and exited from if the first argument to `autocommand` is `'__main__'` or `True`. If it is neither of these values, or no argument is given, then a new main function is created by the decorator. This function has the signature `main(argv=None)`, and is intended to be called with arguments as if via `main(sys.argv[1:])`. The function has the attributes `parser` and `main`, which are the generated `ArgumentParser` and the original main function that was decorated. This is to facilitate testing and library use of your main. Calling the function triggers a `parse_args()` with the supplied arguments, and returns the result of the main function. Note that, while it returns instead of calling `sys.exit`, the `parse_args()` function will raise a `SystemExit` in the event of a parsing error or `-h/--help` argument.
|
|
375
|
+
|
|
376
|
+
```python
|
|
377
|
+
@autocommand()
|
|
378
|
+
def test_prog(arg1, arg2: int, quiet=False, verbose=False):
|
|
379
|
+
if not quiet:
|
|
380
|
+
print(arg1, arg2)
|
|
381
|
+
if verbose:
|
|
382
|
+
print("LOUD NOISES")
|
|
383
|
+
|
|
384
|
+
return 0
|
|
385
|
+
|
|
386
|
+
print(test_prog(['-v', 'hello', '80']))
|
|
387
|
+
```
|
|
388
|
+
|
|
389
|
+
```
|
|
390
|
+
$ python test_prog.py
|
|
391
|
+
hello 80
|
|
392
|
+
LOUD NOISES
|
|
393
|
+
0
|
|
394
|
+
```
|
|
395
|
+
|
|
396
|
+
If the function is called with no arguments, `sys.argv[1:]` is used. This is to allow the autocommand function to be used as a setuptools entry point.
|
|
397
|
+
|
|
398
|
+
## Exceptions and limitations
|
|
399
|
+
|
|
400
|
+
- There are a few possible exceptions that `autocommand` can raise. All of them derive from `autocommand.AutocommandError`.
|
|
401
|
+
|
|
402
|
+
- If an invalid annotation is given (that is, it isn't a `type`, `str`, `(type, str)`, or `(str, type)`, an `AnnotationError` is raised. The `type` may be any callable, as described in the `Types`_ section.
|
|
403
|
+
- If the function has a `**kwargs` parameter, a `KWargError` is raised.
|
|
404
|
+
- If, somehow, the function has a positional-only parameter, a `PositionalArgError` is raised. This means that the argument doesn't have a name, which is currently not possible with a plain `def` or `lambda`, though many built-in functions have this kind of parameter.
|
|
405
|
+
|
|
406
|
+
- There are a few argparse features that are not supported by autocommand.
|
|
407
|
+
|
|
408
|
+
- It isn't possible to have an optional positional argument (as opposed to a `--option`). POSIX thinks this is bad form anyway.
|
|
409
|
+
- It isn't possible to have mutually exclusive arguments or options
|
|
410
|
+
- It isn't possible to have subcommands or subparsers, though I'm working on a few solutions involving classes or nested function definitions to allow this.
|
|
411
|
+
|
|
412
|
+
## Development
|
|
413
|
+
|
|
414
|
+
Autocommand cannot be important from the project root; this is to enforce separation of concerns and prevent accidental importing of `setup.py` or tests. To develop, install the project in editable mode:
|
|
415
|
+
|
|
416
|
+
```
|
|
417
|
+
$ python setup.py develop
|
|
418
|
+
```
|
|
419
|
+
|
|
420
|
+
This will create a link to the source files in the deployment directory, so that any source changes are reflected when it is imported.
|
package/payload/THIRD_PARTY_NOTICES/setuptools/_vendor/backports.tarfile-1.2.0.dist-info/LICENSE
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
2
|
+
of this software and associated documentation files (the "Software"), to
|
|
3
|
+
deal in the Software without restriction, including without limitation the
|
|
4
|
+
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
|
5
|
+
sell copies of the Software, and to permit persons to whom the Software is
|
|
6
|
+
furnished to do so, subject to the following conditions:
|
|
7
|
+
|
|
8
|
+
The above copyright notice and this permission notice shall be included in
|
|
9
|
+
all copies or substantial portions of the Software.
|
|
10
|
+
|
|
11
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
12
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
13
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
14
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
15
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
16
|
+
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
|
17
|
+
IN THE SOFTWARE.
|
package/payload/THIRD_PARTY_NOTICES/setuptools/_vendor/backports.tarfile-1.2.0.dist-info/METADATA
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: backports.tarfile
|
|
3
|
+
Version: 1.2.0
|
|
4
|
+
Summary: Backport of CPython tarfile module
|
|
5
|
+
Author-email: "Jason R. Coombs" <jaraco@jaraco.com>
|
|
6
|
+
Project-URL: Homepage, https://github.com/jaraco/backports.tarfile
|
|
7
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
8
|
+
Classifier: Intended Audience :: Developers
|
|
9
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
10
|
+
Classifier: Programming Language :: Python :: 3
|
|
11
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
12
|
+
Requires-Python: >=3.8
|
|
13
|
+
Description-Content-Type: text/x-rst
|
|
14
|
+
License-File: LICENSE
|
|
15
|
+
Provides-Extra: docs
|
|
16
|
+
Requires-Dist: sphinx >=3.5 ; extra == 'docs'
|
|
17
|
+
Requires-Dist: jaraco.packaging >=9.3 ; extra == 'docs'
|
|
18
|
+
Requires-Dist: rst.linker >=1.9 ; extra == 'docs'
|
|
19
|
+
Requires-Dist: furo ; extra == 'docs'
|
|
20
|
+
Requires-Dist: sphinx-lint ; extra == 'docs'
|
|
21
|
+
Provides-Extra: testing
|
|
22
|
+
Requires-Dist: pytest !=8.1.*,>=6 ; extra == 'testing'
|
|
23
|
+
Requires-Dist: pytest-checkdocs >=2.4 ; extra == 'testing'
|
|
24
|
+
Requires-Dist: pytest-cov ; extra == 'testing'
|
|
25
|
+
Requires-Dist: pytest-enabler >=2.2 ; extra == 'testing'
|
|
26
|
+
Requires-Dist: jaraco.test ; extra == 'testing'
|
|
27
|
+
Requires-Dist: pytest !=8.0.* ; extra == 'testing'
|
|
28
|
+
|
|
29
|
+
.. image:: https://img.shields.io/pypi/v/backports.tarfile.svg
|
|
30
|
+
:target: https://pypi.org/project/backports.tarfile
|
|
31
|
+
|
|
32
|
+
.. image:: https://img.shields.io/pypi/pyversions/backports.tarfile.svg
|
|
33
|
+
|
|
34
|
+
.. image:: https://github.com/jaraco/backports.tarfile/actions/workflows/main.yml/badge.svg
|
|
35
|
+
:target: https://github.com/jaraco/backports.tarfile/actions?query=workflow%3A%22tests%22
|
|
36
|
+
:alt: tests
|
|
37
|
+
|
|
38
|
+
.. image:: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/charliermarsh/ruff/main/assets/badge/v2.json
|
|
39
|
+
:target: https://github.com/astral-sh/ruff
|
|
40
|
+
:alt: Ruff
|
|
41
|
+
|
|
42
|
+
.. .. image:: https://readthedocs.org/projects/backportstarfile/badge/?version=latest
|
|
43
|
+
.. :target: https://backportstarfile.readthedocs.io/en/latest/?badge=latest
|
|
44
|
+
|
|
45
|
+
.. image:: https://img.shields.io/badge/skeleton-2024-informational
|
|
46
|
+
:target: https://blog.jaraco.com/skeleton
|