keep-github-workflows-active 2.1.2__tar.gz → 2.1.3__tar.gz

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.
Files changed (69) hide show
  1. keep_github_workflows_active-2.1.3/.github/actions/extract-metadata/action.yml +91 -0
  2. keep_github_workflows_active-2.1.2/.github/workflows/ci.yml → keep_github_workflows_active-2.1.3/.github/workflows/activate_workflows.yml +1 -1
  3. keep_github_workflows_active-2.1.3/.github/workflows/default_cicd_public.yml +287 -0
  4. keep_github_workflows_active-2.1.2/.github/workflows/release.yml → keep_github_workflows_active-2.1.3/.github/workflows/default_release_public.yml +41 -15
  5. {keep_github_workflows_active-2.1.2 → keep_github_workflows_active-2.1.3}/CHANGELOG.md +14 -0
  6. {keep_github_workflows_active-2.1.2 → keep_github_workflows_active-2.1.3}/PKG-INFO +9 -9
  7. {keep_github_workflows_active-2.1.2 → keep_github_workflows_active-2.1.3}/pyproject.toml +15 -10
  8. {keep_github_workflows_active-2.1.2 → keep_github_workflows_active-2.1.3}/src/keep_github_workflows_active/__init__conf__.py +1 -1
  9. keep_github_workflows_active-2.1.3/tests/test_github_integration.py +90 -0
  10. {keep_github_workflows_active-2.1.2 → keep_github_workflows_active-2.1.3}/tests/test_metadata.py +3 -4
  11. keep_github_workflows_active-2.1.2/.github/workflows/do_not_change_ci_yml.md +0 -0
  12. {keep_github_workflows_active-2.1.2 → keep_github_workflows_active-2.1.3}/.devcontainer/devcontainer.json +0 -0
  13. {keep_github_workflows_active-2.1.2 → keep_github_workflows_active-2.1.3}/.devcontainer/settings.json +0 -0
  14. {keep_github_workflows_active-2.1.2 → keep_github_workflows_active-2.1.3}/.env.example +0 -0
  15. {keep_github_workflows_active-2.1.2 → keep_github_workflows_active-2.1.3}/.github/dependabot.yml +0 -0
  16. {keep_github_workflows_active-2.1.2 → keep_github_workflows_active-2.1.3}/.github/workflows/codeql.yml +0 -0
  17. {keep_github_workflows_active-2.1.2 → keep_github_workflows_active-2.1.3}/.gitignore +0 -0
  18. {keep_github_workflows_active-2.1.2 → keep_github_workflows_active-2.1.3}/.qlty/qlty.toml +0 -0
  19. {keep_github_workflows_active-2.1.2 → keep_github_workflows_active-2.1.3}/.snyk +0 -0
  20. {keep_github_workflows_active-2.1.2 → keep_github_workflows_active-2.1.3}/CLAUDE.md +0 -0
  21. {keep_github_workflows_active-2.1.2 → keep_github_workflows_active-2.1.3}/CONTRIBUTING.md +0 -0
  22. {keep_github_workflows_active-2.1.2 → keep_github_workflows_active-2.1.3}/DEVELOPMENT.md +0 -0
  23. {keep_github_workflows_active-2.1.2 → keep_github_workflows_active-2.1.3}/INSTALL.md +0 -0
  24. {keep_github_workflows_active-2.1.2 → keep_github_workflows_active-2.1.3}/LICENSE +0 -0
  25. {keep_github_workflows_active-2.1.2 → keep_github_workflows_active-2.1.3}/Makefile +0 -0
  26. {keep_github_workflows_active-2.1.2 → keep_github_workflows_active-2.1.3}/README.md +0 -0
  27. {keep_github_workflows_active-2.1.2 → keep_github_workflows_active-2.1.3}/codecov.yml +0 -0
  28. {keep_github_workflows_active-2.1.2 → keep_github_workflows_active-2.1.3}/concept.md +0 -0
  29. {keep_github_workflows_active-2.1.2 → keep_github_workflows_active-2.1.3}/docs/systemdesign/SECURITY.md +0 -0
  30. {keep_github_workflows_active-2.1.2 → keep_github_workflows_active-2.1.3}/docs/systemdesign/module_reference.md +0 -0
  31. {keep_github_workflows_active-2.1.2 → keep_github_workflows_active-2.1.3}/notebooks/Quickstart.ipynb +0 -0
  32. {keep_github_workflows_active-2.1.2 → keep_github_workflows_active-2.1.3}/reset_git_history.sh +0 -0
  33. {keep_github_workflows_active-2.1.2 → keep_github_workflows_active-2.1.3}/scripts/__init__.py +0 -0
  34. {keep_github_workflows_active-2.1.2 → keep_github_workflows_active-2.1.3}/scripts/__main__.py +0 -0
  35. {keep_github_workflows_active-2.1.2 → keep_github_workflows_active-2.1.3}/scripts/_utils.py +0 -0
  36. {keep_github_workflows_active-2.1.2 → keep_github_workflows_active-2.1.3}/scripts/build.py +0 -0
  37. {keep_github_workflows_active-2.1.2 → keep_github_workflows_active-2.1.3}/scripts/bump.py +0 -0
  38. {keep_github_workflows_active-2.1.2 → keep_github_workflows_active-2.1.3}/scripts/bump_major.py +0 -0
  39. {keep_github_workflows_active-2.1.2 → keep_github_workflows_active-2.1.3}/scripts/bump_minor.py +0 -0
  40. {keep_github_workflows_active-2.1.2 → keep_github_workflows_active-2.1.3}/scripts/bump_patch.py +0 -0
  41. {keep_github_workflows_active-2.1.2 → keep_github_workflows_active-2.1.3}/scripts/bump_version.py +0 -0
  42. {keep_github_workflows_active-2.1.2 → keep_github_workflows_active-2.1.3}/scripts/clean.py +0 -0
  43. {keep_github_workflows_active-2.1.2 → keep_github_workflows_active-2.1.3}/scripts/cli.py +0 -0
  44. {keep_github_workflows_active-2.1.2 → keep_github_workflows_active-2.1.3}/scripts/dependencies.py +0 -0
  45. {keep_github_workflows_active-2.1.2 → keep_github_workflows_active-2.1.3}/scripts/dev.py +0 -0
  46. {keep_github_workflows_active-2.1.2 → keep_github_workflows_active-2.1.3}/scripts/help.py +0 -0
  47. {keep_github_workflows_active-2.1.2 → keep_github_workflows_active-2.1.3}/scripts/install.py +0 -0
  48. {keep_github_workflows_active-2.1.2 → keep_github_workflows_active-2.1.3}/scripts/menu.py +0 -0
  49. {keep_github_workflows_active-2.1.2 → keep_github_workflows_active-2.1.3}/scripts/push.py +0 -0
  50. {keep_github_workflows_active-2.1.2 → keep_github_workflows_active-2.1.3}/scripts/release.py +0 -0
  51. {keep_github_workflows_active-2.1.2 → keep_github_workflows_active-2.1.3}/scripts/run_cli.py +0 -0
  52. {keep_github_workflows_active-2.1.2 → keep_github_workflows_active-2.1.3}/scripts/target_metadata.py +0 -0
  53. {keep_github_workflows_active-2.1.2 → keep_github_workflows_active-2.1.3}/scripts/test.py +0 -0
  54. {keep_github_workflows_active-2.1.2 → keep_github_workflows_active-2.1.3}/scripts/toml_config.py +0 -0
  55. {keep_github_workflows_active-2.1.2 → keep_github_workflows_active-2.1.3}/scripts/version_current.py +0 -0
  56. {keep_github_workflows_active-2.1.2 → keep_github_workflows_active-2.1.3}/src/keep_github_workflows_active/__init__.py +0 -0
  57. {keep_github_workflows_active-2.1.2 → keep_github_workflows_active-2.1.3}/src/keep_github_workflows_active/__main__.py +0 -0
  58. {keep_github_workflows_active-2.1.2 → keep_github_workflows_active-2.1.3}/src/keep_github_workflows_active/behaviors.py +0 -0
  59. {keep_github_workflows_active-2.1.2 → keep_github_workflows_active-2.1.3}/src/keep_github_workflows_active/cli.py +0 -0
  60. {keep_github_workflows_active-2.1.2 → keep_github_workflows_active-2.1.3}/src/keep_github_workflows_active/doctest.env +0 -0
  61. {keep_github_workflows_active-2.1.2 → keep_github_workflows_active-2.1.3}/src/keep_github_workflows_active/keep_github_workflow_active.py +0 -0
  62. {keep_github_workflows_active-2.1.2 → keep_github_workflows_active-2.1.3}/src/keep_github_workflows_active/py.typed +0 -0
  63. {keep_github_workflows_active-2.1.2 → keep_github_workflows_active-2.1.3}/src/keep_github_workflows_active/sanitization.py +0 -0
  64. {keep_github_workflows_active-2.1.2 → keep_github_workflows_active-2.1.3}/tests/conftest.py +0 -0
  65. {keep_github_workflows_active-2.1.2 → keep_github_workflows_active-2.1.3}/tests/test_behaviors.py +0 -0
  66. {keep_github_workflows_active-2.1.2 → keep_github_workflows_active-2.1.3}/tests/test_cli.py +0 -0
  67. {keep_github_workflows_active-2.1.2 → keep_github_workflows_active-2.1.3}/tests/test_module_entry.py +0 -0
  68. {keep_github_workflows_active-2.1.2 → keep_github_workflows_active-2.1.3}/tests/test_sanitization.py +0 -0
  69. {keep_github_workflows_active-2.1.2 → keep_github_workflows_active-2.1.3}/tests/test_scripts.py +0 -0
