Skip to content

Commit e9da7af

Browse files
authored
Fix mkdocs python path for API repos (#534)
The mkdocstrings-python v2 migration added in v0.14.0 moved the `paths` setting out of `handlers.python.options` assuming `src`, but api repositories use `py`, so they were not fixed automatically.
2 parents a5bcbaa + ec4bac6 commit e9da7af

4 files changed

Lines changed: 133 additions & 921 deletions

File tree

.github/RELEASE_NOTES.template.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
All upgrading should be done via the migration script or regenerating the templates.
1414

1515
```bash
16-
curl -sSL https://raw.githubusercontent.com/frequenz-floss/frequenz-repo-config-python/v0.12/cookiecutter/migrate.py | python3
16+
curl -sSL https://raw.githubusercontent.com/frequenz-floss/frequenz-repo-config-python/<tag>/cookiecutter/migrate.py | python3
1717
```
1818

1919
But you might still need to adapt your code:

.github/cookiecutter-migrate.template.py

Lines changed: 22 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -58,27 +58,6 @@ def main() -> None:
5858

5959
print("\033[0;32m ✅ Migration script finished successfully ✅\033[0m")
6060
print()
61-
62-
63-
def read_project_type() -> str | None:
64-
"""Read the cookiecutter project type from the replay file."""
65-
replay_path = Path(".cookiecutter-replay.json")
66-
if not replay_path.exists():
67-
return None
68-
69-
try:
70-
data = json.loads(replay_path.read_text(encoding="utf-8"))
71-
except (json.JSONDecodeError, OSError):
72-
return None
73-
74-
cookiecutter_data = data.get("cookiecutter")
75-
if not isinstance(cookiecutter_data, dict):
76-
return None
77-
78-
project_type = cookiecutter_data.get("type")
79-
if not isinstance(project_type, str):
80-
return None
81-
8261
return project_type
8362

8463

@@ -307,6 +286,28 @@ def get_ruleset_settings_url() -> str | None:
307286
return None
308287

309288

289+
def read_cookiecutter_str_var(name: str) -> str | None:
290+
"""Read a cookiecutter variable from the replay file."""
291+
replay_path = Path(".cookiecutter-replay.json")
292+
if not replay_path.exists():
293+
return None
294+
295+
try:
296+
data = json.loads(replay_path.read_text(encoding="utf-8"))
297+
except (json.JSONDecodeError, OSError):
298+
return None
299+
300+
cookiecutter_data = data.get("cookiecutter")
301+
if not isinstance(cookiecutter_data, dict):
302+
return None
303+
304+
value = cookiecutter_data.get(name)
305+
if not isinstance(value, str):
306+
return None
307+
308+
return value
309+
310+
310311
def manual_step(message: str) -> None:
311312
"""Print a manual step message in yellow."""
312313
_manual_steps.append(message)

RELEASE_NOTES.md

Lines changed: 4 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,8 @@
11
# Frequenz Repository Configuration Release Notes
22

3-
> [!NOTE]
4-
> This is a bugfix release for v0.15.0. This release was never published to PyPI, so we keep the entire release notes for v0.15.0 here (updated to the new changes) to make it easier for users to upgrade from v0.14.0 to v0.15.x.
5-
>
6-
> The only change with respect to v0.15.0 is using the appropriate job runner for the `publish-to-pypi` job in `ci.yaml`. v0.15.0 updated it to `ubuntu-slim` but that didn't work because it requires Docker, and it is not installed on the `ubuntu-slim` runner.
7-
83
## Summary
94

10-
This release reduces CI cost by moving lightweight GitHub Actions jobs to the new `ubuntu-slim` runner, fixes Dependabot auto-merge/merge-queue issues by switching to a GitHub App installation token, and introduces an automated repo-config migration workflow (including updating existing repos' version-branch protection defaults).
5+
<!-- Here goes a general summary of what this release is about -->
116

127
## Upgrading
138

@@ -18,7 +13,7 @@ This release reduces CI cost by moving lightweight GitHub Actions jobs to the ne
1813
All upgrading should be done via the migration script or regenerating the templates.
1914

2015
```bash
21-
curl -sSL https://raw.githubusercontent.com/frequenz-floss/frequenz-repo-config-python/v0.15.0/cookiecutter/migrate.py | python3
16+
curl -sSL https://raw.githubusercontent.com/frequenz-floss/frequenz-repo-config-python/<tag>/cookiecutter/migrate.py | python3
2217
```
2318

2419
But you might still need to adapt your code:
@@ -31,37 +26,12 @@ But you might still need to adapt your code:
3126

3227
### Cookiecutter template
3328

34-
- Migrated lightweight workflow jobs to use the new `ubuntu-slim` runner for cost savings.
35-
The following jobs now use `ubuntu-slim`:
36-
- `ci.yaml`: `protolint`, `nox-all`, `test-installation-all`, `create-github-release`
37-
- `ci-pr.yaml`: `protolint`
38-
- `auto-dependabot.yaml`: `auto-merge`
39-
- `release-notes-check.yml`: `check-release-notes`
40-
- `dco-merge-queue.yml`: `DCO`
41-
- `labeler.yml`: `Label`
42-
43-
- Migrated the `publish-to-pypi` job in `ci.yaml` from `ubuntu-latest` to `ubuntu-24.04` to get reproducible builds.
44-
45-
- Added the [`flake8-datetimez`](https://github.com/pjknkda/flake8-datetimez) plugin to the `flake8` session. This plugin prevents accidental use of naive `datetime` objects by flagging calls that create or return datetimes without timezone information.
46-
47-
- The CI workflow now uses a simpler matrix.
48-
49-
- Added `repo-config-migration.yaml` workflow that automatically runs the migration script, commits changes, posts results, and auto-approves/merges only when no migration commit is created.
50-
51-
The workflow handles multi-version jumps by running each intermediate migration in sequence. The migration script output is posted as a PR comment and in the job summary. PRs with migration commits stay open for manual approval and merge. PRs that need manual intervention fail the job until a human completes the steps and signals resolution by removing the `tool:repo-config:migration:intervention-pending` label or adding the `tool:repo-config:migration:intervention-done` label.
52-
53-
- The `auto-dependabot.yaml` workflow now skips repo-config group PRs, which are handled by the new migration workflow instead.
54-
55-
- Updated the default "Protect version branches" ruleset to require the new `Migrate Repo Config` status check, which is added by the migration workflow to PRs that need manual intervention. This prevents merging PRs that require manual migration steps until those steps are completed and the check passes. Also removed the required code-owner approval and automatic Copilot review request.
29+
<!-- Here new features for cookiecutter specifically -->
5630

5731
## Bug Fixes
5832

5933
<!-- Here goes notable bug fixes that are worth a special mention or explanation -->
6034

6135
### Cookiecutter template
6236

63-
- Switched `project.license` to SPDX expressions and added `project.license-files`. This removes deprecated setuptools license metadata and avoids build warnings.
64-
65-
- Fixed auto-dependabot workflow failing to trigger merge queue CI or complete auto-merge. The workflow now uses a GitHub App installation token (via `actions/create-github-app-token`) instead of `GITHUB_TOKEN`, which was suppressing subsequent workflow runs by design. Workflow permissions have been reduced to the minimum needed for the workflow (`contents: read` and `pull-requests: write`).
66-
67-
- Fix dependabot group patterns for repo-config and mkdocstrings.
37+
- Added a migration step for api repositories to fix `mkdocs.yml` when the previous `mkdocstrings-python` v2 migration moved only `paths: ["src"]` under `handlers.python.options` but not `paths: ["py"]`.

0 commit comments

Comments
 (0)