keep-github-workflows-active 2.3.1__py3-none-any.whl → 2.3.3__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.
@@ -2,13 +2,13 @@
2
2
 
3
3
  from __future__ import annotations
4
4
 
5
+ from .__init__conf__ import print_info
5
6
  from .behaviors import (
6
7
  CANONICAL_GREETING,
7
8
  emit_greeting,
8
9
  noop_main,
9
10
  raise_intentional_failure,
10
11
  )
11
- from .__init__conf__ import print_info
12
12
 
13
13
  __all__ = [
14
14
  "CANONICAL_GREETING",
@@ -19,12 +19,14 @@ present authoritative project information without invoking packaging APIs.
19
19
 
20
20
  from __future__ import annotations
21
21
 
22
+ import sys
23
+
22
24
  #: Distribution name declared in ``pyproject.toml``.
23
25
  name = "keep_github_workflows_active"
24
26
  #: Human-readable summary shown in CLI help output.
25
27
  title = "Template for python apps with registered cli commands"
26
28
  #: Current release version pulled from ``pyproject.toml`` by automation.
27
- version = "2.3.1"
29
+ version = "2.3.3"
28
30
  #: Repository homepage presented to users.
29
31
  homepage = "https://github.com/bitranox/keep_github_workflows_active"
30
32
  #: Author attribution surfaced in CLI output.
@@ -71,4 +73,4 @@ def print_info() -> None:
71
73
  pad = max(len(label) for label, _ in fields)
72
74
  lines = [f"Info for {name}:", ""]
73
75
  lines.extend(f" {label.ljust(pad)} = {value}" for label, value in fields)
74
- print("\n".join(lines))
76
+ sys.stdout.write("\n".join(lines) + "\n")
@@ -9,10 +9,10 @@ installed console script, including traceback handling and exit-code mapping.
9
9
 
10
10
  Contents
11
11
  --------
12
- * :func:`_open_cli_session` – wires ``cli_session`` with the agreed limits.
13
- * :func:`_command_to_run` / :func:`_command_name` – expose the command and label
12
+ * :func:`_open_cli_session` - wires ``cli_session`` with the agreed limits.
13
+ * :func:`_command_to_run` / :func:`_command_name` - expose the command and label
14
14
  used by the module entry.
15
- * :func:`_module_main` – drives execution and returns the exit code.
15
+ * :func:`_module_main` - drives execution and returns the exit code.
16
16
 
17
17
  System Role
18
18
  -----------
@@ -24,14 +24,17 @@ documented in ``docs/systemdesign/module_reference.md``.
24
24
  from __future__ import annotations
25
25
 
26
26
  from collections.abc import Callable
27
- from contextlib import AbstractContextManager
28
- from typing import Final
27
+ from typing import TYPE_CHECKING, Final
29
28
 
30
29
  from lib_cli_exit_tools import cli_session
31
- import rich_click as click
32
30
 
33
31
  from . import __init__conf__, cli
34
32
 
33
+ if TYPE_CHECKING:
34
+ from contextlib import AbstractContextManager
35
+
36
+ import rich_click as click
37
+
35
38
  # Match the CLI defaults so truncation behaviour stays consistent across entry
36
39
  # points regardless of whether users call the console script or ``python -m``.
37
40
  #: Character budget for truncated tracebacks when running via module entry.
@@ -8,11 +8,11 @@ swap in richer logging logic later without touching the transport surface.
8
8
 
9
9
  Contents
10
10
  --------
11
- * :func:`emit_greeting` – success-path helper that writes the canonical scaffold
11
+ * :func:`emit_greeting` - success-path helper that writes the canonical scaffold
12
12
  message.
13
- * :func:`raise_intentional_failure` – deterministic error hook used by tests and
13
+ * :func:`raise_intentional_failure` - deterministic error hook used by tests and
14
14
  CLI flows to validate traceback handling.
15
- * :func:`noop_main` – placeholder entry used when callers expect a ``main``
15
+ * :func:`noop_main` - placeholder entry used when callers expect a ``main``
16
16
  callable despite the domain layer being stubbed today.
17
17
 
18
18
  System Role
@@ -24,10 +24,8 @@ features evolve.
24
24
 
25
25
  from __future__ import annotations
26
26
 
27
- from typing import TextIO
28
-
29
27
  import sys
30
-
28
+ from typing import TextIO
31
29
 
32
30
  CANONICAL_GREETING = "Hello World"
33
31
 
@@ -140,6 +138,6 @@ def noop_main() -> None:
140
138
  __all__ = [
141
139
  "CANONICAL_GREETING",
142
140
  "emit_greeting",
143
- "raise_intentional_failure",
144
141
  "noop_main",
142
+ "raise_intentional_failure",
145
143
  ]
@@ -10,23 +10,23 @@ aligned with the Clean Code rules captured in
10
10
 
11
11
  Contents
12
12
  --------
13
- * :data:`CLICK_CONTEXT_SETTINGS` – shared Click settings ensuring consistent
13
+ * :data:`CLICK_CONTEXT_SETTINGS` - shared Click settings ensuring consistent
14
14
  ``--help`` behavior across commands.
15
- * :func:`apply_traceback_preferences` – helper that synchronises the shared
15
+ * :func:`apply_traceback_preferences` - helper that synchronises the shared
16
16
  traceback configuration flags.
17
- * :func:`snapshot_traceback_state` / :func:`restore_traceback_state` – utilities
17
+ * :func:`snapshot_traceback_state` / :func:`restore_traceback_state` - utilities
18
18
  for preserving and reapplying the global traceback preference.
19
- * :func:`cli` – root command group wiring the global options.
20
- * :func:`cli_main` – default action when no subcommand is provided.
21
- * :func:`cli_info`, :func:`cli_hello`, :func:`cli_fail` – subcommands covering
19
+ * :func:`cli` - root command group wiring the global options.
20
+ * :func:`cli_main` - default action when no subcommand is provided.
21
+ * :func:`cli_info`, :func:`cli_hello`, :func:`cli_fail` - subcommands covering
22
22
  metadata printing, success path, and failure path.
23
- * :func:`_record_traceback_choice`, :func:`_announce_traceback_choice` – persist
23
+ * :func:`_record_traceback_choice`, :func:`_announce_traceback_choice` - persist
24
24
  traceback preferences across context and shared tooling.
25
25
  * :func:`_invoke_cli`, :func:`_current_traceback_mode`, :func:`_traceback_limit`,
26
- :func:`_print_exception`, :func:`_run_cli_via_exit_tools` – isolate the error
26
+ :func:`_print_exception`, :func:`_run_cli_via_exit_tools` - isolate the error
27
27
  handling and delegation path.
28
- * :func:`_restore_when_requested` – restores tracebacks when ``main`` finishes.
29
- * :func:`main` – composition helper delegating to ``lib_cli_exit_tools`` while
28
+ * :func:`_restore_when_requested` - restores tracebacks when ``main`` finishes.
29
+ * :func:`main` - composition helper delegating to ``lib_cli_exit_tools`` while
30
30
  honouring the shared traceback preferences.
31
31
 
32
32
  System Role
@@ -39,19 +39,20 @@ behaviour remains consistent regardless of entry point.
39
39
 
40
40
  from __future__ import annotations
41
41
 
42
- from collections.abc import Sequence
43
42
  from dataclasses import dataclass
44
- from typing import Final, NamedTuple
45
-
46
- import rich_click as click
43
+ from typing import TYPE_CHECKING, Final, NamedTuple
47
44
 
48
45
  import lib_cli_exit_tools
46
+ import rich_click as click
49
47
  from click.core import ParameterSource
50
48
 
51
49
  from . import __init__conf__
52
50
  from . import keep_github_workflow_active as keep_active
53
51
  from .behaviors import emit_greeting, noop_main, raise_intentional_failure
52
+ from .typed_click import option, version_option
54
53
 
54
+ if TYPE_CHECKING:
55
+ from collections.abc import Sequence
55
56
 
56
57
  # =============================================================================
57
58
  # Dataclass for typed Click context object
@@ -94,7 +95,7 @@ def _fallback_token(token: str | None) -> str:
94
95
  raise click.ClickException(str(exc)) from exc
95
96
 
96
97
 
97
- def apply_traceback_preferences(enabled: bool) -> None:
98
+ def apply_traceback_preferences(*, enabled: bool) -> None:
98
99
  """Synchronise shared traceback flags with the requested preference.
99
100
 
100
101
  Why
@@ -111,7 +112,7 @@ def apply_traceback_preferences(enabled: bool) -> None:
111
112
 
112
113
  Examples
113
114
  --------
114
- >>> apply_traceback_preferences(True)
115
+ >>> apply_traceback_preferences(enabled=True)
115
116
  >>> bool(lib_cli_exit_tools.config.traceback)
116
117
  True
117
118
  >>> bool(lib_cli_exit_tools.config.traceback_force_color)
@@ -154,7 +155,7 @@ def restore_traceback_state(state: TracebackState) -> None:
154
155
  Examples
155
156
  --------
156
157
  >>> prev = snapshot_traceback_state()
157
- >>> apply_traceback_preferences(True)
158
+ >>> apply_traceback_preferences(enabled=True)
158
159
  >>> restore_traceback_state(prev)
159
160
  >>> snapshot_traceback_state() == prev
160
161
  True
@@ -191,7 +192,7 @@ def _record_traceback_choice(ctx: click.Context, *, enabled: bool) -> None:
191
192
  ctx.obj.traceback = enabled
192
193
 
193
194
 
194
- def _announce_traceback_choice(enabled: bool) -> None:
195
+ def _announce_traceback_choice(*, enabled: bool) -> None:
195
196
  """Keep ``lib_cli_exit_tools`` in sync with the selected traceback mode.
196
197
 
197
198
  Why
@@ -207,7 +208,7 @@ def _announce_traceback_choice(enabled: bool) -> None:
207
208
  Mutates ``lib_cli_exit_tools.config``.
208
209
  """
209
210
 
210
- apply_traceback_preferences(enabled)
211
+ apply_traceback_preferences(enabled=enabled)
211
212
 
212
213
 
213
214
  def _no_subcommand_requested(ctx: click.Context) -> bool:
@@ -269,7 +270,7 @@ def _current_traceback_mode() -> bool:
269
270
  return bool(getattr(lib_cli_exit_tools.config, "traceback", False))
270
271
 
271
272
 
272
- def _traceback_limit(tracebacks_enabled: bool, *, summary_limit: int, verbose_limit: int) -> int:
273
+ def _traceback_limit(*, tracebacks_enabled: bool, summary_limit: int, verbose_limit: int) -> int:
273
274
  """Return the character budget that matches the current traceback mode.
274
275
 
275
276
  Why
@@ -378,14 +379,14 @@ def _run_cli_via_exit_tools(
378
379
 
379
380
  try:
380
381
  return _invoke_cli(argv)
381
- except BaseException as exc: # noqa: BLE001 - handled by shared printers
382
+ except BaseException as exc:
382
383
  tracebacks_enabled = _current_traceback_mode()
383
- apply_traceback_preferences(tracebacks_enabled)
384
+ apply_traceback_preferences(enabled=tracebacks_enabled)
384
385
  return _print_exception(
385
386
  exc,
386
387
  tracebacks_enabled=tracebacks_enabled,
387
388
  length_limit=_traceback_limit(
388
- tracebacks_enabled,
389
+ tracebacks_enabled=tracebacks_enabled,
389
390
  summary_limit=summary_limit,
390
391
  verbose_limit=verbose_limit,
391
392
  ),
@@ -397,19 +398,19 @@ def _run_cli_via_exit_tools(
397
398
  context_settings=CLICK_CONTEXT_SETTINGS,
398
399
  invoke_without_command=True,
399
400
  )
400
- @click.version_option(
401
+ @version_option(
401
402
  version=__init__conf__.version,
402
403
  prog_name=__init__conf__.shell_command,
403
404
  message=f"{__init__conf__.shell_command} version {__init__conf__.version}",
404
405
  )
405
- @click.option(
406
+ @option(
406
407
  "--traceback/--no-traceback",
407
408
  is_flag=True,
408
409
  default=False,
409
410
  help="Show full Python traceback on errors",
410
411
  )
411
412
  @click.pass_context
412
- def cli(ctx: click.Context, traceback: bool) -> None:
413
+ def cli(ctx: click.Context, *, traceback: bool) -> None:
413
414
  """Root command storing global flags and syncing shared traceback state.
414
415
 
415
416
  Why
@@ -440,7 +441,7 @@ def cli(ctx: click.Context, traceback: bool) -> None:
440
441
  """
441
442
 
442
443
  _record_traceback_choice(ctx, enabled=traceback)
443
- _announce_traceback_choice(traceback)
444
+ _announce_traceback_choice(enabled=traceback)
444
445
  if _no_subcommand_requested(ctx):
445
446
  if _traceback_option_requested(ctx):
446
447
  cli_main()
@@ -489,12 +490,12 @@ def cli_fail() -> None:
489
490
 
490
491
 
491
492
  @cli.command("enable-all-workflows", context_settings=CLICK_CONTEXT_SETTINGS)
492
- @click.option(
493
+ @option(
493
494
  "--owner",
494
495
  metavar="OWNER",
495
496
  help="GitHub username owning the repositories (defaults to environment/.env)",
496
497
  )
497
- @click.option(
498
+ @option(
498
499
  "--token",
499
500
  metavar="TOKEN",
500
501
  help="Fine-grained personal access token (defaults to environment/.env)",
@@ -508,17 +509,17 @@ def cli_enable_all_workflows(owner: str | None, token: str | None) -> None:
508
509
 
509
510
 
510
511
  @cli.command("delete-old-workflow-runs", context_settings=CLICK_CONTEXT_SETTINGS)
511
- @click.option(
512
+ @option(
512
513
  "--owner",
513
514
  metavar="OWNER",
514
515
  help="GitHub username owning the repositories (defaults to environment/.env)",
515
516
  )
516
- @click.option(
517
+ @option(
517
518
  "--token",
518
519
  metavar="TOKEN",
519
520
  help="Fine-grained personal access token (defaults to environment/.env)",
520
521
  )
521
- @click.option(
522
+ @option(
522
523
  "--keep",
523
524
  metavar="COUNT",
524
525
  type=int,
@@ -578,10 +579,10 @@ def main(
578
579
  verbose_limit=verbose_limit,
579
580
  )
580
581
  finally:
581
- _restore_when_requested(previous_state, restore_traceback)
582
+ _restore_when_requested(previous_state, should_restore=restore_traceback)
582
583
 
583
584
 
584
- def _restore_when_requested(state: TracebackState, should_restore: bool) -> None:
585
+ def _restore_when_requested(state: TracebackState, *, should_restore: bool) -> None:
585
586
  """Restore the prior traceback configuration when requested.
586
587
 
587
588
  Why
@@ -16,6 +16,8 @@ from pydantic import BaseModel, ConfigDict, Field, model_validator
16
16
  from . import sanitization
17
17
 
18
18
  REQUEST_TIMEOUT_SECONDS = 30
19
+ #: GitHub API status code returned when the org endpoint has no matching organization.
20
+ HTTP_STATUS_NOT_FOUND = 404
19
21
 
20
22
  logger = logging.getLogger(__name__)
21
23
 
@@ -66,7 +68,7 @@ class GitHubRepositoriesResponse(BaseModel):
66
68
 
67
69
  @model_validator(mode="before")
68
70
  @classmethod
69
- def _wrap_list_response(cls, data: Any) -> dict[str, Any]: # noqa: ANN401
71
+ def _wrap_list_response(cls, data: Any) -> dict[str, Any]:
70
72
  """Wrap list responses into the expected dict structure."""
71
73
  if isinstance(data, list):
72
74
  return {"repositories": data}
@@ -128,7 +130,7 @@ class GitHubErrorResponse(BaseModel):
128
130
  message: str = "Error"
129
131
 
130
132
  @classmethod
131
- def from_response(cls, response: requests.Response | None) -> "GitHubErrorResponse":
133
+ def from_response(cls, response: requests.Response | None) -> GitHubErrorResponse:
132
134
  """Parse error from response, handling various failure modes."""
133
135
  if response is None:
134
136
  return cls()
@@ -148,7 +150,7 @@ class PaginationLink(BaseModel):
148
150
  url: str = ""
149
151
 
150
152
  @classmethod
151
- def from_link_dict(cls, link_data: dict[str, str] | None) -> "PaginationLink | None":
153
+ def from_link_dict(cls, link_data: dict[str, str] | None) -> PaginationLink | None:
152
154
  """Parse pagination link from requests library link dict.
153
155
 
154
156
  Parameters
@@ -367,12 +369,12 @@ def enable_all_workflows(owner: str, github_token: str) -> None:
367
369
  Activating ...
368
370
 
369
371
  """
370
- print(f"Activating and maintaining all workflows for owner {owner}:")
372
+ sys.stdout.write(f"Activating and maintaining all workflows for owner {owner}:\n")
371
373
  repositories = get_repositories(owner=owner, github_token=github_token)
372
374
  for repository in repositories:
373
375
  workflows = get_workflows(owner=owner, repository=repository, github_token=github_token)
374
376
  for workflow_filename in workflows:
375
- print(f"activate workflow {repository}/{workflow_filename}")
377
+ sys.stdout.write(f"activate workflow {repository}/{workflow_filename}\n")
376
378
  enable_workflow(owner=owner, repository=repository, workflow_filename=workflow_filename, github_token=github_token)
377
379
 
378
380
 
@@ -394,8 +396,9 @@ def delete_old_workflow_runs(owner: str, github_token: str, number_of_workflow_r
394
396
 
395
397
 
396
398
  """
397
- print(
398
- f"Removing outdated workflow executions for owner {owner}, while retaining a maximum of {number_of_workflow_runs_to_keep} workflow runs per repository:"
399
+ sys.stdout.write(
400
+ f"Removing outdated workflow executions for owner {owner}, "
401
+ f"while retaining a maximum of {number_of_workflow_runs_to_keep} workflow runs per repository:\n"
399
402
  )
400
403
  l_repositories = get_repositories(owner=owner, github_token=github_token)
401
404
  for repository in l_repositories:
@@ -408,7 +411,7 @@ def delete_old_workflow_runs(owner: str, github_token: str, number_of_workflow_r
408
411
  )
409
412
  )
410
413
  for run_id_to_delete in workflow_run_ids_to_delete:
411
- print(f"remove workflow run {repository}/{run_id_to_delete}")
414
+ sys.stdout.write(f"remove workflow run {repository}/{run_id_to_delete}\n")
412
415
  delete_workflow_run(owner=owner, repository=repository, github_token=github_token, run_id_to_delete=run_id_to_delete)
413
416
 
414
417
 
@@ -501,7 +504,7 @@ def get_repositories(owner: str, github_token: str) -> list[str]:
501
504
  org_url = f"https://api.github.com/orgs/{owner}/repos?per_page=100"
502
505
  user_url = f"https://api.github.com/users/{owner}/repos?per_page=100"
503
506
  probe = requests.get(org_url, headers=headers, timeout=REQUEST_TIMEOUT_SECONDS)
504
- if probe.status_code == 404:
507
+ if probe.status_code == HTTP_STATUS_NOT_FOUND:
505
508
  url: str | None = user_url
506
509
  probe = None # Discard the 404 so the loop fetches fresh from user endpoint.
507
510
  else:
@@ -730,4 +733,4 @@ def main() -> None:
730
733
 
731
734
 
732
735
  if __name__ == "__main__":
733
- print("this is a library only, the executable is named 'keep_github_workflows_active_cli.py'", file=sys.stderr)
736
+ sys.stderr.write("this is a library only, the executable is named 'keep_github_workflows_active_cli.py'\n")
@@ -8,10 +8,10 @@ functions returning sanitized copies without mutating inputs.
8
8
 
9
9
  Contents
10
10
  --------
11
- * :func:`sanitize_headers` – redact Authorization and authentication headers.
12
- * :func:`sanitize_message` – redact token-like patterns from text.
13
- * :func:`sanitize_dict` – recursively sanitize dictionary values.
14
- * :func:`sanitize_for_logging` – convenience wrapper for common logging scenarios.
11
+ * :func:`sanitize_headers` - redact Authorization and authentication headers.
12
+ * :func:`sanitize_message` - redact token-like patterns from text.
13
+ * :func:`sanitize_dict` - recursively sanitize dictionary values.
14
+ * :func:`sanitize_for_logging` - convenience wrapper for common logging scenarios.
15
15
 
16
16
  System Role
17
17
  -----------
@@ -23,8 +23,9 @@ ensure credentials never leak into log files or monitoring systems.
23
23
  from __future__ import annotations
24
24
 
25
25
  import re
26
+ from collections.abc import Mapping
26
27
  from collections.abc import Mapping as MappingABC
27
- from typing import Any, Mapping
28
+ from typing import Any
28
29
 
29
30
  #: HTTP header names that contain sensitive authentication data.
30
31
  SENSITIVE_HEADERS = frozenset(
@@ -64,11 +65,17 @@ SENSITIVE_KEYS = frozenset(
64
65
  REDACTED_PLACEHOLDER = "[REDACTED]"
65
66
 
66
67
  #: Pattern matching token-like strings:
67
- #: - GitHub tokens (ghp_, gho_, ghs_, etc. followed by alphanumerics)
68
+ #: - GitHub tokens (ghp_, gho_, ghs_, etc.). Installation tokens (ghs_) are now long
69
+ #: JWT-format strings (~520 chars) that contain dots, dashes and underscores, so the
70
+ #: token body allows ".-_" and carries no trailing word boundary (a token may end in
71
+ #: "-", which is not a word char and would otherwise truncate the match and leak the
72
+ #: remainder of the JWT).
68
73
  #: - Long hex strings (40+ chars)
69
74
  #: - Base64-like sequences (40+ chars)
70
75
  TOKEN_PATTERN = re.compile(
71
- r"\b(gh[a-z]_[A-Za-z0-9]{36,}|[a-f0-9]{40,}|[A-Za-z0-9+/]{40,}={0,2})\b",
76
+ r"\bgh[a-z]_[A-Za-z0-9._-]{36,}"
77
+ r"|\b[a-f0-9]{40,}\b"
78
+ r"|\b[A-Za-z0-9+/]{40,}={0,2}\b",
72
79
  re.IGNORECASE,
73
80
  )
74
81
 
@@ -256,7 +263,7 @@ def _is_sensitive_key(name: str) -> bool:
256
263
  return name.lower() in SENSITIVE_KEYS or name.lower() in SENSITIVE_HEADERS
257
264
 
258
265
 
259
- def _sanitize_dict_value(key: str, value: Any) -> Any: # noqa: ANN401
266
+ def _sanitize_dict_value(key: str, value: Any) -> Any:
260
267
  """Return sanitized value for dictionary entry.
261
268
 
262
269
  Parameters
@@ -327,7 +334,7 @@ def sanitize_dict(data: Mapping[str, Any]) -> dict[str, Any]:
327
334
  return {key: _sanitize_dict_value(key, value) for key, value in data.items()}
328
335
 
329
336
 
330
- def sanitize_for_logging(value: Any) -> Any: # noqa: ANN401
337
+ def sanitize_for_logging(value: Any) -> Any:
331
338
  """Return sanitized representation suitable for logging.
332
339
 
333
340
  Why
@@ -368,12 +375,12 @@ def sanitize_for_logging(value: Any) -> Any: # noqa: ANN401
368
375
 
369
376
 
370
377
  __all__ = [
378
+ "REDACTED_PLACEHOLDER",
371
379
  "SENSITIVE_HEADERS",
372
380
  "SENSITIVE_KEYS",
373
- "REDACTED_PLACEHOLDER",
374
381
  "TOKEN_PATTERN",
375
- "sanitize_headers",
376
- "sanitize_message",
377
382
  "sanitize_dict",
378
383
  "sanitize_for_logging",
384
+ "sanitize_headers",
385
+ "sanitize_message",
379
386
  ]
@@ -0,0 +1,51 @@
1
+ """Strictly-typed wrappers for rich_click's partially-typed decorators.
2
+
3
+ rich_click ships ``py.typed``, but its ``option`` and ``version_option``
4
+ decorators are typed with a partially-unknown return, so the strict type checker
5
+ reports ``reportUnknownMemberType`` at every call site. click's own decorators
6
+ are fully typed, but they default the parameter class to ``click.Option`` rather
7
+ than rich_click's ``RichOption``, which would change help rendering.
8
+
9
+ This module forwards to rich_click's decorators (so ``RichOption``/``RichArgument``
10
+ are still used at runtime) through a typed ``Protocol``: the ``cast`` is a no-op
11
+ at runtime, and the wrappers keep the exact same public signatures they always
12
+ had, so no rule needs to be silenced anywhere.
13
+
14
+ Other click members (``command``, ``group``, ``echo``, ``Context``, ``Path`` ...)
15
+ type cleanly and are still used directly as ``click.X`` at call sites.
16
+ """
17
+
18
+ from collections.abc import Callable
19
+ from typing import Any, Protocol, cast
20
+
21
+ import rich_click as click
22
+
23
+ # Click decorators turn a command function (or another decorator's result) into a
24
+ # wrapped callable. ``Any`` is fully known to the type checker, so this alias stays
25
+ # clean and works both as ``@option(...)`` and as a value collected into a list.
26
+ _CommandDecorator = Callable[[Callable[..., Any]], Callable[..., Any]]
27
+
28
+
29
+ class _RichClickDecorators(Protocol):
30
+ """rich_click's decorator surface, declared with complete types."""
31
+
32
+ option: Callable[..., _CommandDecorator]
33
+ version_option: Callable[..., _CommandDecorator]
34
+
35
+
36
+ # ``cast`` is type-only; at runtime these forward to rich_click's own decorators,
37
+ # so ``RichOption``/``RichArgument`` behavior is unchanged.
38
+ _click = cast("_RichClickDecorators", click)
39
+
40
+
41
+ def option(*param_decls: str, **attrs: Any) -> _CommandDecorator:
42
+ """Typed wrapper over :func:`rich_click.option`. See module docstring."""
43
+ return _click.option(*param_decls, **attrs)
44
+
45
+
46
+ def version_option(*param_decls: str, **attrs: Any) -> _CommandDecorator:
47
+ """Typed wrapper over :func:`rich_click.version_option`. See module docstring."""
48
+ return _click.version_option(*param_decls, **attrs)
49
+
50
+
51
+ __all__ = ["option", "version_option"]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: keep_github_workflows_active
3
- Version: 2.3.1
3
+ Version: 2.3.3
4
4
  Summary: Template for python apps with registered cli commands
5
5
  Project-URL: Homepage, https://github.com/bitranox/keep_github_workflows_active
6
6
  Project-URL: Repository, https://github.com/bitranox/keep_github_workflows_active.git
@@ -17,22 +17,22 @@ Classifier: Programming Language :: Python :: 3 :: Only
17
17
  Classifier: Programming Language :: Python :: 3.14
18
18
  Classifier: Typing :: Typed
19
19
  Requires-Python: >=3.10
20
- Requires-Dist: lib-cli-exit-tools>=2.3.1
20
+ Requires-Dist: lib-cli-exit-tools>=2.3.3
21
21
  Requires-Dist: pydantic>=2.13.4
22
- Requires-Dist: requests>=2.34.1
23
- Requires-Dist: rich-click>=1.9.7
22
+ Requires-Dist: requests>=2.34.2
23
+ Requires-Dist: rich-click>=1.9.8
24
24
  Provides-Extra: dev
25
25
  Requires-Dist: bandit>=1.9.4; extra == 'dev'
26
26
  Requires-Dist: build>=1.5.0; extra == 'dev'
27
- Requires-Dist: codecov-cli>=11.2.8; extra == 'dev'
28
- Requires-Dist: import-linter>=2.11; extra == 'dev'
29
- Requires-Dist: pip-audit>=2.10.0; extra == 'dev'
30
- Requires-Dist: pyright[nodejs]>=1.1.409; extra == 'dev'
27
+ Requires-Dist: click>=8.4.2; extra == 'dev'
28
+ Requires-Dist: import-linter>=2.13; extra == 'dev'
29
+ Requires-Dist: pip-audit>=2.10.1; extra == 'dev'
30
+ Requires-Dist: pyright[nodejs]>=1.1.411; extra == 'dev'
31
31
  Requires-Dist: pytest-cov>=7.1.0; extra == 'dev'
32
- Requires-Dist: pytest>=9.0.3; extra == 'dev'
32
+ Requires-Dist: pytest>=9.1.1; extra == 'dev'
33
33
  Requires-Dist: rtoml>=0.13.0; extra == 'dev'
34
- Requires-Dist: ruff>=0.15.12; extra == 'dev'
35
- Requires-Dist: textual>=8.2.6; extra == 'dev'
34
+ Requires-Dist: ruff>=0.16.0; extra == 'dev'
35
+ Requires-Dist: textual>=8.2.8; extra == 'dev'
36
36
  Requires-Dist: twine>=6.2.0; extra == 'dev'
37
37
  Description-Content-Type: text/markdown
38
38
 
@@ -0,0 +1,15 @@
1
+ keep_github_workflows_active/__init__.py,sha256=AlRr46bcAznN5xCoFiwEyc65m6kbfGBB5l30iIzq-Q4,399
2
+ keep_github_workflows_active/__init__conf__.py,sha256=gc2KCQa4E7lVt5AtR-YDFJox54lFyEI9WVgIqdUYNxk,2592
3
+ keep_github_workflows_active/__main__.py,sha256=tFOQl70Tnf47fz4ylnN3p0dSjoLeHdLMe9dh-ISfpgE,3589
4
+ keep_github_workflows_active/behaviors.py,sha256=6ck9W-QIwHox6j93XHFL57f_YRwgDkxooa6FtxmnPdw,3733
5
+ keep_github_workflows_active/cli.py,sha256=eqeMrqBltwHvmNPyz8i5az5_0dVPnJbb4Mloa4vmZn0,19070
6
+ keep_github_workflows_active/doctest.env,sha256=WmDSq0QN1PFXpP4jq7JW_Kz-k5PT5uS8KzLrAEmJNC8,25
7
+ keep_github_workflows_active/keep_github_workflow_active.py,sha256=c8FfZuYmwv27eG6D2gGauX-oLiYsx61cCGabal-6UJM,25952
8
+ keep_github_workflows_active/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
9
+ keep_github_workflows_active/sanitization.py,sha256=cuG2Lbn0Ca4h6NP2f7Z2rSwio_3c_wy3dNsofUwaGOc,10115
10
+ keep_github_workflows_active/typed_click.py,sha256=VLZgUkCZ6AFnf6StvoztK3JVYj9lZmgPSNY2Wjb3B8g,2183
11
+ keep_github_workflows_active-2.3.3.dist-info/METADATA,sha256=33zyXo8k5AVzUX7Sx85tBVoRULpOIxpxWlJ116JiCWE,9405
12
+ keep_github_workflows_active-2.3.3.dist-info/WHEEL,sha256=lCkmxWfQsSc9CfIClYeavTdQeEX2toPqufh9gI35EQA,87
13
+ keep_github_workflows_active-2.3.3.dist-info/entry_points.txt,sha256=6B8ytwKR2VIAj6IXUYhF957dlfulwTPPLR39RBXwCM0,156
14
+ keep_github_workflows_active-2.3.3.dist-info/licenses/LICENSE,sha256=6s9SL2InRrwynPjJYiER7ONHBshbGj_yC5EBzfo7l9I,1072
15
+ keep_github_workflows_active-2.3.3.dist-info/RECORD,,
@@ -1,4 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: hatchling 1.29.0
2
+ Generator: hatchling 1.31.0
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
@@ -1,14 +0,0 @@
1
- keep_github_workflows_active/__init__.py,sha256=tAEJPhRW07E84IzHijcwAf-iu8fhAf3TsvBUQqGz-fY,399
2
- keep_github_workflows_active/__init__conf__.py,sha256=3G4LRfrz9fYOEramyitat2ACemCCDWMOFy6q901eTlU,2562
3
- keep_github_workflows_active/__main__.py,sha256=79coRxvGs07uGBSdbw_HpcIv_rqogXvoEkv3lNEEIjE,3552
4
- keep_github_workflows_active/behaviors.py,sha256=PYDhp_ubXhLud2IVFLIJKylStu36W4Qm7E_daT2dOAM,3741
5
- keep_github_workflows_active/cli.py,sha256=KLLeRvnKuaE45GgX8GS-Aa5l7GGaKE7QjX7KtTV2ZUc,19007
6
- keep_github_workflows_active/doctest.env,sha256=WmDSq0QN1PFXpP4jq7JW_Kz-k5PT5uS8KzLrAEmJNC8,25
7
- keep_github_workflows_active/keep_github_workflow_active.py,sha256=Ri4xOS-Cbg1qO2EasRzlvV59Du0WBruiCnpntVN8cBI,25779
8
- keep_github_workflows_active/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
9
- keep_github_workflows_active/sanitization.py,sha256=zyPybyYLBWd__nITF8nyrubA3NJWXjyGkznw-4kJtyA,9801
10
- keep_github_workflows_active-2.3.1.dist-info/METADATA,sha256=Z7WujE9GdFCUD5q3kXp1L2572WatUTOtdLWyRLEkFpg,9413
11
- keep_github_workflows_active-2.3.1.dist-info/WHEEL,sha256=QccIxa26bgl1E6uMy58deGWi-0aeIkkangHcxk2kWfw,87
12
- keep_github_workflows_active-2.3.1.dist-info/entry_points.txt,sha256=6B8ytwKR2VIAj6IXUYhF957dlfulwTPPLR39RBXwCM0,156
13
- keep_github_workflows_active-2.3.1.dist-info/licenses/LICENSE,sha256=6s9SL2InRrwynPjJYiER7ONHBshbGj_yC5EBzfo7l9I,1072
14
- keep_github_workflows_active-2.3.1.dist-info/RECORD,,