Name | clinspector JSON |
Version |
0.5.0
JSON |
| download |
home_page | None |
Summary | A library to parse CLI output into structured data. |
upload_time | 2025-10-06 20:27:51 |
maintainer | None |
docs_url | None |
author | Philipp Temminghoff |
requires_python | >=3.12 |
license | MIT License
Copyright (c) 2024, Philipp Temminghoff
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
|
keywords |
|
VCS |
 |
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# CLInspector
[](https://pypi.org/project/clinspector/)
[](https://pypi.org/project/clinspector/)
[](https://pypi.org/project/clinspector/)
[](https://pypi.org/project/clinspector/)
[](https://pypi.org/project/clinspector/)
[](https://pypi.org/project/clinspector/)
[](https://pypi.org/project/clinspector/)
[](https://github.com/phil65/clinspector/releases)
[](https://github.com/phil65/clinspector/graphs/contributors)
[](https://github.com/phil65/clinspector/discussions)
[](https://github.com/phil65/clinspector/forks)
[](https://github.com/phil65/clinspector/issues)
[](https://github.com/phil65/clinspector/pulls)
[](https://github.com/phil65/clinspector/watchers)
[](https://github.com/phil65/clinspector/stars)
[](https://github.com/phil65/clinspector)
[](https://github.com/phil65/clinspector/commits)
[](https://github.com/phil65/clinspector/releases)
[](https://github.com/phil65/clinspector)
[](https://github.com/phil65/clinspector)
[](https://codecov.io/gh/phil65/clinspector/)
[](https://pyup.io/repos/github/phil65/clinspector/)
[Read the documentation!](https://phil65.github.io/clinspector/)
# CLInspector Documentation
CLInspector is a library to introspect Python CLI applications and extract their command structure and parameters programmatically.
## Usage
The main entry point is the `get_cmd_info()` function which analyzes a CLI application instance and returns a structured `CommandInfo` object:
```python
from clinspector import get_cmd_info
command_info = get_cmd_info(cli_instance)
```
The function accepts CLI application instances from the following frameworks:
- [Typer](https://typer.tiangolo.com/) - `typer.Typer` instances
- [Click](https://click.palletsprojects.com/) - `click.Group` instances
- [Cleo](https://cleo.readthedocs.io/) - `cleo.Application` instances
- [Cappa](https://github.com/DynamicArray/Cappa) - Classes decorated with `@cappa.command`
- [argparse](https://docs.python.org/3/library/argparse.html) - `ArgumentParser` instances
The extracted information is returned as a `CommandInfo` object containing:
### CommandInfo Fields
- `name: str` - Name of the command
- `description: str` - Description/help text
- `usage: str` - Formatted usage string
- `subcommands: dict[str, CommandInfo]` - Nested subcommands
- `deprecated: bool` - Whether command is marked as deprecated
- `epilog: str | None` - Optional epilog text
- `hidden: bool` - Whether command is hidden
- `params: list[Param]` - List of command parameters
### Param Fields
- `name: str` - Parameter name
- `help: str | None` - Help text
- `default: Any` - Default value
- `opts: list[str]` - Parameter options (e.g. `["-f", "--flag"]`)
- `required: bool` - Whether parameter is required
- `is_flag: bool` - Whether parameter is a flag
- `multiple: bool` - Whether parameter accepts multiple values
- `nargs: int | str | None` - Number of arguments accepted
- `envvar: str | None` - Environment variable name
- `hidden: bool` - Whether parameter is hidden
- `param_type_name: Literal["option", "parameter", "argument"]` - Parameter type
- `type: dict[str, str] | None` - Parameter type information
- `metavar: str | None` - Display name in help text
You can access subcommands using dictionary syntax:
```python
# Get info for "build" subcommand
build_info = command_info["build"]
# Access nested subcommand
nested_info = command_info["group"]["subcommand"]
```
```
The extracted information allows you to:
- Generate documentation automatically
- Build command completion
- Create wrappers and adapters
- Perform static analysis of CLI interfaces
- And more!
Example output for a click command:
```python
CommandInfo(
name="cli",
description="Example CLI tool",
usage="cli [OPTIONS] COMMAND [ARGS]...",
params=[
Param(name="verbose", help="Enable verbose output", opts=["-v", "--verbose"])
],
subcommands={
"build": CommandInfo(
name="build",
description="Build the project",
params=[...]
)
}
)
```
Raw data
{
"_id": null,
"home_page": null,
"name": "clinspector",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.12",
"maintainer_email": null,
"keywords": null,
"author": "Philipp Temminghoff",
"author_email": "Philipp Temminghoff <philipptemminghoff@googlemail.com>",
"download_url": "https://files.pythonhosted.org/packages/45/86/bd16e1c585b46af3b961aca4f2c06d7e877b03cea29ca86831ed70823b33/clinspector-0.5.0.tar.gz",
"platform": null,
"description": "# CLInspector\n\n[](https://pypi.org/project/clinspector/)\n[](https://pypi.org/project/clinspector/)\n[](https://pypi.org/project/clinspector/)\n[](https://pypi.org/project/clinspector/)\n[](https://pypi.org/project/clinspector/)\n[](https://pypi.org/project/clinspector/)\n[](https://pypi.org/project/clinspector/)\n[](https://github.com/phil65/clinspector/releases)\n[](https://github.com/phil65/clinspector/graphs/contributors)\n[](https://github.com/phil65/clinspector/discussions)\n[](https://github.com/phil65/clinspector/forks)\n[](https://github.com/phil65/clinspector/issues)\n[](https://github.com/phil65/clinspector/pulls)\n[](https://github.com/phil65/clinspector/watchers)\n[](https://github.com/phil65/clinspector/stars)\n[](https://github.com/phil65/clinspector)\n[](https://github.com/phil65/clinspector/commits)\n[](https://github.com/phil65/clinspector/releases)\n[](https://github.com/phil65/clinspector)\n[](https://github.com/phil65/clinspector)\n[](https://codecov.io/gh/phil65/clinspector/)\n[](https://pyup.io/repos/github/phil65/clinspector/)\n\n[Read the documentation!](https://phil65.github.io/clinspector/)\n\n# CLInspector Documentation\n\nCLInspector is a library to introspect Python CLI applications and extract their command structure and parameters programmatically.\n\n## Usage\n\nThe main entry point is the `get_cmd_info()` function which analyzes a CLI application instance and returns a structured `CommandInfo` object:\n\n```python\nfrom clinspector import get_cmd_info\n\ncommand_info = get_cmd_info(cli_instance)\n```\n\nThe function accepts CLI application instances from the following frameworks:\n\n- [Typer](https://typer.tiangolo.com/) - `typer.Typer` instances\n- [Click](https://click.palletsprojects.com/) - `click.Group` instances\n- [Cleo](https://cleo.readthedocs.io/) - `cleo.Application` instances\n- [Cappa](https://github.com/DynamicArray/Cappa) - Classes decorated with `@cappa.command`\n- [argparse](https://docs.python.org/3/library/argparse.html) - `ArgumentParser` instances\n\nThe extracted information is returned as a `CommandInfo` object containing:\n\n### CommandInfo Fields\n\n- `name: str` - Name of the command\n- `description: str` - Description/help text\n- `usage: str` - Formatted usage string\n- `subcommands: dict[str, CommandInfo]` - Nested subcommands\n- `deprecated: bool` - Whether command is marked as deprecated\n- `epilog: str | None` - Optional epilog text\n- `hidden: bool` - Whether command is hidden\n- `params: list[Param]` - List of command parameters\n\n### Param Fields\n\n- `name: str` - Parameter name\n- `help: str | None` - Help text\n- `default: Any` - Default value\n- `opts: list[str]` - Parameter options (e.g. `[\"-f\", \"--flag\"]`)\n- `required: bool` - Whether parameter is required\n- `is_flag: bool` - Whether parameter is a flag\n- `multiple: bool` - Whether parameter accepts multiple values\n- `nargs: int | str | None` - Number of arguments accepted\n- `envvar: str | None` - Environment variable name\n- `hidden: bool` - Whether parameter is hidden\n- `param_type_name: Literal[\"option\", \"parameter\", \"argument\"]` - Parameter type\n- `type: dict[str, str] | None` - Parameter type information\n- `metavar: str | None` - Display name in help text\n\nYou can access subcommands using dictionary syntax:\n\n```python\n# Get info for \"build\" subcommand\nbuild_info = command_info[\"build\"]\n\n# Access nested subcommand\nnested_info = command_info[\"group\"][\"subcommand\"]\n```\n```\n\nThe extracted information allows you to:\n\n- Generate documentation automatically\n- Build command completion\n- Create wrappers and adapters\n- Perform static analysis of CLI interfaces\n- And more!\n\nExample output for a click command:\n\n```python\nCommandInfo(\n name=\"cli\",\n description=\"Example CLI tool\",\n usage=\"cli [OPTIONS] COMMAND [ARGS]...\",\n params=[\n Param(name=\"verbose\", help=\"Enable verbose output\", opts=[\"-v\", \"--verbose\"])\n ],\n subcommands={\n \"build\": CommandInfo(\n name=\"build\",\n description=\"Build the project\",\n params=[...]\n )\n }\n)\n```\n",
"bugtrack_url": null,
"license": "MIT License\n \n Copyright (c) 2024, Philipp Temminghoff\n \n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"), to deal\n in the Software without restriction, including without limitation the rights\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n \n The above copyright notice and this permission notice shall be included in all\n copies or substantial portions of the Software.\n \n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n SOFTWARE.\n ",
"summary": "A library to parse CLI output into structured data.",
"version": "0.5.0",
"project_urls": {
"Code coverage": "https://app.codecov.io/gh/phil65/clinspector",
"Discussions": "https://github.com/phil65/clinspector/discussions",
"Documentation": "https://phil65.github.io/clinspector/",
"Issues": "https://github.com/phil65/clinspector/issues",
"Source": "https://github.com/phil65/clinspector"
},
"split_keywords": [],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "518f13c8699830c7c265c91f2446f3b8f942f76749ab08d4e4622f3e381d6c23",
"md5": "8e9c795f5914700e8ea4bcac38caec87",
"sha256": "5f57d14a47963bcf3d65a8b78b55332e9a955b19ebb28563a0aaa2ae0ae14fbe"
},
"downloads": -1,
"filename": "clinspector-0.5.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "8e9c795f5914700e8ea4bcac38caec87",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.12",
"size": 32862,
"upload_time": "2025-10-06T20:27:50",
"upload_time_iso_8601": "2025-10-06T20:27:50.534613Z",
"url": "https://files.pythonhosted.org/packages/51/8f/13c8699830c7c265c91f2446f3b8f942f76749ab08d4e4622f3e381d6c23/clinspector-0.5.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "4586bd16e1c585b46af3b961aca4f2c06d7e877b03cea29ca86831ed70823b33",
"md5": "53fca6b60e340ada7fd87d75c2b0c9d8",
"sha256": "05b6c6fe4a036ce7a2a63bce8f3a1df4a71c724c958ffab966f6810290af19bd"
},
"downloads": -1,
"filename": "clinspector-0.5.0.tar.gz",
"has_sig": false,
"md5_digest": "53fca6b60e340ada7fd87d75c2b0c9d8",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.12",
"size": 23591,
"upload_time": "2025-10-06T20:27:51",
"upload_time_iso_8601": "2025-10-06T20:27:51.872390Z",
"url": "https://files.pythonhosted.org/packages/45/86/bd16e1c585b46af3b961aca4f2c06d7e877b03cea29ca86831ed70823b33/clinspector-0.5.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-10-06 20:27:51",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "phil65",
"github_project": "clinspector",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "clinspector"
}