version-bumper 0.3.1__tar.gz → 0.3.2__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.
- version_bumper-0.3.2/.github/workflows/ci.yml +135 -0
- version_bumper-0.3.2/.github/workflows/coverage-badge.yml +77 -0
- version_bumper-0.3.2/.github/workflows/docs.yml +68 -0
- {version_bumper-0.3.1 → version_bumper-0.3.2}/.github/workflows/release.yml +8 -36
- {version_bumper-0.3.1 → version_bumper-0.3.2}/CHANGELOG.md +40 -0
- {version_bumper-0.3.1 → version_bumper-0.3.2}/DEV-README.md +23 -5
- {version_bumper-0.3.1 → version_bumper-0.3.2}/PKG-INFO +5 -2
- {version_bumper-0.3.1 → version_bumper-0.3.2}/README.md +3 -0
- {version_bumper-0.3.1 → version_bumper-0.3.2}/Taskfile.yml +0 -3
- {version_bumper-0.3.1 → version_bumper-0.3.2}/pyproject.toml +2 -2
- {version_bumper-0.3.1 → version_bumper-0.3.2}/scripts/dev-metrics.py +164 -12
- {version_bumper-0.3.1 → version_bumper-0.3.2}/taskfiles/Taskfile-release.yml +16 -3
- {version_bumper-0.3.1 → version_bumper-0.3.2}/taskfiles/helpers/task-docs-helper.py +9 -4
- {version_bumper-0.3.1 → version_bumper-0.3.2}/uv.lock +4 -4
- {version_bumper-0.3.1 → version_bumper-0.3.2}/zensical.toml +6 -0
- {version_bumper-0.3.1 → version_bumper-0.3.2}/.cruft.json +0 -0
- {version_bumper-0.3.1 → version_bumper-0.3.2}/.cruft.json.license +0 -0
- {version_bumper-0.3.1 → version_bumper-0.3.2}/.gitignore +0 -0
- {version_bumper-0.3.1 → version_bumper-0.3.2}/.pre-commit-config.yaml +0 -0
- {version_bumper-0.3.1 → version_bumper-0.3.2}/.pymarkdown.json +0 -0
- {version_bumper-0.3.1 → version_bumper-0.3.2}/.pymarkdown.json.license +0 -0
- {version_bumper-0.3.1 → version_bumper-0.3.2}/.python-versions +0 -0
- {version_bumper-0.3.1 → version_bumper-0.3.2}/.python-versions.license +0 -0
- {version_bumper-0.3.1 → version_bumper-0.3.2}/.shellcheckrc +0 -0
- {version_bumper-0.3.1 → version_bumper-0.3.2}/LICENSES/MIT.txt +0 -0
- {version_bumper-0.3.1 → version_bumper-0.3.2}/docs/DEV-README.md +0 -0
- {version_bumper-0.3.1 → version_bumper-0.3.2}/docs/index.md +0 -0
- {version_bumper-0.3.1 → version_bumper-0.3.2}/scripts/custom_argparse.py +0 -0
- {version_bumper-0.3.1 → version_bumper-0.3.2}/scripts/fail_on_regex_match.sh +0 -0
- {version_bumper-0.3.1 → version_bumper-0.3.2}/scripts/generate_test_docs.py +0 -0
- {version_bumper-0.3.1 → version_bumper-0.3.2}/scripts/latest_pypi_version.sh +0 -0
- {version_bumper-0.3.1 → version_bumper-0.3.2}/scripts/metrics_cc_filter.py +0 -0
- {version_bumper-0.3.1 → version_bumper-0.3.2}/scripts/run-mypy-all-python-versions.sh +0 -0
- {version_bumper-0.3.1 → version_bumper-0.3.2}/scripts/swap_build_system.py +0 -0
- {version_bumper-0.3.1 → version_bumper-0.3.2}/scripts/venv_runner.sh +0 -0
- {version_bumper-0.3.1 → version_bumper-0.3.2}/src/version_bumper/__init__.py +0 -0
- {version_bumper-0.3.1 → version_bumper-0.3.2}/src/version_bumper/__main__.py +0 -0
- {version_bumper-0.3.1 → version_bumper-0.3.2}/src/version_bumper/clibones/__init__.py +0 -0
- {version_bumper-0.3.1 → version_bumper-0.3.2}/src/version_bumper/clibones/application_settings.py +0 -0
- {version_bumper-0.3.1 → version_bumper-0.3.2}/src/version_bumper/clibones/config_file.py +0 -0
- {version_bumper-0.3.1 → version_bumper-0.3.2}/src/version_bumper/clibones/config_file_base.py +0 -0
- {version_bumper-0.3.1 → version_bumper-0.3.2}/src/version_bumper/clibones/info_control.py +0 -0
- {version_bumper-0.3.1 → version_bumper-0.3.2}/src/version_bumper/clibones/json_config_file.py +0 -0
- {version_bumper-0.3.1 → version_bumper-0.3.2}/src/version_bumper/clibones/logger_control.py +0 -0
- {version_bumper-0.3.1 → version_bumper-0.3.2}/src/version_bumper/clibones/toml_config_file.py +0 -0
- {version_bumper-0.3.1 → version_bumper-0.3.2}/src/version_bumper/commands.py +0 -0
- {version_bumper-0.3.1 → version_bumper-0.3.2}/src/version_bumper/py.typed +0 -0
- {version_bumper-0.3.1 → version_bumper-0.3.2}/src/version_bumper/pyproject.py +0 -0
- {version_bumper-0.3.1 → version_bumper-0.3.2}/src/version_bumper/version.py +0 -0
- {version_bumper-0.3.1 → version_bumper-0.3.2}/taskfiles/Taskfile-docs.yml +0 -0
- {version_bumper-0.3.1 → version_bumper-0.3.2}/taskfiles/Taskfile-env.yml +0 -0
- {version_bumper-0.3.1 → version_bumper-0.3.2}/taskfiles/Taskfile-format.yml +0 -0
- {version_bumper-0.3.1 → version_bumper-0.3.2}/taskfiles/Taskfile-git.yml +0 -0
- {version_bumper-0.3.1 → version_bumper-0.3.2}/taskfiles/Taskfile-lint.yml +0 -0
- {version_bumper-0.3.1 → version_bumper-0.3.2}/taskfiles/Taskfile-metrics.yml +0 -0
- {version_bumper-0.3.1 → version_bumper-0.3.2}/taskfiles/Taskfile-test.yml +0 -0
- {version_bumper-0.3.1 → version_bumper-0.3.2}/taskfiles/Taskfile-version.yml +0 -0
- {version_bumper-0.3.1 → version_bumper-0.3.2}/taskfiles/helpers/task-env-helper.py +0 -0
- {version_bumper-0.3.1 → version_bumper-0.3.2}/taskfiles/helpers/task-format-helper.py +0 -0
- {version_bumper-0.3.1 → version_bumper-0.3.2}/taskfiles/helpers/task-helper.py +0 -0
- {version_bumper-0.3.1 → version_bumper-0.3.2}/taskfiles/helpers/task-lint-helper.py +0 -0
- {version_bumper-0.3.1 → version_bumper-0.3.2}/taskfiles/helpers/task-metrics-helper.py +0 -0
- {version_bumper-0.3.1 → version_bumper-0.3.2}/taskfiles/helpers/task-version-helper.py +0 -0
- {version_bumper-0.3.1 → version_bumper-0.3.2}/tests/config_1.toml +0 -0
- {version_bumper-0.3.1 → version_bumper-0.3.2}/tests/config_2.toml +0 -0
- {version_bumper-0.3.1 → version_bumper-0.3.2}/tests/config_3.toml +0 -0
- {version_bumper-0.3.1 → version_bumper-0.3.2}/tests/config_4.toml +0 -0
- {version_bumper-0.3.1 → version_bumper-0.3.2}/tests/conftest.py +0 -0
- {version_bumper-0.3.1 → version_bumper-0.3.2}/tests/good_pyproject.toml +0 -0
- {version_bumper-0.3.1 → version_bumper-0.3.2}/tests/test_app_version.py +0 -0
- {version_bumper-0.3.1 → version_bumper-0.3.2}/tests/test_commands.py +0 -0
- {version_bumper-0.3.1 → version_bumper-0.3.2}/tests/test_config_file.py +0 -0
- {version_bumper-0.3.1 → version_bumper-0.3.2}/tests/test_info_control.py +0 -0
- {version_bumper-0.3.1 → version_bumper-0.3.2}/tests/test_logger_control.py +0 -0
- {version_bumper-0.3.1 → version_bumper-0.3.2}/tests/test_main.py +0 -0
- {version_bumper-0.3.1 → version_bumper-0.3.2}/tests/test_pyproject.py +0 -0
- {version_bumper-0.3.1 → version_bumper-0.3.2}/tests/test_version.py +0 -0
- {version_bumper-0.3.1 → version_bumper-0.3.2}/tox.ini +0 -0
- {version_bumper-0.3.1 → version_bumper-0.3.2}/uv.lock.license +0 -0
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
# SPDX-FileCopyrightText: 2026 Roy Wright
|
|
2
|
+
#
|
|
3
|
+
# SPDX-License-Identifier: MIT
|
|
4
|
+
|
|
5
|
+
# CI: runs on every push to main and on every pull request, and is called by the release
|
|
6
|
+
# workflow to check the tagged commit before it is published.
|
|
7
|
+
# - lint: every pre-commit hook (ruff, ruff-format, mypy for each Python version,
|
|
8
|
+
# prettier, codespell, reuse, ...), failing on any change a hook would make
|
|
9
|
+
# - complexity: task metrics:complexity (no function above complexity 5)
|
|
10
|
+
# - docs: task docs:build, which fails on any zensical warning (--strict), such as a
|
|
11
|
+
# broken link or a docstring cross-reference that does not resolve
|
|
12
|
+
# - test: the tests under every Python version in .python-versions, failing below
|
|
13
|
+
# the coverage floor in pyproject.toml; on main, the first version's coverage
|
|
14
|
+
# report is saved for the README's coverage badge (coverage-badge.yml)
|
|
15
|
+
|
|
16
|
+
name: CI
|
|
17
|
+
|
|
18
|
+
on:
|
|
19
|
+
push:
|
|
20
|
+
branches: [main]
|
|
21
|
+
pull_request:
|
|
22
|
+
workflow_call:
|
|
23
|
+
inputs:
|
|
24
|
+
ref:
|
|
25
|
+
description: "The git ref to check out, ex: a release tag"
|
|
26
|
+
required: true
|
|
27
|
+
type: string
|
|
28
|
+
|
|
29
|
+
permissions:
|
|
30
|
+
contents: read
|
|
31
|
+
|
|
32
|
+
env:
|
|
33
|
+
REF: ${{ inputs.ref || github.sha }}
|
|
34
|
+
|
|
35
|
+
jobs:
|
|
36
|
+
lint:
|
|
37
|
+
name: Lint (pre-commit)
|
|
38
|
+
runs-on: ubuntu-latest
|
|
39
|
+
steps:
|
|
40
|
+
- uses: actions/checkout@v7
|
|
41
|
+
with:
|
|
42
|
+
ref: ${{ env.REF }}
|
|
43
|
+
persist-credentials: false
|
|
44
|
+
- uses: astral-sh/setup-uv@v10.4.2 # setup-uv publishes no major-version tag
|
|
45
|
+
- name: Install
|
|
46
|
+
run: |
|
|
47
|
+
uv sync --locked --all-extras
|
|
48
|
+
# pre-commit's python hooks run on python3.12 (default_language_version)
|
|
49
|
+
uv python install 3.12
|
|
50
|
+
- uses: actions/cache@v6
|
|
51
|
+
with:
|
|
52
|
+
path: ~/.cache/pre-commit
|
|
53
|
+
key: pre-commit-${{ hashFiles('.pre-commit-config.yaml') }}
|
|
54
|
+
- name: Run pre-commit
|
|
55
|
+
run: uv run --no-sync pre-commit run --all-files --show-diff-on-failure
|
|
56
|
+
|
|
57
|
+
complexity:
|
|
58
|
+
name: Complexity
|
|
59
|
+
runs-on: ubuntu-latest
|
|
60
|
+
steps:
|
|
61
|
+
- uses: actions/checkout@v7
|
|
62
|
+
with:
|
|
63
|
+
ref: ${{ env.REF }}
|
|
64
|
+
persist-credentials: false
|
|
65
|
+
- uses: astral-sh/setup-uv@v10.4.2 # setup-uv publishes no major-version tag
|
|
66
|
+
- uses: go-task/setup-task@v2
|
|
67
|
+
with:
|
|
68
|
+
repo-token: ${{ github.token }}
|
|
69
|
+
- name: Install
|
|
70
|
+
run: uv sync --locked --all-extras
|
|
71
|
+
- name: Check complexity
|
|
72
|
+
run: task metrics:complexity
|
|
73
|
+
|
|
74
|
+
docs:
|
|
75
|
+
name: Docs
|
|
76
|
+
runs-on: ubuntu-latest
|
|
77
|
+
steps:
|
|
78
|
+
- uses: actions/checkout@v7
|
|
79
|
+
with:
|
|
80
|
+
ref: ${{ env.REF }}
|
|
81
|
+
persist-credentials: false
|
|
82
|
+
- uses: astral-sh/setup-uv@v10.4.2 # setup-uv publishes no major-version tag
|
|
83
|
+
- uses: go-task/setup-task@v2
|
|
84
|
+
with:
|
|
85
|
+
repo-token: ${{ github.token }}
|
|
86
|
+
- name: Install
|
|
87
|
+
run: uv sync --locked --all-extras
|
|
88
|
+
- name: Build the docs (zensical --strict fails on any warning)
|
|
89
|
+
run: task docs:build
|
|
90
|
+
|
|
91
|
+
python-versions:
|
|
92
|
+
name: Read .python-versions
|
|
93
|
+
runs-on: ubuntu-latest
|
|
94
|
+
outputs:
|
|
95
|
+
versions: ${{ steps.read.outputs.versions }}
|
|
96
|
+
steps:
|
|
97
|
+
- uses: actions/checkout@v7
|
|
98
|
+
with:
|
|
99
|
+
ref: ${{ env.REF }}
|
|
100
|
+
persist-credentials: false
|
|
101
|
+
- id: read
|
|
102
|
+
run: |
|
|
103
|
+
versions=$(python3 -c 'import json, re, sys; print(json.dumps(re.findall(r"^\d+\.\d+", sys.stdin.read(), re.M)))' < .python-versions)
|
|
104
|
+
echo "versions=${versions}" >> "$GITHUB_OUTPUT"
|
|
105
|
+
echo "Testing with: ${versions}"
|
|
106
|
+
|
|
107
|
+
test:
|
|
108
|
+
name: Test (Python ${{ matrix.python }})
|
|
109
|
+
needs: python-versions
|
|
110
|
+
runs-on: ubuntu-latest
|
|
111
|
+
strategy:
|
|
112
|
+
fail-fast: false
|
|
113
|
+
matrix:
|
|
114
|
+
python: ${{ fromJSON(needs.python-versions.outputs.versions) }}
|
|
115
|
+
steps:
|
|
116
|
+
- uses: actions/checkout@v7
|
|
117
|
+
with:
|
|
118
|
+
ref: ${{ env.REF }}
|
|
119
|
+
persist-credentials: false
|
|
120
|
+
- uses: astral-sh/setup-uv@v10.4.2 # setup-uv publishes no major-version tag
|
|
121
|
+
- name: Install
|
|
122
|
+
run: uv sync --locked --all-extras --python ${{ matrix.python }}
|
|
123
|
+
- name: Test (fails below the coverage floor in pyproject.toml)
|
|
124
|
+
run:
|
|
125
|
+
uv run --no-sync pytest --cov=version_bumper --cov-report=term-missing
|
|
126
|
+
--cov-report=json:coverage.json
|
|
127
|
+
# coverage-badge.yml publishes this as the README's coverage badge
|
|
128
|
+
- if:
|
|
129
|
+
github.event_name == 'push' && github.ref == 'refs/heads/main' &&
|
|
130
|
+
strategy.job-index == 0
|
|
131
|
+
uses: actions/upload-artifact@v7
|
|
132
|
+
with:
|
|
133
|
+
name: coverage
|
|
134
|
+
path: coverage.json
|
|
135
|
+
if-no-files-found: error
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
# SPDX-FileCopyrightText: 2026 Roy Wright
|
|
2
|
+
#
|
|
3
|
+
# SPDX-License-Identifier: MIT
|
|
4
|
+
|
|
5
|
+
# Coverage badge: after CI passes on a push to main, turn its coverage report into a
|
|
6
|
+
# shields.io endpoint file (https://shields.io/badges/endpoint-badge) and force-push it
|
|
7
|
+
# to the "badges" branch, which holds only that file. The README's badge reads it from
|
|
8
|
+
# https://raw.githubusercontent.com/royw/version_bumper/badges/coverage.json
|
|
9
|
+
#
|
|
10
|
+
# This is a separate workflow, not a job in ci.yml, because it needs write access and
|
|
11
|
+
# the release workflow calls ci.yml with read access only.
|
|
12
|
+
|
|
13
|
+
name: Coverage badge
|
|
14
|
+
|
|
15
|
+
on:
|
|
16
|
+
workflow_run:
|
|
17
|
+
workflows: [CI]
|
|
18
|
+
types: [completed]
|
|
19
|
+
branches: [main]
|
|
20
|
+
|
|
21
|
+
permissions:
|
|
22
|
+
contents: read
|
|
23
|
+
|
|
24
|
+
concurrency:
|
|
25
|
+
group: coverage-badge
|
|
26
|
+
cancel-in-progress: true
|
|
27
|
+
|
|
28
|
+
jobs:
|
|
29
|
+
badge:
|
|
30
|
+
name: Update coverage badge
|
|
31
|
+
if:
|
|
32
|
+
github.event.workflow_run.conclusion == 'success' &&
|
|
33
|
+
github.event.workflow_run.event == 'push' &&
|
|
34
|
+
github.event.workflow_run.head_repository.full_name == github.repository
|
|
35
|
+
runs-on: ubuntu-latest
|
|
36
|
+
permissions:
|
|
37
|
+
actions: read # download the coverage report from the CI run
|
|
38
|
+
contents: write # push the badges branch
|
|
39
|
+
steps:
|
|
40
|
+
- uses: actions/download-artifact@v8
|
|
41
|
+
with:
|
|
42
|
+
name: coverage
|
|
43
|
+
run-id: ${{ github.event.workflow_run.id }}
|
|
44
|
+
github-token: ${{ github.token }}
|
|
45
|
+
- name: Write the badge file
|
|
46
|
+
run: |
|
|
47
|
+
python3 - <<'EOF'
|
|
48
|
+
import json
|
|
49
|
+
|
|
50
|
+
with open("coverage.json") as f:
|
|
51
|
+
totals = json.load(f)["totals"]
|
|
52
|
+
percent = totals["percent_covered"]
|
|
53
|
+
colors = [(100, "brightgreen"), (90, "green"), (80, "yellowgreen"), (70, "yellow"), (0, "red")]
|
|
54
|
+
color = next(name for floor, name in colors if percent >= floor)
|
|
55
|
+
badge = {
|
|
56
|
+
"schemaVersion": 1,
|
|
57
|
+
"label": "coverage",
|
|
58
|
+
"message": f"{totals['percent_covered_display']}%",
|
|
59
|
+
"color": color,
|
|
60
|
+
}
|
|
61
|
+
with open("badge.json", "w") as f:
|
|
62
|
+
json.dump(badge, f)
|
|
63
|
+
print(badge)
|
|
64
|
+
EOF
|
|
65
|
+
- uses: actions/checkout@v7
|
|
66
|
+
with:
|
|
67
|
+
path: repo
|
|
68
|
+
- name: Push the badges branch
|
|
69
|
+
working-directory: repo
|
|
70
|
+
run: |
|
|
71
|
+
git switch --orphan badges
|
|
72
|
+
mv ../badge.json coverage.json
|
|
73
|
+
git add coverage.json
|
|
74
|
+
git -c user.name="github-actions[bot]" \
|
|
75
|
+
-c user.email="41898282+github-actions[bot]@users.noreply.github.com" \
|
|
76
|
+
commit --quiet -m "coverage badge for ${{ github.event.workflow_run.head_sha }}"
|
|
77
|
+
git push --force origin badges
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
# SPDX-FileCopyrightText: 2026 Roy Wright
|
|
2
|
+
#
|
|
3
|
+
# SPDX-License-Identifier: MIT
|
|
4
|
+
|
|
5
|
+
# Docs: after CI passes on a push to main, build the docs site (task docs:build) and
|
|
6
|
+
# deploy it to GitHub Pages: https://royw.github.io/version_bumper/
|
|
7
|
+
# It can also be run by hand (Actions → Docs → Run workflow) to redeploy main.
|
|
8
|
+
#
|
|
9
|
+
# One-time setup: Settings → Pages → Build and deployment → Source: GitHub Actions.
|
|
10
|
+
|
|
11
|
+
name: Docs
|
|
12
|
+
|
|
13
|
+
on:
|
|
14
|
+
workflow_run:
|
|
15
|
+
workflows: [CI]
|
|
16
|
+
types: [completed]
|
|
17
|
+
branches: [main]
|
|
18
|
+
workflow_dispatch:
|
|
19
|
+
|
|
20
|
+
permissions:
|
|
21
|
+
contents: read
|
|
22
|
+
|
|
23
|
+
# one deployment at a time; a newer push replaces a queued one, but never cancels a
|
|
24
|
+
# deployment that is already running
|
|
25
|
+
concurrency:
|
|
26
|
+
group: pages
|
|
27
|
+
cancel-in-progress: false
|
|
28
|
+
|
|
29
|
+
jobs:
|
|
30
|
+
build:
|
|
31
|
+
name: Build
|
|
32
|
+
if:
|
|
33
|
+
github.event_name == 'workflow_dispatch' ||
|
|
34
|
+
(github.event.workflow_run.conclusion == 'success' &&
|
|
35
|
+
github.event.workflow_run.event == 'push' &&
|
|
36
|
+
github.event.workflow_run.head_repository.full_name == github.repository)
|
|
37
|
+
runs-on: ubuntu-latest
|
|
38
|
+
steps:
|
|
39
|
+
- uses: actions/checkout@v7
|
|
40
|
+
with:
|
|
41
|
+
ref: ${{ github.event.workflow_run.head_sha || github.sha }}
|
|
42
|
+
persist-credentials: false
|
|
43
|
+
- uses: astral-sh/setup-uv@v10.4.2 # setup-uv publishes no major-version tag
|
|
44
|
+
- uses: go-task/setup-task@v2
|
|
45
|
+
with:
|
|
46
|
+
repo-token: ${{ github.token }}
|
|
47
|
+
- name: Install
|
|
48
|
+
run: uv sync --locked --all-extras
|
|
49
|
+
- name: Build the docs
|
|
50
|
+
run: task docs:build
|
|
51
|
+
- uses: actions/configure-pages@v6
|
|
52
|
+
- uses: actions/upload-pages-artifact@v5
|
|
53
|
+
with:
|
|
54
|
+
path: site/
|
|
55
|
+
|
|
56
|
+
deploy:
|
|
57
|
+
name: Deploy to GitHub Pages
|
|
58
|
+
needs: build
|
|
59
|
+
runs-on: ubuntu-latest
|
|
60
|
+
environment:
|
|
61
|
+
name: github-pages
|
|
62
|
+
url: ${{ steps.deployment.outputs.page_url }}
|
|
63
|
+
permissions:
|
|
64
|
+
pages: write
|
|
65
|
+
id-token: write
|
|
66
|
+
steps:
|
|
67
|
+
- id: deployment
|
|
68
|
+
uses: actions/deploy-pages@v5
|
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
# SPDX-License-Identifier: MIT
|
|
4
4
|
|
|
5
5
|
# Release workflow: `task release:tag` pushes a vX.Y.Z tag, which runs this workflow to
|
|
6
|
-
# 1.
|
|
6
|
+
# 1. check the tagged commit with the CI workflow (lint, complexity, and the tests
|
|
7
|
+
# under every Python version in .python-versions),
|
|
7
8
|
# 2. build the wheel and sdist, checking the tag matches the project version,
|
|
8
9
|
# 3. publish them to PyPI (trusted publishing, no API token),
|
|
9
10
|
# 4. create the GitHub release, with the CHANGELOG section as its notes.
|
|
@@ -40,44 +41,15 @@ env:
|
|
|
40
41
|
TAG: ${{ inputs.tag || github.ref_name }}
|
|
41
42
|
|
|
42
43
|
jobs:
|
|
43
|
-
|
|
44
|
-
name:
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
steps:
|
|
49
|
-
- uses: actions/checkout@v7
|
|
50
|
-
with:
|
|
51
|
-
ref: ${{ env.TAG }}
|
|
52
|
-
persist-credentials: false
|
|
53
|
-
- id: read
|
|
54
|
-
run: |
|
|
55
|
-
versions=$(python3 -c 'import json, re, sys; print(json.dumps(re.findall(r"^\d+\.\d+", sys.stdin.read(), re.M)))' < .python-versions)
|
|
56
|
-
echo "versions=${versions}" >> "$GITHUB_OUTPUT"
|
|
57
|
-
echo "Testing with: ${versions}"
|
|
58
|
-
|
|
59
|
-
test:
|
|
60
|
-
name: Test (Python ${{ matrix.python }})
|
|
61
|
-
needs: python-versions
|
|
62
|
-
runs-on: ubuntu-latest
|
|
63
|
-
strategy:
|
|
64
|
-
fail-fast: true
|
|
65
|
-
matrix:
|
|
66
|
-
python: ${{ fromJSON(needs.python-versions.outputs.versions) }}
|
|
67
|
-
steps:
|
|
68
|
-
- uses: actions/checkout@v7
|
|
69
|
-
with:
|
|
70
|
-
ref: ${{ env.TAG }}
|
|
71
|
-
persist-credentials: false
|
|
72
|
-
- uses: astral-sh/setup-uv@v10.4.2 # setup-uv publishes no major-version tag
|
|
73
|
-
- name: Install
|
|
74
|
-
run: uv sync --locked --all-extras --python ${{ matrix.python }}
|
|
75
|
-
- name: Test (fails below the coverage floor in pyproject.toml)
|
|
76
|
-
run: uv run --no-sync pytest --cov=version_bumper
|
|
44
|
+
ci:
|
|
45
|
+
name: CI
|
|
46
|
+
uses: ./.github/workflows/ci.yml
|
|
47
|
+
with:
|
|
48
|
+
ref: ${{ inputs.tag || github.ref_name }}
|
|
77
49
|
|
|
78
50
|
build:
|
|
79
51
|
name: Build
|
|
80
|
-
needs:
|
|
52
|
+
needs: ci
|
|
81
53
|
runs-on: ubuntu-latest
|
|
82
54
|
steps:
|
|
83
55
|
- uses: actions/checkout@v7
|
|
@@ -20,6 +20,46 @@ and this project adheres to
|
|
|
20
20
|
|
|
21
21
|
### Fixed
|
|
22
22
|
|
|
23
|
+
## [0.3.2] - 2026-12-05
|
|
24
|
+
|
|
25
|
+
### Added
|
|
26
|
+
|
|
27
|
+
- The docs are published to GitHub Pages at
|
|
28
|
+
<https://royw.github.io/version_bumper/> after CI passes on `main`, and
|
|
29
|
+
the project's documentation URL points there.
|
|
30
|
+
- The docs site has a Reports section with the generated Metrics and Tests
|
|
31
|
+
pages. `scripts/dev-metrics.py --markdown FILE` writes the metrics report as
|
|
32
|
+
markdown, and `task docs:generate` uses it for
|
|
33
|
+
`docs/generated/metrics.md`. The Tests page was already generated but not
|
|
34
|
+
linked.
|
|
35
|
+
- CI builds the docs (`task docs:build`, zensical `--strict`), failing on
|
|
36
|
+
any warning such as a broken link.
|
|
37
|
+
- README coverage badge showing the coverage measured by CI on `main`.
|
|
38
|
+
- CI workflow for pushes to `main` and pull requests: the pre-commit hooks,
|
|
39
|
+
the complexity limit, and the tests under every supported Python with the
|
|
40
|
+
coverage floor. The release workflow runs it on the tagged commit before
|
|
41
|
+
publishing.
|
|
42
|
+
|
|
43
|
+
### Changed
|
|
44
|
+
|
|
45
|
+
### Fixed
|
|
46
|
+
|
|
47
|
+
- `task docs:build` only worked in a shell with the project's virtual
|
|
48
|
+
environment activated: its metrics step ran `pytest`, `radon` and `pylint`
|
|
49
|
+
from the PATH. The docs scripts now run through `uv run`.
|
|
50
|
+
- Every `task` command failed in a fresh clone ("Path not found:
|
|
51
|
+
.python-version"): the Taskfile read the git-ignored `.python-version` for
|
|
52
|
+
a variable nothing used. The variable is removed.
|
|
53
|
+
- `task release:tag` read the default branch from `origin/HEAD`, which is not
|
|
54
|
+
set in every clone: it printed "fatal: ref refs/remotes/origin/HEAD is not
|
|
55
|
+
a symbolic ref" and ran `git push origin` with no branch. It now asks
|
|
56
|
+
origin for its default branch, and stops if it cannot get it or if the
|
|
57
|
+
current branch is not the default branch (the tag goes on the current
|
|
58
|
+
commit).
|
|
59
|
+
- Upgraded `filelock` 4.2.10 → 4.3.3 in `uv.lock` for 30 advisories fixed
|
|
60
|
+
in 4.3.0 and later. It is only used by the development tools (tox,
|
|
61
|
+
virtualenv, pre-commit), not by the published package.
|
|
62
|
+
|
|
23
63
|
## [0.3.1] - 2026-12-05
|
|
24
64
|
|
|
25
65
|
### Added
|
|
@@ -276,7 +276,10 @@ Real quick
|
|
|
276
276
|
The `docs` namespace wraps Zensical:
|
|
277
277
|
|
|
278
278
|
- `task docs` (or `task docs:serve`) starts the dev server with live reload
|
|
279
|
-
- `task docs:build` builds the site into `site
|
|
279
|
+
- `task docs:build` builds the site into `site/`, after `task docs:generate`
|
|
280
|
+
writes the Reports pages into the git-ignored `docs/generated/`: `tests.md`
|
|
281
|
+
(from the test docstrings) and `metrics.md` (from
|
|
282
|
+
`scripts/dev-metrics.py --markdown`)
|
|
280
283
|
- `task docs:open` serves and opens the browser
|
|
281
284
|
- `task docs:watch` builds then serves
|
|
282
285
|
|
|
@@ -328,9 +331,24 @@ and commit the change; `release:prepare` then validates the working tree,
|
|
|
328
331
|
updates `CHANGELOG.md`, and builds the release, and `release:tag` pushes the
|
|
329
332
|
release tag to GitHub.
|
|
330
333
|
|
|
331
|
-
The
|
|
332
|
-
|
|
333
|
-
|
|
334
|
+
The CI workflow (`.github/workflows/ci.yml`) runs on every push to `main` and
|
|
335
|
+
every pull request: all the pre-commit hooks (failing on any change a hook would
|
|
336
|
+
make), `task metrics:complexity`, `task docs:build` (zensical in strict mode, so
|
|
337
|
+
any warning such as a broken link fails it), and the tests under every Python in
|
|
338
|
+
`.python-versions` with the coverage floor. After it passes on `main`, the
|
|
339
|
+
coverage badge workflow (`.github/workflows/coverage-badge.yml`) writes the
|
|
340
|
+
measured coverage to `coverage.json` on the `badges` branch, which the README's
|
|
341
|
+
coverage badge reads. That branch holds only this file and is force-pushed on
|
|
342
|
+
each update.
|
|
343
|
+
|
|
344
|
+
The docs workflow (`.github/workflows/docs.yml`) runs after CI passes on
|
|
345
|
+
`main`: it builds the site with `task docs:build` and deploys it to GitHub Pages
|
|
346
|
+
at <https://royw.github.io/version_bumper/>. Run it by hand from the Actions tab
|
|
347
|
+
(Docs → Run workflow) to redeploy.
|
|
348
|
+
|
|
349
|
+
The tag runs the release workflow (`.github/workflows/release.yml`). It runs the
|
|
350
|
+
CI workflow on the tagged commit, checks that the tag matches the project
|
|
351
|
+
version, builds, publishes to PyPI by trusted publishing, and
|
|
334
352
|
creates the GitHub release with the version's `CHANGELOG.md` section as notes.
|
|
335
353
|
For a tag pushed earlier, run it by hand from the Actions tab (Release → Run
|
|
336
354
|
workflow) with the tag name. Publishing needs a one-time setup, described at the
|
|
@@ -453,7 +471,7 @@ tests/ # unit test files
|
|
|
453
471
|
.gitignore # files not to check in to git
|
|
454
472
|
.pre-commit-config.yaml # pre-commit config file
|
|
455
473
|
.pymarkdown.json # pymarkdownlnt markdown lint config
|
|
456
|
-
.python-version #
|
|
474
|
+
.python-version # optional local uv python pin (git-ignored, not required)
|
|
457
475
|
.python-versions # python versions used by `task test:all`
|
|
458
476
|
.shellcheckrc # shellcheck configuration
|
|
459
477
|
CHANGELOG.md # project changelog
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: version_bumper
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.2
|
|
4
4
|
Summary: Python package version utility to bump a version by parts.
|
|
5
5
|
Project-URL: version_bumper, https://github.com/royw/version_bumper
|
|
6
6
|
Project-URL: homepage, https://github.com/royw/version_bumper
|
|
7
7
|
Project-URL: repository, https://github.com/royw/version_bumper
|
|
8
|
-
Project-URL: documentation, https://github.
|
|
8
|
+
Project-URL: documentation, https://royw.github.io/version_bumper/
|
|
9
9
|
Author-email: Roy Wright <roy@wright.org>
|
|
10
10
|
Maintainer-email: Roy Wright <roy@wright.org>
|
|
11
11
|
License: MIT License
|
|
@@ -78,6 +78,9 @@ SPDX-License-Identifier: MIT
|
|
|
78
78
|
|
|
79
79
|
# Version Bumper
|
|
80
80
|
|
|
81
|
+
[](https://github.com/royw/version_bumper/actions/workflows/ci.yml)
|
|
82
|
+
[](https://github.com/royw/version_bumper/actions/workflows/coverage-badge.yml)
|
|
83
|
+
[](https://royw.github.io/version_bumper/)
|
|
81
84
|
[](https://pypi.org/project/version_bumper)
|
|
82
85
|
[](https://pypi.org/project/version_bumper)
|
|
83
86
|
|
|
@@ -6,6 +6,9 @@ SPDX-License-Identifier: MIT
|
|
|
6
6
|
|
|
7
7
|
# Version Bumper
|
|
8
8
|
|
|
9
|
+
[](https://github.com/royw/version_bumper/actions/workflows/ci.yml)
|
|
10
|
+
[](https://github.com/royw/version_bumper/actions/workflows/coverage-badge.yml)
|
|
11
|
+
[](https://royw.github.io/version_bumper/)
|
|
9
12
|
[](https://pypi.org/project/version_bumper)
|
|
10
13
|
[](https://pypi.org/project/version_bumper)
|
|
11
14
|
|
|
@@ -59,9 +59,6 @@ vars:
|
|
|
59
59
|
PYTHON_VERSIONS:
|
|
60
60
|
sh: python taskfiles/helpers/task-helper.py python-versions .python-versions
|
|
61
61
|
|
|
62
|
-
PYTHON_VERSION:
|
|
63
|
-
sh: python taskfiles/helpers/task-helper.py python-version .python-version
|
|
64
|
-
|
|
65
62
|
EMOJI_REPLACEMENTS_MAP:
|
|
66
63
|
"✅:PASS ❌:FAIL ⚠️:WARNING 🔍:SEARCH 📦:PACKAGE 🐧:LINUX 🚀:DEPLOY
|
|
67
64
|
🎯:TARGET 🏆:SUCCESS 🎉:COMPLETE 📊:REPORT 🧪:TEST 🔴:HIGH 🟡:MEDIUM 🟢:LOW
|
|
@@ -19,7 +19,7 @@ name = "version_bumper"
|
|
|
19
19
|
# TOML type: string
|
|
20
20
|
# The version of the project, as defined in the Version specifier specification.
|
|
21
21
|
# Users SHOULD prefer to specify already-normalized versions
|
|
22
|
-
version = "0.3.
|
|
22
|
+
version = "0.3.2"
|
|
23
23
|
|
|
24
24
|
# TOML type: string
|
|
25
25
|
# The summary description of the project in one line. Tools MAY error if this includes multiple lines.
|
|
@@ -93,7 +93,7 @@ classifiers = [
|
|
|
93
93
|
|
|
94
94
|
# TOML type: table with keys and values of strings
|
|
95
95
|
# A table of URLs where the key is the URL label and the value is the URL itself.
|
|
96
|
-
urls = {"version_bumper" = "https://github.com/royw/version_bumper", "homepage" = "https://github.com/royw/version_bumper", "repository" = "https://github.com/royw/version_bumper", "documentation" = "https://github.
|
|
96
|
+
urls = {"version_bumper" = "https://github.com/royw/version_bumper", "homepage" = "https://github.com/royw/version_bumper", "repository" = "https://github.com/royw/version_bumper", "documentation" = "https://royw.github.io/version_bumper/"}
|
|
97
97
|
|
|
98
98
|
# TOML type: array of string
|
|
99
99
|
# Specifies which keys listed by this PEP were intentionally unspecified so another tool can/will provide
|
|
@@ -24,8 +24,9 @@ import sys
|
|
|
24
24
|
import tomllib
|
|
25
25
|
from argparse import Namespace
|
|
26
26
|
from collections import defaultdict
|
|
27
|
-
from collections.abc import Callable
|
|
27
|
+
from collections.abc import Callable, Sequence
|
|
28
28
|
from dataclasses import dataclass, field
|
|
29
|
+
from datetime import UTC, datetime
|
|
29
30
|
from pathlib import Path
|
|
30
31
|
from textwrap import dedent
|
|
31
32
|
from typing import Any
|
|
@@ -996,13 +997,7 @@ def report_summary(metrics: ProjectMetrics) -> None:
|
|
|
996
997
|
"""Display summary statistics."""
|
|
997
998
|
output_section_header("=== Summary ===")
|
|
998
999
|
|
|
999
|
-
total_tests = (
|
|
1000
|
-
metrics.tests.unit_tests
|
|
1001
|
-
+ metrics.tests.functional_tests
|
|
1002
|
-
+ metrics.tests.integration_tests
|
|
1003
|
-
+ metrics.tests.e2e_tests
|
|
1004
|
-
+ metrics.tests.regression_tests
|
|
1005
|
-
)
|
|
1000
|
+
total_tests = _total_tests(metrics.tests)
|
|
1006
1001
|
|
|
1007
1002
|
output(
|
|
1008
1003
|
f" Source files: {metrics.source.total_files} | "
|
|
@@ -1024,6 +1019,11 @@ def report_summary(metrics: ProjectMetrics) -> None:
|
|
|
1024
1019
|
output("")
|
|
1025
1020
|
|
|
1026
1021
|
|
|
1022
|
+
def _total_tests(metrics: TestMetrics) -> int:
|
|
1023
|
+
"""The number of tests of every type."""
|
|
1024
|
+
return sum(getattr(metrics, attr_name) for _label, attr_name in _TEST_BREAKDOWN_LABELS)
|
|
1025
|
+
|
|
1026
|
+
|
|
1027
1027
|
def generate_report(metrics: ProjectMetrics) -> None:
|
|
1028
1028
|
"""Generate and display the complete metrics report."""
|
|
1029
1029
|
output_section_header("=== Project Metrics Summary ===")
|
|
@@ -1037,6 +1037,150 @@ def generate_report(metrics: ProjectMetrics) -> None:
|
|
|
1037
1037
|
report_summary(metrics)
|
|
1038
1038
|
|
|
1039
1039
|
|
|
1040
|
+
# ============================================================================
|
|
1041
|
+
# MARKDOWN REPORT (--markdown FILE, used for docs/generated/metrics.md)
|
|
1042
|
+
# ============================================================================
|
|
1043
|
+
|
|
1044
|
+
|
|
1045
|
+
def _md_table(headers: tuple[str, ...], rows: Sequence[tuple[object, ...]]) -> list[str]:
|
|
1046
|
+
"""A markdown table, or a note when there are no rows."""
|
|
1047
|
+
if not rows:
|
|
1048
|
+
return ["_None._", ""]
|
|
1049
|
+
lines = ["| " + " | ".join(headers) + " |", "|" + "|".join("---" for _ in headers) + "|"]
|
|
1050
|
+
lines.extend("| " + " | ".join(str(cell) for cell in row) + " |" for row in rows)
|
|
1051
|
+
return [*lines, ""]
|
|
1052
|
+
|
|
1053
|
+
|
|
1054
|
+
def _md_summary(metrics: ProjectMetrics) -> list[str]:
|
|
1055
|
+
"""The summary section: the headline numbers."""
|
|
1056
|
+
total_tests = _total_tests(metrics.tests)
|
|
1057
|
+
paths = metrics.complexity.total_paths
|
|
1058
|
+
rows: list[tuple[object, ...]] = [
|
|
1059
|
+
("Source files", metrics.source.total_files),
|
|
1060
|
+
("Test files", metrics.tests.total_test_files),
|
|
1061
|
+
("Test functions", total_tests),
|
|
1062
|
+
("Code paths", paths or "N/A"),
|
|
1063
|
+
("Test/path ratio", f"{total_tests / paths:.2f}" if paths else "N/A"),
|
|
1064
|
+
("Coverage", metrics.coverage.overall_coverage),
|
|
1065
|
+
]
|
|
1066
|
+
return ["## Summary", "", *_md_table(("Metric", "Value"), rows)]
|
|
1067
|
+
|
|
1068
|
+
|
|
1069
|
+
def _md_source(metrics: SourceMetrics) -> list[str]:
|
|
1070
|
+
"""The source code section."""
|
|
1071
|
+
rows: list[tuple[object, ...]] = [
|
|
1072
|
+
("Files", metrics.total_files),
|
|
1073
|
+
("Total SLOC", metrics.total_sloc),
|
|
1074
|
+
("Maximum lines in a file", metrics.max_lines),
|
|
1075
|
+
("Average lines per file", metrics.avg_lines),
|
|
1076
|
+
("Average code paths per file", f"{metrics.avg_code_paths:.1f}"),
|
|
1077
|
+
("Maximum code paths in a file", metrics.max_code_paths),
|
|
1078
|
+
("Code duplication score", metrics.duplication_score),
|
|
1079
|
+
]
|
|
1080
|
+
imports = [(f"`{filepath}`", count) for filepath, count in metrics.top_imports]
|
|
1081
|
+
return [
|
|
1082
|
+
"## Source code",
|
|
1083
|
+
"",
|
|
1084
|
+
*_md_table(("Metric", "Value"), rows),
|
|
1085
|
+
"### Files with the most imports",
|
|
1086
|
+
"",
|
|
1087
|
+
*_md_table(("File", "Imports"), imports),
|
|
1088
|
+
]
|
|
1089
|
+
|
|
1090
|
+
|
|
1091
|
+
def _md_complexity(metrics: ProjectMetrics) -> list[str]:
|
|
1092
|
+
"""The cyclomatic complexity section, with any functions excluded from the checks."""
|
|
1093
|
+
complexity = metrics.complexity
|
|
1094
|
+
files = [(f"`{filepath}`", max_cc) for filepath, max_cc in complexity.top5_complex]
|
|
1095
|
+
lines = [
|
|
1096
|
+
"## Cyclomatic complexity",
|
|
1097
|
+
"",
|
|
1098
|
+
f"Files with a function of complexity above 5: {complexity.files_high_cc}",
|
|
1099
|
+
"",
|
|
1100
|
+
"### Most complex files",
|
|
1101
|
+
"",
|
|
1102
|
+
*_md_table(("File", "Highest function complexity"), files),
|
|
1103
|
+
]
|
|
1104
|
+
excluded = metrics.source.complexity_exclusions
|
|
1105
|
+
if excluded:
|
|
1106
|
+
lines += ["### Functions excluded from complexity checks", "", *[f"- `{func}`" for func in excluded], ""]
|
|
1107
|
+
return lines
|
|
1108
|
+
|
|
1109
|
+
|
|
1110
|
+
def _md_tests(metrics: TestMetrics) -> list[str]:
|
|
1111
|
+
"""The test code section."""
|
|
1112
|
+
breakdown = [(label, count) for label, attr in _TEST_BREAKDOWN_LABELS if (count := getattr(metrics, attr)) > 0]
|
|
1113
|
+
untested = [(f"`{filepath}`", sloc) for filepath, sloc in metrics.untested_files]
|
|
1114
|
+
return [
|
|
1115
|
+
"## Tests",
|
|
1116
|
+
"",
|
|
1117
|
+
f"Test files: {metrics.total_test_files}, total SLOC: {metrics.total_sloc}",
|
|
1118
|
+
"",
|
|
1119
|
+
*_md_table(("Type", "Test functions"), breakdown),
|
|
1120
|
+
"### Source files (SLOC > 20) without tests",
|
|
1121
|
+
"",
|
|
1122
|
+
*_md_table(("File", "SLOC"), untested),
|
|
1123
|
+
]
|
|
1124
|
+
|
|
1125
|
+
|
|
1126
|
+
def _md_coverage(metrics: CoverageMetrics) -> list[str]:
|
|
1127
|
+
"""The coverage section."""
|
|
1128
|
+
distribution = [
|
|
1129
|
+
(range_key, metrics.coverage_distribution[range_key], metrics.coverage_sloc_distribution.get(range_key, 0))
|
|
1130
|
+
for range_key in _COVERAGE_RANGE_ORDER
|
|
1131
|
+
if range_key in metrics.coverage_distribution
|
|
1132
|
+
]
|
|
1133
|
+
results = [metrics.test_results, ""] if metrics.test_results else []
|
|
1134
|
+
return [
|
|
1135
|
+
"## Coverage",
|
|
1136
|
+
"",
|
|
1137
|
+
*results,
|
|
1138
|
+
f"Overall coverage: {metrics.overall_coverage}",
|
|
1139
|
+
"",
|
|
1140
|
+
*_md_table(("Coverage", "Files", "SLOC"), distribution),
|
|
1141
|
+
]
|
|
1142
|
+
|
|
1143
|
+
|
|
1144
|
+
def _md_risk(metrics: RiskMetrics) -> list[str]:
|
|
1145
|
+
"""The risk section: files combining high complexity and low coverage."""
|
|
1146
|
+
rows = [
|
|
1147
|
+
(f"`{filepath}`", complexity, f"{coverage:.1f}%", f"{risk_score:.1f}", sloc)
|
|
1148
|
+
for filepath, complexity, coverage, risk_score, sloc in metrics.high_risk_files
|
|
1149
|
+
]
|
|
1150
|
+
return [
|
|
1151
|
+
"## Highest risk files",
|
|
1152
|
+
"",
|
|
1153
|
+
"Files combining high complexity with low coverage.",
|
|
1154
|
+
"",
|
|
1155
|
+
*_md_table(("File", "Complexity", "Coverage", "Risk", "SLOC"), rows),
|
|
1156
|
+
]
|
|
1157
|
+
|
|
1158
|
+
|
|
1159
|
+
def markdown_report(metrics: ProjectMetrics) -> str:
|
|
1160
|
+
"""The complete metrics report as a markdown page."""
|
|
1161
|
+
timestamp = datetime.now(tz=UTC).astimezone().strftime("%Y-%m-%d %H:%M:%S")
|
|
1162
|
+
lines = [
|
|
1163
|
+
"# Project Metrics",
|
|
1164
|
+
"",
|
|
1165
|
+
f"> **Auto-generated** on {timestamp} by `scripts/dev-metrics.py`",
|
|
1166
|
+
"",
|
|
1167
|
+
*_md_summary(metrics),
|
|
1168
|
+
*_md_source(metrics.source),
|
|
1169
|
+
*_md_complexity(metrics),
|
|
1170
|
+
*_md_tests(metrics.tests),
|
|
1171
|
+
*_md_coverage(metrics.coverage),
|
|
1172
|
+
*_md_risk(metrics.risk),
|
|
1173
|
+
]
|
|
1174
|
+
return "\n".join(lines).rstrip() + "\n"
|
|
1175
|
+
|
|
1176
|
+
|
|
1177
|
+
def write_markdown_report(metrics: ProjectMetrics, markdown_path: Path) -> None:
|
|
1178
|
+
"""Write the markdown report, creating its directory if needed."""
|
|
1179
|
+
markdown_path.parent.mkdir(parents=True, exist_ok=True)
|
|
1180
|
+
markdown_path.write_text(markdown_report(metrics), encoding="utf-8")
|
|
1181
|
+
output(f"{Colors.GREEN}Markdown report written to {markdown_path}{Colors.NC}")
|
|
1182
|
+
|
|
1183
|
+
|
|
1040
1184
|
# ============================================================================
|
|
1041
1185
|
# MAIN
|
|
1042
1186
|
# ============================================================================
|
|
@@ -1151,11 +1295,11 @@ def as_paths(value: str | list[str] | None) -> list[Path]:
|
|
|
1151
1295
|
return [Path(p) for p in value]
|
|
1152
1296
|
|
|
1153
1297
|
|
|
1154
|
-
def parse_arguments() -> tuple[MetricsConfig, bool, bool]:
|
|
1298
|
+
def parse_arguments() -> tuple[MetricsConfig, bool, bool, Path | None]:
|
|
1155
1299
|
"""Parse command line arguments and load configuration.
|
|
1156
1300
|
|
|
1157
1301
|
Returns:
|
|
1158
|
-
Tuple of (config, show_config_only)
|
|
1302
|
+
Tuple of (config, show_config_only, persist, markdown_path)
|
|
1159
1303
|
"""
|
|
1160
1304
|
args = _build_parser().parse_args()
|
|
1161
1305
|
|
|
@@ -1165,7 +1309,7 @@ def parse_arguments() -> tuple[MetricsConfig, bool, bool]:
|
|
|
1165
1309
|
# Apply configuration priority: CLI args > pyproject.toml > defaults
|
|
1166
1310
|
config = _resolve_config(args, pyproject_config)
|
|
1167
1311
|
|
|
1168
|
-
return config, args.show, args.persist
|
|
1312
|
+
return config, args.show, args.persist, args.markdown
|
|
1169
1313
|
|
|
1170
1314
|
|
|
1171
1315
|
def _cli_paths(values: list[str]) -> list[Path]:
|
|
@@ -1284,6 +1428,12 @@ def _build_parser() -> ArgumentParser:
|
|
|
1284
1428
|
action="store_true",
|
|
1285
1429
|
help="Save the resolved configuration to pyproject.toml [tool.dev-metrics] section",
|
|
1286
1430
|
)
|
|
1431
|
+
parser.add_argument(
|
|
1432
|
+
"--markdown",
|
|
1433
|
+
type=Path,
|
|
1434
|
+
metavar="FILE",
|
|
1435
|
+
help="Also write the report as markdown to FILE (ex: docs/generated/metrics.md)",
|
|
1436
|
+
)
|
|
1287
1437
|
parser.add_argument("-h", "--help", action="help", help="Display this help message")
|
|
1288
1438
|
paths_group.add_argument(
|
|
1289
1439
|
"--src",
|
|
@@ -1383,7 +1533,7 @@ def show_config(config: MetricsConfig) -> None:
|
|
|
1383
1533
|
def main() -> None:
|
|
1384
1534
|
"""Main entry point for metrics script."""
|
|
1385
1535
|
# Load configuration
|
|
1386
|
-
config, show_only, persist = parse_arguments()
|
|
1536
|
+
config, show_only, persist, markdown_path = parse_arguments()
|
|
1387
1537
|
|
|
1388
1538
|
# If --persist flag is set, save resolved configuration to pyproject.toml
|
|
1389
1539
|
if persist:
|
|
@@ -1400,6 +1550,8 @@ def main() -> None:
|
|
|
1400
1550
|
|
|
1401
1551
|
# Phase 2: Generate report
|
|
1402
1552
|
generate_report(metrics)
|
|
1553
|
+
if markdown_path:
|
|
1554
|
+
write_markdown_report(metrics, markdown_path)
|
|
1403
1555
|
|
|
1404
1556
|
|
|
1405
1557
|
if __name__ == "__main__":
|
|
@@ -134,13 +134,26 @@ tasks:
|
|
|
134
134
|
- Publish to PyPI automatically
|
|
135
135
|
platforms: [linux, darwin]
|
|
136
136
|
vars:
|
|
137
|
+
# Ask origin for its default branch: refs/remotes/origin/HEAD is only set in clones
|
|
138
|
+
# made by git clone (or after git remote set-head), so it is not reliable.
|
|
137
139
|
DEFAULT_BRANCH:
|
|
138
|
-
sh:
|
|
139
|
-
git
|
|
140
|
-
|
|
140
|
+
sh: |
|
|
141
|
+
git ls-remote --symref origin HEAD | sed -n 's@^ref: refs/heads/\(.*\)[[:space:]]HEAD$@\1@p'
|
|
142
|
+
CURRENT_BRANCH:
|
|
143
|
+
sh: git branch --show-current
|
|
141
144
|
VERSION:
|
|
142
145
|
sh: task version:pyproject
|
|
143
146
|
cmds:
|
|
147
|
+
- |
|
|
148
|
+
if [ -z "{{.DEFAULT_BRANCH}}" ]; then
|
|
149
|
+
echo "❌ Error: could not get the default branch of origin"
|
|
150
|
+
exit 1
|
|
151
|
+
fi
|
|
152
|
+
# the tag is put on HEAD, so HEAD must be the default branch that is pushed
|
|
153
|
+
if [ "{{.CURRENT_BRANCH}}" != "{{.DEFAULT_BRANCH}}" ]; then
|
|
154
|
+
echo "❌ Error: on branch '{{.CURRENT_BRANCH}}', but releases are tagged on '{{.DEFAULT_BRANCH}}'"
|
|
155
|
+
exit 1
|
|
156
|
+
fi
|
|
144
157
|
- echo "Pushing changes to {{.DEFAULT_BRANCH}}..."
|
|
145
158
|
- git push origin {{.DEFAULT_BRANCH}}
|
|
146
159
|
- echo "Creating tag v{{.VERSION}}..."
|
|
@@ -14,6 +14,13 @@ import sys
|
|
|
14
14
|
from pathlib import Path
|
|
15
15
|
|
|
16
16
|
|
|
17
|
+
def _run_in_project_env(script: Path, *args: str) -> int:
|
|
18
|
+
"""Run a script with the project's Python, so the tools it runs (pytest, radon, pylint)
|
|
19
|
+
are the project's: helpers themselves run on whatever python is on the PATH."""
|
|
20
|
+
proc = subprocess.run(["uv", "run", "python", str(script), *args], check=False)
|
|
21
|
+
return proc.returncode
|
|
22
|
+
|
|
23
|
+
|
|
17
24
|
def cmd_generate_tests(path: str) -> int:
|
|
18
25
|
"""Generate test documentation."""
|
|
19
26
|
script = Path(path)
|
|
@@ -21,8 +28,7 @@ def cmd_generate_tests(path: str) -> int:
|
|
|
21
28
|
sys.stdout.write("WARNING: scripts/generate_test_docs.py not found, skipping test documentation generation\n")
|
|
22
29
|
return 0
|
|
23
30
|
|
|
24
|
-
|
|
25
|
-
return proc.returncode
|
|
31
|
+
return _run_in_project_env(script)
|
|
26
32
|
|
|
27
33
|
|
|
28
34
|
def _should_filter_line(line: str) -> bool:
|
|
@@ -65,8 +71,7 @@ def cmd_generate_metrics(path: str) -> int:
|
|
|
65
71
|
sys.stdout.write("WARNING: scripts/dev-metrics.py not found, skipping metrics generation\n")
|
|
66
72
|
return 0
|
|
67
73
|
|
|
68
|
-
|
|
69
|
-
return proc.returncode
|
|
74
|
+
return _run_in_project_env(script, "--markdown", "docs/generated/metrics.md")
|
|
70
75
|
|
|
71
76
|
|
|
72
77
|
def cmd_rm_rf(path: str) -> int:
|
|
@@ -798,11 +798,11 @@ wheels = [
|
|
|
798
798
|
|
|
799
799
|
[[package]]
|
|
800
800
|
name = "filelock"
|
|
801
|
-
version = "4.
|
|
801
|
+
version = "4.3.3"
|
|
802
802
|
source = { registry = "https://pypi.org/simple" }
|
|
803
|
-
sdist = { url = "https://files.pythonhosted.org/packages/
|
|
803
|
+
sdist = { url = "https://files.pythonhosted.org/packages/40/b8/a74f3f881abc18a1c5a79db682eeaef2913703dc9c1b7abb39b880285f5b/filelock-4.3.3.tar.gz", hash = "sha256:91d2427a74e2a5e78a1c94fc348dc8803b5f3f64dc5d6e6bab10bad29278650f", size = 746439, upload-time = "2026-12-04T18:20:48.789Z" }
|
|
804
804
|
wheels = [
|
|
805
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
805
|
+
{ url = "https://files.pythonhosted.org/packages/89/27/26e0ff3ad56081f0b33527ca308ff7ca75bbb6783013f63ba4f1f6cfa894/filelock-4.3.3-py3-none-any.whl", hash = "sha256:a03c1dac54ffe24bd0e8478b37aa19d8f89186a9ccc90e2acac88ad809deb3b3", size = 245561, upload-time = "2026-12-04T18:20:47.249Z" },
|
|
806
806
|
]
|
|
807
807
|
|
|
808
808
|
[[package]]
|
|
@@ -2960,7 +2960,7 @@ wheels = [
|
|
|
2960
2960
|
|
|
2961
2961
|
[[package]]
|
|
2962
2962
|
name = "version-bumper"
|
|
2963
|
-
version = "0.3.
|
|
2963
|
+
version = "0.3.2"
|
|
2964
2964
|
source = { editable = "." }
|
|
2965
2965
|
dependencies = [
|
|
2966
2966
|
{ name = "loguru" },
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
|
|
10
10
|
[project]
|
|
11
11
|
site_name = "Version Bumper"
|
|
12
|
+
site_url = "https://royw.github.io/version_bumper/"
|
|
12
13
|
site_author = "Roy Wright"
|
|
13
14
|
copyright = "2024 by Roy Wright"
|
|
14
15
|
repo_name = "version_bumper"
|
|
@@ -16,9 +17,14 @@ repo_url = "https://github.com/royw/version_bumper"
|
|
|
16
17
|
docs_dir = "docs"
|
|
17
18
|
site_dir = "site"
|
|
18
19
|
|
|
20
|
+
# The Reports pages are generated by `task docs:generate` (docs/generated/ is git-ignored).
|
|
19
21
|
nav = [
|
|
20
22
|
{ "About" = "index.md" },
|
|
21
23
|
{ "Development Environment" = "DEV-README.md" },
|
|
24
|
+
{ "Reports" = [
|
|
25
|
+
{ "Metrics" = "generated/metrics.md" },
|
|
26
|
+
{ "Tests" = "generated/tests.md" },
|
|
27
|
+
] },
|
|
22
28
|
]
|
|
23
29
|
|
|
24
30
|
[project.theme]
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{version_bumper-0.3.1 → version_bumper-0.3.2}/src/version_bumper/clibones/application_settings.py
RENAMED
|
File without changes
|
|
File without changes
|
{version_bumper-0.3.1 → version_bumper-0.3.2}/src/version_bumper/clibones/config_file_base.py
RENAMED
|
File without changes
|
|
File without changes
|
{version_bumper-0.3.1 → version_bumper-0.3.2}/src/version_bumper/clibones/json_config_file.py
RENAMED
|
File without changes
|
|
File without changes
|
{version_bumper-0.3.1 → version_bumper-0.3.2}/src/version_bumper/clibones/toml_config_file.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|