@@ -0,0 +1,91 @@
1
+ name: Extract project metadata
2
+ description: >-
3
+ Parse pyproject.toml and expose project metadata as step outputs.
4
+ Requires Python and tomllib (or tomli for Python < 3.11) to be
5
+ available in the runner environment.
6
+
7
+ outputs:
8
+ PACKAGE_MODULE:
9
+ description: Python-importable module name (underscored)
10
+ value: ${{ steps.meta.outputs.PACKAGE_MODULE }}
11
+ PROJECT_NAME:
12
+ description: Project name from pyproject.toml
13
+ value: ${{ steps.meta.outputs.PROJECT_NAME }}
14
+ CLI_BIN:
15
+ description: CLI entry-point binary name
16
+ value: ${{ steps.meta.outputs.CLI_BIN }}
17
+ SRC_PATH:
18
+ description: Source directory path (e.g. "src")
19
+ value: ${{ steps.meta.outputs.SRC_PATH }}
20
+ COV_FAIL_UNDER:
21
+ description: Minimum coverage percentage from tool.coverage.report.fail_under
22
+ value: ${{ steps.meta.outputs.COV_FAIL_UNDER }}
23
+ COV_REPORT_FILE:
24
+ description: Coverage report filename (e.g. "coverage.xml")
25
+ value: ${{ steps.meta.outputs.COV_REPORT_FILE }}
26
+ PYTEST_VERBOSITY:
27
+ description: Pytest verbosity flag (e.g. "-vv")
28
+ value: ${{ steps.meta.outputs.PYTEST_VERBOSITY }}
29
+ BANDIT_SKIP_FLAG:
30
+ description: Bandit skip flag string (e.g. "-s B101,B601") or empty
31
+ value: ${{ steps.meta.outputs.BANDIT_SKIP_FLAG }}
32
+
33
+ runs:
34
+ using: composite
35
+ steps:
36
+ - name: Extract project metadata from pyproject.toml
37
+ id: meta
38
+ shell: python
39
+ run: |
40
+ import os
41
+ try:
42
+ import tomllib
43
+ except ModuleNotFoundError:
44
+ import tomli as tomllib
45
+
46
+ with open('pyproject.toml', 'rb') as f:
47
+ data = tomllib.load(f)
48
+
49
+ # --- [project] section ---
50
+ project = data['project']['name']
51
+ module = project.replace('-', '_')
52
+ dash = project.replace('_', '-')
53
+ scripts = list(data['project'].get('scripts', {}).keys())
54
+ cli_bin = scripts[0] if scripts else dash
55
+
56
+ # --- [tool.scripts.test] section ---
57
+ scripts_test = data.get('tool', {}).get('scripts', {}).get('test', {})
58
+ src_path = scripts_test.get('src-path', 'src')
59
+ pytest_verbosity = scripts_test.get('pytest-verbosity', '-vv')
60
+ cov_report_file = scripts_test.get('coverage-report-file', 'coverage.xml')
61
+
62
+ # --- [tool.coverage.report] section ---
63
+ cov_fail_under = (
64
+ data.get('tool', {}).get('coverage', {}).get('report', {}).get('fail_under', 90)
65
+ )
66
+
67
+ # --- [tool.bandit] section ---
68
+ bandit_skips = data.get('tool', {}).get('bandit', {}).get('skips', [])
69
+ bandit_skip_flag = f"-s {','.join(bandit_skips)}" if bandit_skips else ""
70
+
71
+ # Write to GITHUB_OUTPUT for composite action outputs
72
+ with open(os.environ['GITHUB_OUTPUT'], 'a', encoding='utf-8') as out:
73
+ out.write(f"PROJECT_NAME={project}\n")
74
+ out.write(f"PACKAGE_MODULE={module}\n")
75
+ out.write(f"CLI_BIN={cli_bin}\n")
76
+ out.write(f"SRC_PATH={src_path}\n")
77
+ out.write(f"PYTEST_VERBOSITY={pytest_verbosity}\n")
78
+ out.write(f"COV_REPORT_FILE={cov_report_file}\n")
79
+ out.write(f"COV_FAIL_UNDER={cov_fail_under}\n")
80
+ out.write(f"BANDIT_SKIP_FLAG={bandit_skip_flag}\n")
81
+
82
+ # Also write to GITHUB_ENV so subsequent steps can use ${{ env.VAR }}
83
+ with open(os.environ['GITHUB_ENV'], 'a', encoding='utf-8') as env:
84
+ env.write(f"PROJECT_NAME={project}\n")
85
+ env.write(f"PACKAGE_MODULE={module}\n")
86
+ env.write(f"CLI_BIN={cli_bin}\n")
87
+ env.write(f"SRC_PATH={src_path}\n")
88
+ env.write(f"PYTEST_VERBOSITY={pytest_verbosity}\n")
89
+ env.write(f"COV_REPORT_FILE={cov_report_file}\n")
90
+ env.write(f"COV_FAIL_UNDER={cov_fail_under}\n")
91
+ env.write(f"BANDIT_SKIP_FLAG={bandit_skip_flag}\n")
@@ -6,7 +6,7 @@ on:
6
6
  pull_request:
