lib-cli-exit-tools 2.3.0__py3-none-any.whl → 2.3.2__py3-none-any.whl
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.
- lib_cli_exit_tools/__init__conf__.py +1 -1
- lib_cli_exit_tools/application/runner.py +3 -3
- lib_cli_exit_tools/cli/group.py +3 -2
- lib_cli_exit_tools/cli/styling.py +2 -2
- lib_cli_exit_tools/cli/typed_click.py +29 -0
- lib_cli_exit_tools/core/configuration.py +2 -2
- {lib_cli_exit_tools-2.3.0.dist-info → lib_cli_exit_tools-2.3.2.dist-info}/METADATA +20 -16
- {lib_cli_exit_tools-2.3.0.dist-info → lib_cli_exit_tools-2.3.2.dist-info}/RECORD +11 -10
- {lib_cli_exit_tools-2.3.0.dist-info → lib_cli_exit_tools-2.3.2.dist-info}/WHEEL +1 -1
- {lib_cli_exit_tools-2.3.0.dist-info → lib_cli_exit_tools-2.3.2.dist-info}/entry_points.txt +0 -0
- {lib_cli_exit_tools-2.3.0.dist-info → lib_cli_exit_tools-2.3.2.dist-info}/licenses/LICENSE +0 -0
|
@@ -24,7 +24,7 @@ name = "lib_cli_exit_tools"
|
|
|
24
24
|
#: Human-readable summary shown in CLI help output.
|
|
25
25
|
title = "CLI exit handling helpers: clean signals, exit codes, and error printing"
|
|
26
26
|
#: Current release version pulled from ``pyproject.toml`` by automation.
|
|
27
|
-
version = "2.3.
|
|
27
|
+
version = "2.3.2"
|
|
28
28
|
#: Repository homepage presented to users.
|
|
29
29
|
homepage = "https://github.com/bitranox/lib_cli_exit_tools"
|
|
30
30
|
#: Author attribution surfaced in CLI output.
|
|
@@ -20,7 +20,7 @@ from __future__ import annotations
|
|
|
20
20
|
|
|
21
21
|
import sys
|
|
22
22
|
from contextlib import contextmanager, nullcontext, suppress
|
|
23
|
-
from typing import Callable, ContextManager,
|
|
23
|
+
from typing import Callable, ContextManager, Generator, Iterable, Literal, Protocol, Sequence, TextIO, TypedDict, cast
|
|
24
24
|
|
|
25
25
|
import rich_click as click
|
|
26
26
|
from rich_click import rich_click as rich_config
|
|
@@ -461,7 +461,7 @@ def cli_session(
|
|
|
461
461
|
verbose_limit: int = 10_000,
|
|
462
462
|
overrides: SessionOverrides | None = None,
|
|
463
463
|
restore: bool = True,
|
|
464
|
-
) ->
|
|
464
|
+
) -> Generator[
|
|
465
465
|
Callable[
|
|
466
466
|
[
|
|
467
467
|
ClickCommand,
|
|
@@ -571,7 +571,7 @@ def _session_config_manager(applied: SessionOverrides, restore: bool) -> Context
|
|
|
571
571
|
|
|
572
572
|
|
|
573
573
|
@contextmanager
|
|
574
|
-
def _apply_overrides_without_restore(applied: SessionOverrides) ->
|
|
574
|
+
def _apply_overrides_without_restore(applied: SessionOverrides) -> Generator[None]:
|
|
575
575
|
"""Apply overrides without restoring prior state on exit.
|
|
576
576
|
|
|
577
577
|
Parameters:
|
lib_cli_exit_tools/cli/group.py
CHANGED
|
@@ -23,6 +23,7 @@ from .. import __init__conf__
|
|
|
23
23
|
from .. import lib_cli_exit_tools
|
|
24
24
|
from .commands import CLICK_CONTEXT_SETTINGS
|
|
25
25
|
from .styling import _temporary_rich_click_configuration # pyright: ignore[reportPrivateUsage]
|
|
26
|
+
from .typed_click import option, version_option
|
|
26
27
|
|
|
27
28
|
|
|
28
29
|
@dataclass
|
|
@@ -41,12 +42,12 @@ class CliContextState:
|
|
|
41
42
|
|
|
42
43
|
|
|
43
44
|
@click.group(help=__init__conf__.title, context_settings=CLICK_CONTEXT_SETTINGS)
|
|
44
|
-
@
|
|
45
|
+
@version_option(
|
|
45
46
|
version=__init__conf__.version,
|
|
46
47
|
prog_name=__init__conf__.shell_command,
|
|
47
48
|
message=f"{__init__conf__.shell_command} version {__init__conf__.version}",
|
|
48
49
|
)
|
|
49
|
-
@
|
|
50
|
+
@option(
|
|
50
51
|
"--traceback/--no-traceback",
|
|
51
52
|
is_flag=True,
|
|
52
53
|
default=False,
|
|
@@ -16,7 +16,7 @@ System Integration:
|
|
|
16
16
|
from __future__ import annotations
|
|
17
17
|
|
|
18
18
|
from contextlib import contextmanager
|
|
19
|
-
from typing import Any,
|
|
19
|
+
from typing import Any, Generator, TypedDict
|
|
20
20
|
|
|
21
21
|
import rich_click as click
|
|
22
22
|
from rich_click import rich_click as rich_config
|
|
@@ -97,7 +97,7 @@ def _restore_rich_click_options(snapshot: RichClickSnapshot) -> None:
|
|
|
97
97
|
|
|
98
98
|
|
|
99
99
|
@contextmanager
|
|
100
|
-
def _temporary_rich_click_configuration() ->
|
|
100
|
+
def _temporary_rich_click_configuration() -> Generator[None]: # pyright: ignore[reportUnusedFunction]
|
|
101
101
|
"""Apply plain-output safeguards and restore rich-click globals afterwards."""
|
|
102
102
|
|
|
103
103
|
snapshot = _snapshot_rich_click_options()
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"""Strictly-typed wrappers for rich_click decorators with partially-unknown types.
|
|
2
|
+
|
|
3
|
+
rich_click ships ``py.typed`` but re-exports click's decorators, whose
|
|
4
|
+
``ParamType[Unknown]`` parameters make pyright (strict mode) report
|
|
5
|
+
``reportUnknownMemberType`` at every call site. Wrapping the affected decorators
|
|
6
|
+
here behind explicit, fully-known signatures keeps the rest of the code
|
|
7
|
+
strict-clean without disabling the rule. This module is the single boundary that
|
|
8
|
+
touches the untyped surface, so the only ``# pyright: ignore`` for this gap lives here.
|
|
9
|
+
"""
|
|
10
|
+
|
|
11
|
+
from collections.abc import Callable
|
|
12
|
+
from typing import Any
|
|
13
|
+
|
|
14
|
+
import rich_click as click
|
|
15
|
+
|
|
16
|
+
_CommandDecorator = Callable[[Callable[..., Any]], Callable[..., Any]]
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
def option(*param_decls: str, **attrs: Any) -> _CommandDecorator:
|
|
20
|
+
"""Typed wrapper over :func:`rich_click.option`. See module docstring."""
|
|
21
|
+
return click.option(*param_decls, **attrs) # pyright: ignore[reportUnknownMemberType]
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
def version_option(*param_decls: str, **attrs: Any) -> _CommandDecorator:
|
|
25
|
+
"""Typed wrapper over :func:`rich_click.version_option`. See module docstring."""
|
|
26
|
+
return click.version_option(*param_decls, **attrs) # pyright: ignore[reportUnknownMemberType]
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
__all__ = ["option", "version_option"]
|
|
@@ -20,7 +20,7 @@ System Integration:
|
|
|
20
20
|
|
|
21
21
|
from __future__ import annotations
|
|
22
22
|
|
|
23
|
-
from collections.abc import
|
|
23
|
+
from collections.abc import Generator, Mapping
|
|
24
24
|
from contextlib import contextmanager
|
|
25
25
|
from dataclasses import dataclass, fields
|
|
26
26
|
from enum import Enum
|
|
@@ -156,7 +156,7 @@ def reset_config() -> None:
|
|
|
156
156
|
|
|
157
157
|
|
|
158
158
|
@contextmanager
|
|
159
|
-
def config_overrides(**overrides: object) ->
|
|
159
|
+
def config_overrides(**overrides: object) -> Generator[_Config]:
|
|
160
160
|
"""Snapshot configuration state and optionally apply temporary overrides."""
|
|
161
161
|
|
|
162
162
|
_reject_unknown_fields(overrides)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: lib_cli_exit_tools
|
|
3
|
-
Version: 2.3.
|
|
3
|
+
Version: 2.3.2
|
|
4
4
|
Summary: CLI exit handling helpers: clean signals, exit codes, and error printing
|
|
5
5
|
Project-URL: Homepage, https://github.com/bitranox/lib_cli_exit_tools
|
|
6
6
|
Project-URL: Repository, https://github.com/bitranox/lib_cli_exit_tools.git
|
|
@@ -14,24 +14,29 @@ Classifier: License :: OSI Approved :: MIT License
|
|
|
14
14
|
Classifier: Operating System :: OS Independent
|
|
15
15
|
Classifier: Programming Language :: Python :: 3
|
|
16
16
|
Classifier: Programming Language :: Python :: 3 :: Only
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
17
22
|
Classifier: Typing :: Typed
|
|
18
23
|
Requires-Python: >=3.10
|
|
19
|
-
Requires-Dist: rich-click>=1.9.
|
|
24
|
+
Requires-Dist: rich-click>=1.9.8
|
|
20
25
|
Provides-Extra: dev
|
|
21
|
-
Requires-Dist: bandit>=1.9.
|
|
22
|
-
Requires-Dist: build>=1.
|
|
23
|
-
Requires-Dist: codecov-cli>=11.2.
|
|
24
|
-
Requires-Dist: coverage[toml]>=7.
|
|
25
|
-
Requires-Dist: hypothesis>=6.
|
|
26
|
-
Requires-Dist: import-linter>=2.
|
|
27
|
-
Requires-Dist: pip-audit>=2.10.
|
|
28
|
-
Requires-Dist: pyright[nodejs]>=1.1.
|
|
29
|
-
Requires-Dist: pytest-asyncio>=1.
|
|
30
|
-
Requires-Dist: pytest-cov>=7.
|
|
31
|
-
Requires-Dist: pytest>=9.0
|
|
26
|
+
Requires-Dist: bandit>=1.9.4; extra == 'dev'
|
|
27
|
+
Requires-Dist: build>=1.5.0; extra == 'dev'
|
|
28
|
+
Requires-Dist: codecov-cli>=11.2.8; extra == 'dev'
|
|
29
|
+
Requires-Dist: coverage[toml]>=7.14.1; extra == 'dev'
|
|
30
|
+
Requires-Dist: hypothesis>=6.155.2; extra == 'dev'
|
|
31
|
+
Requires-Dist: import-linter>=2.11; extra == 'dev'
|
|
32
|
+
Requires-Dist: pip-audit>=2.10.1; extra == 'dev'
|
|
33
|
+
Requires-Dist: pyright[nodejs]>=1.1.410; extra == 'dev'
|
|
34
|
+
Requires-Dist: pytest-asyncio>=1.4.0; extra == 'dev'
|
|
35
|
+
Requires-Dist: pytest-cov>=7.1.0; extra == 'dev'
|
|
36
|
+
Requires-Dist: pytest>=9.1.0; extra == 'dev'
|
|
32
37
|
Requires-Dist: rtoml>=0.13.0; extra == 'dev'
|
|
33
|
-
Requires-Dist: ruff>=0.15.
|
|
34
|
-
Requires-Dist: textual>=
|
|
38
|
+
Requires-Dist: ruff>=0.15.17; extra == 'dev'
|
|
39
|
+
Requires-Dist: textual>=8.2.7; extra == 'dev'
|
|
35
40
|
Requires-Dist: twine>=6.2.0; extra == 'dev'
|
|
36
41
|
Description-Content-Type: text/markdown
|
|
37
42
|
|
|
@@ -47,7 +52,6 @@ Description-Content-Type: text/markdown
|
|
|
47
52
|
[](https://docs.astral.sh/ruff/)
|
|
48
53
|
[](https://codecov.io/gh/bitranox/lib_cli_exit_tools)
|
|
49
54
|
[](https://qlty.sh/gh/bitranox/projects/lib_cli_exit_tools)
|
|
50
|
-
[](https://snyk.io/test/github/bitranox/lib_cli_exit_tools)
|
|
51
55
|
[](https://github.com/PyCQA/bandit)
|
|
52
56
|
|
|
53
57
|
Small helpers for robust CLI exit handling:
|
|
@@ -1,21 +1,22 @@
|
|
|
1
1
|
lib_cli_exit_tools/__init__.py,sha256=KzpZAMrc328V_nYm2GuTR0Sxyqh0XuKtlHP6dVCs2pc,1905
|
|
2
|
-
lib_cli_exit_tools/__init__conf__.py,sha256=
|
|
2
|
+
lib_cli_exit_tools/__init__conf__.py,sha256=PgIe-Fn7sU48afeTt7UWbyqPvIyHaU4YwECgRQ5fnbw,2521
|
|
3
3
|
lib_cli_exit_tools/__main__.py,sha256=wODJaNu_NyO7tknvlpPArq0MaDwDum8zqyb73-qshzo,257
|
|
4
4
|
lib_cli_exit_tools/lib_cli_exit_tools.py,sha256=fCLgJypLi6VHjmnh0McUn3CbhBhdzGYdDGcwcLokL4o,2561
|
|
5
5
|
lib_cli_exit_tools/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
6
6
|
lib_cli_exit_tools/adapters/__init__.py,sha256=Jj8FCGY1lAPAduYSW3wTDh8ojpr9BZms7wKEMPq8pWE,504
|
|
7
7
|
lib_cli_exit_tools/adapters/signals.py,sha256=Q2D9Htv64nsT5n66cJFDDHRWVXJokaG77I-V8gTDMKg,5772
|
|
8
8
|
lib_cli_exit_tools/application/__init__.py,sha256=Yikej3OOOaAjWOvFimg1jUYrCUGu5d3-RBiiai4tHDM,566
|
|
9
|
-
lib_cli_exit_tools/application/runner.py,sha256=
|
|
9
|
+
lib_cli_exit_tools/application/runner.py,sha256=Dz58vHqgKiGNNILRsQSlySCOiYdcpbf6gs67WEgbG_g,24416
|
|
10
10
|
lib_cli_exit_tools/cli/__init__.py,sha256=IVyU1DEgn2xBYfp1BBpund9nucUEPyOu7yt8DShu470,1094
|
|
11
11
|
lib_cli_exit_tools/cli/commands.py,sha256=WDF6hDsyczAb6cQp4fA6KMF1iqJQ1lzjv-RvIxq1itI,2418
|
|
12
|
-
lib_cli_exit_tools/cli/group.py,sha256=
|
|
13
|
-
lib_cli_exit_tools/cli/styling.py,sha256=
|
|
12
|
+
lib_cli_exit_tools/cli/group.py,sha256=nhMICASyfbAB1qDI9bwIHJ5IHxrGBf6uZOZSF3N97cg,4260
|
|
13
|
+
lib_cli_exit_tools/cli/styling.py,sha256=Q23pmmzq7GpPWWbqAXXrJrZoqt_xlJi4Q0gtSJiknBI,4238
|
|
14
|
+
lib_cli_exit_tools/cli/typed_click.py,sha256=xQJtl1EN2HC937N48i_z6P_6CdEpJXXDh_BUbzhNI9g,1249
|
|
14
15
|
lib_cli_exit_tools/core/__init__.py,sha256=aR7OIBWOQ1PsA33blOTgLrq5ffKDCuaMVBS5mbrDAZ8,531
|
|
15
|
-
lib_cli_exit_tools/core/configuration.py,sha256=
|
|
16
|
+
lib_cli_exit_tools/core/configuration.py,sha256=rv911nWmFPQmJczP_CDNXhJ_5eAJPSBmwYCPr5DN40U,6123
|
|
16
17
|
lib_cli_exit_tools/core/exit_codes.py,sha256=ukinlUROFKb6KmF_-8luxE1C2VJc6UwxIMMr0eB9xFg,12349
|
|
17
|
-
lib_cli_exit_tools-2.3.
|
|
18
|
-
lib_cli_exit_tools-2.3.
|
|
19
|
-
lib_cli_exit_tools-2.3.
|
|
20
|
-
lib_cli_exit_tools-2.3.
|
|
21
|
-
lib_cli_exit_tools-2.3.
|
|
18
|
+
lib_cli_exit_tools-2.3.2.dist-info/METADATA,sha256=VvvVEpr8HKXNcksi81PKNCzpkIJzkjJm8fYf69bKgbU,26339
|
|
19
|
+
lib_cli_exit_tools-2.3.2.dist-info/WHEEL,sha256=mffPy8wBnZQn2VnJUU5jE99KsxaSfiyMHV9Yt0aLVxs,87
|
|
20
|
+
lib_cli_exit_tools-2.3.2.dist-info/entry_points.txt,sha256=8R-_3UT0KcQ7HQ7idDx6rlG77GhHb0E2N5QnN41dj-M,161
|
|
21
|
+
lib_cli_exit_tools-2.3.2.dist-info/licenses/LICENSE,sha256=6s9SL2InRrwynPjJYiER7ONHBshbGj_yC5EBzfo7l9I,1072
|
|
22
|
+
lib_cli_exit_tools-2.3.2.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|