keep-github-workflows-active 2.3.5__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.
- keep_github_workflows_active/__init__conf__.py +5 -5
- keep_github_workflows_active/behaviors.py +17 -19
- keep_github_workflows_active/cli.py +34 -22
- keep_github_workflows_active/keep_github_workflow_active.py +222 -105
- keep_github_workflows_active-3.0.0.dist-info/METADATA +280 -0
- {keep_github_workflows_active-2.3.5.dist-info → keep_github_workflows_active-3.0.0.dist-info}/RECORD +9 -9
- {keep_github_workflows_active-2.3.5.dist-info → keep_github_workflows_active-3.0.0.dist-info}/WHEEL +1 -1
- keep_github_workflows_active-2.3.5.dist-info/METADATA +0 -240
- {keep_github_workflows_active-2.3.5.dist-info → keep_github_workflows_active-3.0.0.dist-info}/entry_points.txt +0 -0
- {keep_github_workflows_active-2.3.5.dist-info → keep_github_workflows_active-3.0.0.dist-info}/licenses/LICENSE +0 -0
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
Purpose
|
|
4
4
|
-------
|
|
5
|
-
Expose the current project metadata as simple constants.
|
|
6
|
-
|
|
7
|
-
|
|
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 = "
|
|
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 = "
|
|
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
|
-
"""
|
|
1
|
+
"""Diagnostic behaviors behind the CLI's ``hello`` and ``fail`` commands.
|
|
2
2
|
|
|
3
3
|
Purpose
|
|
4
4
|
-------
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
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` -
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
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
|
-
|
|
21
|
-
|
|
22
|
-
|
|
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
|
|
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
|
-
"""
|
|
115
|
+
"""Do nothing; the default action of the CLI root command.
|
|
118
116
|
|
|
119
117
|
Why
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
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
|
|
1
|
+
"""CLI adapter wiring the GitHub maintenance functions into a rich-click interface.
|
|
2
2
|
|
|
3
3
|
Purpose
|
|
4
4
|
-------
|
|
5
|
-
Expose
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
``
|
|
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
|
|
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
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
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
|
-
|
|
219
|
-
need a readable predicate to
|
|
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
|
|
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.
|
|
424
|
-
|
|
425
|
-
|
|
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
|
|
466
|
+
"""Run the default action when no subcommand is given but a traceback flag is.
|
|
454
467
|
|
|
455
468
|
Why
|
|
456
|
-
|
|
457
|
-
|
|
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`.
|