keep-github-workflows-active 2.3.6__py3-none-any.whl → 3.0.0__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,9 +2,9 @@
2
2
 
3
3
  Purpose
4
4
  -------
5
- Expose the current project metadata as simple constants. These values are kept
6
- in sync with ``pyproject.toml`` by development automation (tests, push
7
- pipelines), so runtime code does not query packaging metadata.
5
+ Expose the current project metadata as simple constants. bmk rewrites them from
6
+ ``pyproject.toml`` during ``make bump-*`` and before ``make commit`` /
7
+ ``make push``, so runtime code does not query packaging metadata.
8
8
 
9
9
  Contents
10
10
  --------
@@ -24,9 +24,9 @@ import sys
24
24
  #: Distribution name declared in ``pyproject.toml``.
25
25
  name = "keep_github_workflows_active"
26
26
  #: Human-readable summary shown in CLI help output.
27
- title = "Template for python apps with registered cli commands"
27
+ title = "Keep the GitHub Actions workflows of a user's or organisation's repositories enabled and delete their old workflow runs"
28
28
  #: Current release version pulled from ``pyproject.toml`` by automation.
29
- version = "2.3.6"
29
+ version = "3.0.0"
30
30
  #: Repository homepage presented to users.
31
31
  homepage = "https://github.com/bitranox/keep_github_workflows_active"
32
32
  #: Author attribution surfaced in CLI output.
@@ -1,25 +1,24 @@
1
- """Domain-level behaviors supporting the minimal CLI transport.
1
+ """Diagnostic behaviors behind the CLI's ``hello`` and ``fail`` commands.
2
2
 
3
3
  Purpose
4
4
  -------
5
- Collect the placeholder behaviors that the CLI adapter exposes so that each
6
- concern remains self-contained. Keeping these helpers together makes it easy to
7
- swap in richer logging logic later without touching the transport surface.
5
+ Provide a deterministic success path and a deterministic failure path, so
6
+ packaging checks, smoke tests and the traceback handling of the CLI can be
7
+ exercised without calling the GitHub API.
8
8
 
9
9
  Contents
10
10
  --------
11
- * :func:`emit_greeting` - success-path helper that writes the canonical scaffold
12
- message.
13
- * :func:`raise_intentional_failure` - deterministic error hook used by tests and
14
- CLI flows to validate traceback handling.
15
- * :func:`noop_main` - placeholder entry used when callers expect a ``main``
16
- callable despite the domain layer being stubbed today.
11
+ * :func:`emit_greeting` - writes the canonical greeting (``hello``).
12
+ * :func:`raise_intentional_failure` - raises ``RuntimeError`` (``fail``) to
13
+ exercise exit codes and traceback output.
14
+ * :func:`noop_main` - does nothing; the CLI runs it when only
15
+ ``--traceback`` / ``--no-traceback`` is given without a subcommand.
17
16
 
18
17
  System Role
19
18
  -----------