7
7
  branches: [ main, master ]
8
8
  schedule:
9
- - cron: "0 7 * * 1"
9
+ - cron: "47 3 * * 5" # Every Friday at 03:47 UTC
10
10
 
11
11
  jobs:
12
12
  test:
@@ -0,0 +1,287 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [ main, master ]
6
+ pull_request:
7
+ branches: [ main, master ]
8
+ schedule:
9
+ # Run daily at 3:17 AM UTC (off-peak hours, odd minute to avoid congestion)
10
+ - cron: '17 3 * * *'
11
+
12
+ jobs:
13
+ test:
14
+ name: Tests (Python ${{ matrix.python }}, ${{ matrix.os }})
15
+ runs-on: ${{ matrix.os }}
16
+ strategy:
17
+ fail-fast: false
18
+ matrix:
19
+ os: [ubuntu-latest, macos-latest, windows-latest]
20
+ # Test against all supported Python versions (3.10+)
21
+ python: ["3.10", "3.11", "3.12", "3.13", "3.14"]
22
+ env:
23
+ PYO3_USE_ABI3_FORWARD_COMPATIBILITY: "1"
24
+ PYTHONIOENCODING: "utf-8"
25
+ UV_LINK_MODE: "copy"
26
+ steps:
27
+ - uses: actions/checkout@v6
28
+ - uses: actions/setup-python@v6
29
+ with:
30
+ python-version: ${{ matrix.python }}
31
+ - name: Install uv
32
+ uses: astral-sh/setup-uv@v7
33
+ with:
34
+ enable-cache: true
35
+ prune-cache: false
36
+
37
+ - name: Install tomli (Python < 3.11)
38
+ shell: bash
39
+ run: python -c "import tomllib" 2>/dev/null || uv pip install tomli --system
40
+
41
+ - name: Extract project metadata
42
+ id: metadata
43
+ uses: ./.github/actions/extract-metadata
44
+
45
+ - name: Install journald prerequisites
46
+ if: runner.os == 'Linux'
47
+ shell: bash
48
+ run: |
49
+ sudo apt-get update
50
+ sudo apt-get install -y python3-systemd
51
+
52
+ - name: Install dev deps
53
+ shell: bash
54
+ run: |
55
+ uv pip install -e .[dev] --system
56
+
57
+ - name: Install Windows Event Log prerequisites
58
+ if: runner.os == 'Windows'
59
+ shell: bash
60
+ run: |
61
+ uv pip install pywin32 --system
62
+
63
+ - name: Restore ruff cache
64
+ id: ruff-cache
65
+ uses: actions/cache/restore@v5
66
+ with:
67
+ path: .ruff_cache
68
+ key: ruff-${{ runner.os }}-py${{ matrix.python }}-${{ github.sha }}
69
+ restore-keys: |
70
+ ruff-${{ runner.os }}-py${{ matrix.python }}-
71
+ ruff-${{ runner.os }}-
72
+
73
+ - name: Run ruff (lint + format)
74
+ id: ruff
75
+ continue-on-error: true
76
+ shell: bash
77
+ run: |
78
+ ruff check .
79
+ ruff format --check .
80
+
81
+ - name: Run pyright (type check)
82
+ id: pyright
83
+ continue-on-error: true
84
+ shell: bash
85
+ run: pyright
86
+
87
+ - name: Run pytest (tests + coverage)
88
+ id: pytest
89
+ continue-on-error: true
90
+ shell: bash
91
+ env:
92
+ TEST_VERBOSE: "1"
93
+ # Write coverage SQLite database to local disk — network mounts
94
+ # and stale journal files cause "database is locked" errors.
95
+ COVERAGE_FILE: "${{ runner.temp }}/.coverage"
96
+ run: >-
97
+ python -m pytest -m "not local_only"
98
+ --cov=${{ env.SRC_PATH }}/${{ env.PACKAGE_MODULE }}
99
+ --cov-report=term-missing
100
+ --cov-report=xml:${{ env.COV_REPORT_FILE }}
101
+ --cov-fail-under=${{ env.COV_FAIL_UNDER }}
102
+ ${{ env.PYTEST_VERBOSITY }}
103
+
104
+ - name: Upload coverage to Codecov
105
+ if: >-
106
+ always()
107
+ && steps.pytest.outcome == 'success'
108
+ && matrix.os == 'ubuntu-latest'
109
+ && matrix.python == '3.13'
110
+ uses: codecov/codecov-action@v5
111
+ with:
112
+ files: ${{ env.COV_REPORT_FILE }}
113
+ fail_ci_if_error: false
114
+
115
+ - name: Run import-linter (architecture)
116
+ id: importlinter
117
+ continue-on-error: true
118
+ shell: bash
119
+ run: lint-imports
120
+
121
+ - name: Run bandit (security scan)
122
+ id: bandit
123
+ continue-on-error: true
124
+ shell: bash
125
+ run: bandit -q -r ${{ env.SRC_PATH }}/${{ env.PACKAGE_MODULE }} ${{ env.BANDIT_SKIP_FLAG }}
126
+
127
+ - name: Run pip-audit (vulnerability scan)
128
+ id: pipaudit
129
+ continue-on-error: true
130
+ shell: python
131
+ run: |
132
+ import subprocess, sys
133
+ try:
134
+ import tomllib
135
+ except ModuleNotFoundError:
136
+ import tomli as tomllib
137
+ with open("pyproject.toml", "rb") as f:
138
+ data = tomllib.load(f)
139
+ vulns = data.get("tool", {}).get("pip-audit", {}).get("ignore-vulns", [])
140
+ cmd = ["pip-audit", "--skip-editable"]
141
+ for v in vulns:
142
+ cmd.extend(["--ignore-vuln", v])
143
+ sys.exit(subprocess.call(cmd))
144
+
145
+ - name: Check all steps passed
146
+ shell: bash
147
+ run: |
148
+ if [[ "${{ steps.ruff.outcome }}" != "success" ]]; then
149
+ echo "::error::Ruff check failed"
150
+ exit 1
151
+ fi
152
+ if [[ "${{ steps.pyright.outcome }}" != "success" ]]; then
153
+ echo "::error::Pyright check failed"
154
+ exit 1
155
+ fi
156
+ if [[ "${{ steps.pytest.outcome }}" != "success" ]]; then
157
+ echo "::error::Pytest failed"
158
+ exit 1
159
+ fi
160
+ if [[ "${{ steps.importlinter.outcome }}" != "success" ]]; then
161
+ echo "::error::Import-linter check failed"
162
+ exit 1
163
+ fi
164
+ if [[ "${{ steps.bandit.outcome }}" != "success" ]]; then
165
+ echo "::error::Bandit security scan failed"
166
+ exit 1
167
+ fi
168
+ if [[ "${{ steps.pipaudit.outcome }}" != "success" ]]; then
169
+ echo "::error::pip-audit vulnerability scan failed"
170
+ exit 1
171
+ fi
172
+ echo "All checks passed!"
173
+
174
+ - name: Build wheel/sdist
175
+ shell: bash
176
+ run: uv build
177
+
178
+ - name: Verify wheel install in clean env
179
+ shell: bash
180
+ run: |
181
+ uv venv .venv_wheel
182
+ . .venv_wheel/bin/activate 2>/dev/null || . .venv_wheel/Scripts/activate 2>/dev/null
183
+ uv pip install dist/*.whl
184
+ "$CLI_BIN" --version 2>/dev/null || python -m "$PACKAGE_MODULE" --version
185
+
186
+ - name: Prune uv cache
187
+ continue-on-error: true
188
+ shell: bash
189
+ run: uv cache prune --ci
190
+
191
+ - name: Save ruff cache
192
+ if: always() && steps.ruff-cache.outputs.cache-hit != 'true'
193
+ uses: actions/cache/save@v5
194
+ with:
195
+ path: .ruff_cache
196
+ key: ruff-${{ runner.os }}-py${{ matrix.python }}-${{ github.sha }}
197
+
198
+ pipx-uv:
199
+ name: pipx/uv verification (ubuntu)
200
+ runs-on: ubuntu-latest
201
+ steps:
202
+ - uses: actions/checkout@v6
203
+ - uses: actions/setup-python@v6
204
+ with:
205
+ python-version: "3.14"
206
+
207
+ - name: Install uv
208
+ uses: astral-sh/setup-uv@v7
209
+ with:
210
+ enable-cache: true
211
+ prune-cache: false
212
+
213
+ - name: Install tomli (Python < 3.11)
214
+ shell: bash
215
+ run: python -c "import tomllib" 2>/dev/null || uv pip install tomli --system
216
+
217
+ - name: Extract project metadata
218
+ id: metadata
219
+ uses: ./.github/actions/extract-metadata
220
+
221
+ - name: Build wheel
222
+ run: uv build
223
+ - name: pipx install from wheel
224
+ run: |
225
+ uv pip install --system pipx
226
+ pipx ensurepath
227
+ export PATH="$HOME/.local/bin:$PATH"
228
+ pipx install dist/*.whl
229
+ "$CLI_BIN" --version
230
+
231
+ - name: uv tool install
232
+ run: |
233
+ export PATH="$HOME/.local/bin:$PATH"
234
+ uv tool install --force .
235
+ "$CLI_BIN" --version
236
+
237
+ - name: Prune uv cache
238
+ continue-on-error: true
239
+ run: uv cache prune --ci
240
+
241
+ notebooks:
242
+ name: Execute notebooks (ubuntu, Python 3.14)
243
+ runs-on: ubuntu-latest
244
+ steps:
245
+ - uses: actions/checkout@v6
246
+ - uses: actions/setup-python@v6
247
+ with:
248
+ python-version: "3.14"
249
+
250
+ - name: Install uv
251
+ uses: astral-sh/setup-uv@v7
252
+ with:
253
+ enable-cache: true
254
+ prune-cache: false
255
+
256
+ - name: Install notebook runner deps
257
+ run: |
258
+ uv pip install --system nbclient nbformat ipykernel jupyter_client
259
+ python -m ipykernel install --user --name python3 --display-name "Python 3"
260
+ - name: Execute Quickstart notebook
261
+ env:
262
+ PIP_DISABLE_PIP_VERSION_CHECK: "1"
263
+ PIP_NO_INPUT: "1"
264
+ run: |
265
+ python - << 'PY'
266
+ from pathlib import Path
267
+
268
+ import nbformat
269
+ from nbclient import NotebookClient
270
+
271
+ nb_path = Path('notebooks/Quickstart.ipynb')
272
+ if not nb_path.exists():
273
+ raise SystemExit(f"Notebook not found: {nb_path}")
274
+
275
+ notebook = nbformat.read(nb_path, as_version=4)
276
+ client = NotebookClient(
277
+ notebook,
278
+ timeout=900,
279
+ kernel_name='python3',
280
+ allow_errors=False,
281
+ )
282
+ client.execute()
283
+
284
+ out_path = Path('notebooks/Quickstart-executed.ipynb')
285
+ nbformat.write(notebook, out_path)
286
+ print(f"Executed notebook written to: {out_path}")
287
+ PY
@@ -9,35 +9,61 @@ on:
9
9
  workflow_dispatch: {}
10
10
 
11
11
  jobs:
12
- build-and-publish:
12
+ build:
13
13
  runs-on: ubuntu-latest
14
14
  permissions:
15
15
  contents: read
16
+ env:
17
+ UV_LINK_MODE: "copy"
16
18
  steps:
17
19
  - uses: actions/checkout@v6
20
+ - uses: actions/setup-python@v6
21
+ with:
22
+ python-version: '3.14'
23
+
24
+ - name: Install uv
25
+ uses: astral-sh/setup-uv@v7
26
+ with:
27
+ enable-cache: true
28
+ prune-cache: false
29
+
30
+ - name: Build artifacts
31
+ run: uv build
32
+
33
+ - name: Upload artifacts
34
+ uses: actions/upload-artifact@v6
35
+ with:
36
+ name: dist
37
+ path: dist/*
38
+
39
+ - name: Prune uv cache
40
+ continue-on-error: true
41
+ run: uv cache prune --ci
42
+
43
+ publish:
44
+ needs: build
45
+ runs-on: ubuntu-latest
46
+ environment: pypi
47
+ permissions:
48
+ contents: read
49
+ steps:
18
50
  - name: Verify PyPI token is set
19
51
  run: |
20
52
  if [ -z "${{ secrets.PYPI_API_TOKEN }}" ]; then
21
- echo "::error title=Missing PyPI token::Set the PYPI_API_TOKEN secret in GitHub repository settings to enable PyPI publishing on releases."
22
- echo "See: https://docs.github.com/en/actions/security-guides/using-secrets-in-github-actions"
53
+ echo "::error title=Missing PyPI token::Set the PYPI_API_TOKEN secret in GitHub repository settings to enable PyPI publishing on releases."
54
+ echo "See: https://docs.github.com/en/actions/security-guides/using-secrets-in-github-actions"
23
55
  exit 1
24
56
  fi
25
- - uses: actions/setup-python@v6
57
+
58
+ - name: Download artifacts
59
+ uses: actions/download-artifact@v6
26
60
  with:
27
- python-version: '3.13'
28
- - name: Build artifacts
29
- run: |
30
- python -m pip install --upgrade pip build
31
- python -m build
61
+ name: dist
62
+ path: dist/
63
+
32
64
  - name: Publish to PyPI
33
- # Use the rolling major tag to get latest Twine/standards support (e.g., Core Metadata 2.4)
34
65
  uses: pypa/gh-action-pypi-publish@release/v1
35
66
  with:
36
67
  password: ${{ secrets.PYPI_API_TOKEN }}
37
68
  attestations: false
38
69
  skip-existing: true
39
- - name: Upload artifacts
40
- uses: actions/upload-artifact@v6
41
- with:
42
- name: dist
43
- path: dist/*
@@ -1,5 +1,19 @@
1
1
  # Changelog
2
2
 
3
+ ## [2.1.3] - 2026-02-01
4
+
5
+ ### Fixed
6
+ - Fixed pyright errors in `test_metadata.py` by replacing `tomllib` (Python 3.11+) with `rtoml` for Python 3.10 compatibility
7
+
8
+ ### Added
9
+ - Added `local_only` pytest marker for tests requiring GitHub credentials
10
+ - Created `test_github_integration.py` with dedicated GitHub API integration tests
11
+ - Tests marked `local_only` are excluded from public CI (`default_cicd_public.yml`) but run in `activate_workflows.yml` where secrets are available
12
+
13
+ ### Changed
14
+ - Excluded `keep_github_workflow_active.py` from doctest collection (doctests access GitHub API when credentials available)
15
+ - Added setuptools vulnerability exceptions to pip-audit (PYSEC-2022-43012, PYSEC-2025-49, CVE-2024-6345) - transitive dependency pinned by build tools
16
+
3
17
  ## [2.1.2] - 2025-12-15
4
18
 
5
19
  ### Changed
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: keep_github_workflows_active
3
- Version: 2.1.2
3
+ Version: 2.1.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
@@ -15,23 +15,23 @@ Classifier: Operating System :: OS Independent
15
15
  Classifier: Programming Language :: Python :: 3
16
16
  Classifier: Programming Language :: Python :: 3 :: Only
17
17
  Classifier: Typing :: Typed
18
- Requires-Python: >=3.13
19
- Requires-Dist: lib-cli-exit-tools>=2.2.2
18
+ Requires-Python: >=3.10
19
+ Requires-Dist: lib-cli-exit-tools>=2.2.4
20
20
  Requires-Dist: pydantic>=2.12.5
21
21
  Requires-Dist: requests>=2.32.5
22
- Requires-Dist: rich-click>=1.9.4
22
+ Requires-Dist: rich-click>=1.9.7
23
23
  Provides-Extra: dev
24
- Requires-Dist: bandit>=1.9.2; extra == 'dev'
25
- Requires-Dist: build>=1.3.0; extra == 'dev'
24
+ Requires-Dist: bandit>=1.9.3; extra == 'dev'
25
+ Requires-Dist: build>=1.4.0; extra == 'dev'
26
26
  Requires-Dist: codecov-cli>=11.2.6; extra == 'dev'
27
27
  Requires-Dist: import-linter>=2.9; extra == 'dev'
28
28
  Requires-Dist: pip-audit>=2.10.0; extra == 'dev'
29
- Requires-Dist: pyright>=1.1.407; extra == 'dev'
29
+ Requires-Dist: pyright[nodejs]>=1.1.408; extra == 'dev'
30
30
  Requires-Dist: pytest-cov>=7.0.0; extra == 'dev'
31
31
  Requires-Dist: pytest>=9.0.2; extra == 'dev'
32
32
  Requires-Dist: rtoml>=0.13.0; extra == 'dev'
33
- Requires-Dist: ruff>=0.14.9; extra == 'dev'
34
- Requires-Dist: textual>=6.9.0; extra == 'dev'
33
+ Requires-Dist: ruff>=0.14.14; extra == 'dev'
34
+ Requires-Dist: textual>=7.5.0; extra == 'dev'
35
35
  Requires-Dist: twine>=6.2.0; extra == 'dev'
36
36
  Description-Content-Type: text/markdown
37
37
 
@@ -1,10 +1,10 @@
1
1
  [project]
2
2
  name = "keep_github_workflows_active"
3
- version = "2.1.2"
3
+ version = "2.1.3"
4
4
  description = "Template for python apps with registered cli commands"
5
5
  readme = "README.md"
6
- requires-python = ">=3.13"
7
- dependencies = ["rich-click>=1.9.4", "lib_cli_exit_tools>=2.2.2", "requests>=2.32.5", "pydantic>=2.12.5"]
6
+ requires-python = ">=3.10"
7
+ dependencies = ["rich-click>=1.9.7", "lib_cli_exit_tools>=2.2.4", "requests>=2.32.5", "pydantic>=2.12.5"]
8
8
  license = { text = "MIT" }
9
9
  authors = [{ name = "bitranox", email = "bitranox@gmail.com" }]
10
10
  keywords = ["logging", "rich", "cli", "terminal", "ansi"]
@@ -26,14 +26,14 @@ Issues = "https://github.com/bitranox/keep_github_workflows_active/issues"
26
26
  dev = [
27
27
  "pytest>=9.0.2",
28
28
  "pytest-cov>=7.0.0",
29
- "ruff>=0.14.9",
30
- "pyright>=1.1.407",
31
- "bandit>=1.9.2",
32
- "build>=1.3.0",
29
+ "ruff>=0.14.14",
30
+ "pyright[nodejs]>=1.1.408",
31
+ "bandit>=1.9.3",
32
+ "build>=1.4.0",
33
33
  "twine>=6.2.0",
34
34
  "codecov-cli>=11.2.6",
35
35
  "pip-audit>=2.10.0",
36
- "textual>=6.9.0",
36
+ "textual>=7.5.0",
37
37
  "import-linter>=2.9",
38
38
  "rtoml>=0.13.0"
39
39
  ]
@@ -70,7 +70,7 @@ exclude = [
70
70
  ]
71
71
 
72
72
  [tool.pytest.ini_options]
73
- addopts = ["--doctest-modules"]
73
+ addopts = ["--doctest-modules", "--ignore=src/keep_github_workflows_active/keep_github_workflow_active.py"]
74
74
  doctest_optionflags = ["ELLIPSIS", "NORMALIZE_WHITESPACE"]
75
75
  pythonpath = ["src"]
76
76
  markers = [
@@ -79,6 +79,7 @@ markers = [
79
79
  "os_macos: test exercises macOS-only behavior",
80
80
  "os_posix: test exercises behavior requiring POSIX semantics",
81
81
  "os_linux: test exercises Linux-only behavior",
82
+ "local_only: test requires local credentials or resources unavailable in CI",
82
83
  ]
83
84
 
84
85
  [tool.coverage.run]
@@ -142,4 +143,8 @@ layers = [
142
143
  # Known vulnerabilities to ignore (unfixable or accepted risk)
143
144
  # GHSA-4xh5-x5gv-qwph: py library ReDoS (no fix available, low risk)
144
145
  # PYSEC-2022-42969: same as above (alias)
145
- ignore-vulns = ["GHSA-4xh5-x5gv-qwph", "PYSEC-2022-42969"]
146
+ # setuptools 65.5.0: transitive dep, pinned by build tools
147
+ # PYSEC-2022-43012: fixed in 65.5.1
148
+ # PYSEC-2025-49: fixed in 78.1.1
149
+ # CVE-2024-6345: fixed in 70.0.0
150
+ ignore-vulns = ["GHSA-4xh5-x5gv-qwph", "PYSEC-2022-42969", "PYSEC-2022-43012", "PYSEC-2025-49", "CVE-2024-6345"]
@@ -24,7 +24,7 @@ name = "keep_github_workflows_active"
24
24
  #: Human-readable summary shown in CLI help output.
25
25
  title = "Template for python apps with registered cli commands"
26
26
  #: Current release version pulled from ``pyproject.toml`` by automation.
27
- version = "2.1.2"
27
+ version = "2.1.3"
28
28
  #: Repository homepage presented to users.
29
29
  homepage = "https://github.com/bitranox/keep_github_workflows_active"
30
30
  #: Author attribution surfaced in CLI output.
@@ -0,0 +1,90 @@
1
+ """GitHub API integration tests requiring real credentials.
2
+
3
+ These tests exercise the actual GitHub API and require:
4
+ - SECRET_GITHUB_OWNER environment variable or .env entry
5
+ - SECRET_GITHUB_TOKEN environment variable or .env entry
6
+
7
+ Marked with local_only to exclude from CI runs.
8
+ """
9
+
10
+ from __future__ import annotations
11
+
12
+ import pytest
13
+
14
+ from keep_github_workflows_active import keep_github_workflow_active as keep_active
15
+
16
+
17
+ def _has_github_credentials() -> bool:
18
+ """Check if GitHub credentials are available."""
19
+ try:
20
+ keep_active.get_owner()
21
+ keep_active.get_github_token()
22
+ return True
23
+ except RuntimeError:
24
+ return False
25
+
26
+
27
+ pytestmark = [pytest.mark.local_only]
28
+
29
+
30
+ @pytest.mark.skipif(not _has_github_credentials(), reason="GitHub credentials not available")
31
+ def test_get_repositories_returns_list() -> None:
32
+ """Verify get_repositories returns a list of repository names."""
33
+ owner = keep_active.get_owner()
34
+ token = keep_active.get_github_token()
35
+
36
+ repos = keep_active.get_repositories(owner=owner, github_token=token)
37
+
38
+ assert isinstance(repos, list)
39
+
40
+
41
+ @pytest.mark.skipif(not _has_github_credentials(), reason="GitHub credentials not available")
42
+ def test_get_workflows_returns_list_for_each_repository() -> None:
43
+ """Verify get_workflows returns workflow filenames for repositories."""
44
+ owner = keep_active.get_owner()
45
+ token = keep_active.get_github_token()
46
+ repos = keep_active.get_repositories(owner=owner, github_token=token)
47
+
48
+ for repo in repos[:3]: # Limit to first 3 repos to avoid rate limits
49
+ workflows = keep_active.get_workflows(owner=owner, repository=repo, github_token=token)
50
+ assert isinstance(workflows, list)
51
+
52
+
53
+ @pytest.mark.skipif(not _has_github_credentials(), reason="GitHub credentials not available")
54
+ def test_get_workflow_runs_returns_list_for_each_repository() -> None:
55
+ """Verify get_workflow_runs returns run IDs for repositories."""
56
+ owner = keep_active.get_owner()
57
+ token = keep_active.get_github_token()
58
+ repos = keep_active.get_repositories(owner=owner, github_token=token)
59
+
60
+ for repo in repos[:3]: # Limit to first 3 repos to avoid rate limits
61
+ run_ids = keep_active.get_workflow_runs(owner=owner, repository=repo, github_token=token)
62
+ assert isinstance(run_ids, list)
63
+
64
+
65
+ @pytest.mark.skipif(not _has_github_credentials(), reason="GitHub credentials not available")
66
+ def test_enable_all_workflows_completes_without_error(capsys: pytest.CaptureFixture[str]) -> None:
67
+ """Verify enable_all_workflows runs successfully."""
68
+ owner = keep_active.get_owner()
69
+ token = keep_active.get_github_token()
70
+
71
+ keep_active.enable_all_workflows(owner=owner, github_token=token)
72
+
73
+ captured = capsys.readouterr()
74
+ assert f"Activating and maintaining all workflows for owner {owner}" in captured.out
75
+
76
+
77
+ @pytest.mark.skipif(not _has_github_credentials(), reason="GitHub credentials not available")
78
+ def test_enable_workflow_handles_known_repository() -> None:
79
+ """Verify enable_workflow returns success message for a known workflow."""
80
+ owner = keep_active.get_owner()
81
+ token = keep_active.get_github_token()
82
+
83
+ result = keep_active.enable_workflow(
84
+ owner=owner,
85
+ repository="lib_path",
86
+ workflow_filename="python-package.yml",
87
+ github_token=token,
88
+ )
89
+
90
+ assert result # Non-empty result message
@@ -5,9 +5,9 @@ from __future__ import annotations
5
5
  from pathlib import Path
6
6
  from typing import Any, cast
7
7
  import runpy
8
- import tomllib
9
8
 
10
9
  import pytest
10
+ import rtoml
11
11
 
12
12
  PROJECT_ROOT = Path(__file__).resolve().parent.parent
13
13
  PYPROJECT_PATH = PROJECT_ROOT / "pyproject.toml"
@@ -15,8 +15,7 @@ TARGET_FIELDS = ("name", "title", "version", "homepage", "author", "author_email
15
15
 
16
16
 
17
17
  def _load_pyproject() -> dict[str, Any]:
18
- with PYPROJECT_PATH.open("rb") as stream:
19
- return tomllib.load(stream)
18
+ return rtoml.load(PYPROJECT_PATH)
20
19
 
21
20
 
22
21
  def _resolve_init_conf_path(pyproject: dict[str, Any]) -> Path:
@@ -52,7 +51,7 @@ def _load_init_conf_metadata(init_conf_path: Path) -> dict[str, str]:
52
51
  if not fragments:
53
52
  raise AssertionError("No metadata assignments found in __init__conf__.py")
54
53
  metadata_text = "[metadata]\n" + "\n".join(fragments)
55
- parsed = tomllib.loads(metadata_text)
54
+ parsed = rtoml.loads(metadata_text)
56
55
  metadata_table = cast(dict[str, str], parsed["metadata"])
57
56
  return metadata_table
58
57