20
- Acts as the temporary domain surface for this template. Other modules import
21
- from here instead of duplicating literals so the public API stays coherent as
22
- features evolve.
19
+ The workflow maintenance logic lives in
20
+ :mod:`keep_github_workflows_active.keep_github_workflow_active`; this module
21
+ holds only the diagnostic helpers, which the package root re-exports.
23
22
  """
24
23
 
25
24
  from __future__ import annotations
@@ -55,8 +54,7 @@ def emit_greeting(*, stream: TextIO | None = None) -> None:
55
54
 
56
55
  Why
57
56
  Provide a deterministic success path that the documentation, smoke
58
- tests, and packaging checks can rely on while the real logging helpers
59
- are developed.
57
+ tests, and packaging checks can rely on without calling the GitHub API.
60
58
 
61
59
  What
62
60
  Writes :data:`CANONICAL_GREETING` followed by a newline to the target
@@ -114,12 +112,12 @@ def raise_intentional_failure() -> None:
114
112
 
115
113
 
116
114
  def noop_main() -> None:
117
- """Explicit placeholder callable for transports without domain logic yet.
115
+ """Do nothing; the default action of the CLI root command.
118
116
 
119
117
  Why
120
- Some tools expect a module-level ``main`` even when the underlying
121
- feature set is still stubbed out. Exposing this helper makes that
122
- contract obvious and easy to replace later.
118
+ The CLI runs this when it is called with only ``--traceback`` or
119
+ ``--no-traceback`` and no subcommand (see ``cli.cli_main``), so that
120
+ invocation succeeds without side effects.
123
121
 
124
122
  What
125
123
  Performs no work and returns immediately.
@@ -1,25 +1,36 @@
1
- """CLI adapter wiring the behavior helpers into a rich-click interface.
1
+ """CLI adapter wiring the GitHub maintenance functions into a rich-click interface.
2
2
 
3
3
  Purpose
4
4
  -------
5
- Expose a stable command-line surface so tooling, documentation, and packaging
6
- automation can be exercised while the richer logging helpers are being built.
7
- By delegating to :mod:`keep_github_workflows_active.behaviors` the transport stays
8
- aligned with the Clean Code rules captured in
9
- ``docs/systemdesign/module_reference.md``.
5
+ Expose the two maintenance commands (``enable-all-workflows`` and
6
+ ``delete-old-workflow-runs``, backed by
7
+ :mod:`keep_github_workflows_active.keep_github_workflow_active`) and the
8
+ diagnostic commands (``info``, ``hello``, ``fail``, backed by
9
+ :mod:`keep_github_workflows_active.behaviors` and ``__init__conf__``) behind one
10
+ command group, with exit codes and traceback output handled by
11
+ ``lib_cli_exit_tools``. ``docs/systemdesign/module_reference.md`` describes the
12
+ wiring.
10
13
 
11
14
  Contents
12
15
  --------
16
+ * :class:`CliContextObject` - typed ``ctx.obj`` holding the traceback flag.
13
17
  * :data:`CLICK_CONTEXT_SETTINGS` - shared Click settings ensuring consistent
14
18
  ``--help`` behavior across commands.
15
19
  * :func:`apply_traceback_preferences` - helper that synchronises the shared
16
20
  traceback configuration flags.
17
21
  * :func:`snapshot_traceback_state` / :func:`restore_traceback_state` - utilities
18
- for preserving and reapplying the global traceback preference.
22
+ for preserving and reapplying the global traceback preference
23
+ (:class:`TracebackState`).
19
24
  * :func:`cli` - root command group wiring the global options.
20
- * :func:`cli_main` - default action when no subcommand is provided.
25
+ * :func:`cli_main` - default action when only ``--traceback`` /
26
+ ``--no-traceback`` is given without a subcommand.
27
+ * :func:`cli_enable_all_workflows`, :func:`cli_delete_old_workflow_runs` - the
28
+ maintenance subcommands; :func:`_fallback_owner` / :func:`_fallback_token`
29
+ fill a missing ``--owner`` / ``--token`` from the environment or ``.env``.
21
30
  * :func:`cli_info`, :func:`cli_hello`, :func:`cli_fail` - subcommands covering
22
31
  metadata printing, success path, and failure path.
32
+ * :func:`_no_subcommand_requested`, :func:`_traceback_option_requested`,
33
+ :func:`_show_help` - decide between the help screen and :func:`cli_main`.
23
34
  * :func:`_record_traceback_choice`, :func:`_announce_traceback_choice` - persist
24
35
  traceback preferences across context and shared tooling.
25
36
  * :func:`_invoke_cli`, :func:`_current_traceback_mode`, :func:`_traceback_limit`,
@@ -31,10 +42,11 @@ Contents
31
42
 
32
43
  System Role
33
44
  -----------
34
- The CLI is the primary adapter for local development workflows; packaging
35
- targets register the console script defined in :mod:`keep_github_workflows_active.__init__conf__`.
36
- Other transports (including ``python -m`` execution) reuse the same helpers so
37
- behaviour remains consistent regardless of entry point.
45
+ The CLI is the package's entry point: both console scripts declared in
46
+ ``[project.scripts]`` and ``python -m keep_github_workflows_active`` run
47
+ :func:`main`, so behaviour is identical regardless of entry point. The program
48
+ name shown in help and ``--version`` comes from
49
+ :mod:`keep_github_workflows_active.__init__conf__`.
38
50
  """
39
51
 
40
52
  from __future__ import annotations
@@ -215,8 +227,9 @@ def _no_subcommand_requested(ctx: click.Context) -> bool:
215
227
  """Return ``True`` when the invocation did not name a subcommand.
216
228
 
217
229
  Why
218
- The CLI defaults to calling ``noop_main`` when no subcommand appears; we
219
- need a readable predicate to capture that intent.
230
+ Without a subcommand the CLI prints its help or, with an explicit
231
+ traceback flag, calls ``noop_main``; we need a readable predicate to
232
+ capture that branch.
220
233
 
221
234
  Inputs
222
235
  ctx:
@@ -418,11 +431,11 @@ def cli(ctx: click.Context, *, traceback: bool) -> None:
418
431
  toggle diagnostic depth without editing configuration files.
419
432
 
420
433
  What
421
- Ensures a dict-based context, stores the ``traceback`` flag, and mirrors
434
+ Ensures a :class:`CliContextObject` context, stores the ``traceback`` flag, and mirrors
422
435
  the value into ``lib_cli_exit_tools.config`` so downstream helpers observe
423
- the preference. When no subcommand (or options) are provided, the command
424
- prints help instead of running the domain stub; otherwise the default
425
- action delegates to :func:`cli_main`.
436
+ the preference. Without a subcommand the command prints its help; when
437
+ ``--traceback`` or ``--no-traceback`` is given without a subcommand it
438
+ runs :func:`cli_main` instead.
426
439
 
427
440
  Side Effects
428
441
  Mutates :mod:`lib_cli_exit_tools.config` to reflect the requested
@@ -450,12 +463,11 @@ def cli(ctx: click.Context, *, traceback: bool) -> None:
450
463
 
451
464
 
452
465
  def cli_main() -> None:
453
- """Run the placeholder domain entry when callers opt into execution.
466
+ """Run the default action when no subcommand is given but a traceback flag is.
454
467
 
455
468
  Why
456
- Maintains compatibility with tooling that expects the original
457
- "do-nothing" behaviour by explicitly opting in via options (e.g.
458
- ``--traceback`` without subcommands).
469
+ ``--traceback`` or ``--no-traceback`` without a subcommand is a valid
470
+ invocation; it runs this no-op instead of printing the help.
459
471
 
460
472
  Side Effects
461
473
  Delegates to :func:`noop_main`.