diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index d5242cb3..4a01ccc2 100644 --- a/RELEASE_NOTES.md +++ b/RELEASE_NOTES.md @@ -2,32 +2,28 @@ ## Summary -This version accumulates a few improvements, and bumps the dependency of setuptools to use v75, which is compatible with PEP625, which is necessary to be able to keep uploading to PyPI, so you should upgrade to this version as soon as possible. - -The migration script was also rewritten in Python, so it should be more compatible with different OSes. + ## Upgrading -- The `frequenz.repo.config.github.abort()` function now takes most arguments as keyword-only arguments. -- The *Queue PRs for v0.x.x* GitHub ruleset was renamed to *Queue PRs for the default branch* and now targets the default branch. It also only have the merge queue restriction, all other restrictions were removed as they are already present in the *Protect version branches* ruleset. You might want to re-import this ruleset to your repositories. + + +### Cookiecutter template + + ## New Features -* Added a new GitHub branch ruleset for Rust projects. + ### Cookiecutter template -* Group GitHub Actions dependabot updates. -* API projects don't include the `google-common-protos` dependency by default. -* API projects updated the `grpcio` dependency to `1.66.1`. -* API projects updated the `frequenz-api-common` dependency to `0.6`. -* Bump most of the dependencies. -* Change `edit_uri` default branch to v0.x.x in mkdocs.yml. -* Added a new default option `asyncio_default_fixture_loop_scope = "function"` for `pytest-asyncio` as not providing a value is deprecated. -* The migration script is now written in Python, so it should be (hopefully) more compatible with different OSes. -* Disable more `pylint` checks that are also checked by `mypy` to avoid false positives. -* Remove the redundant `--platform` from the testing dockerfile. + ## Bug Fixes -* Sybil now parses the `__init__.py` file as well. Previously it was disabled due to an upstream bug. + + +### Cookiecutter template + + diff --git a/cookiecutter/migrate.py b/cookiecutter/migrate.py index 9ca36736..c7311177 100644 --- a/cookiecutter/migrate.py +++ b/cookiecutter/migrate.py @@ -27,6 +27,12 @@ from typing import SupportsIndex +def main() -> None: + """Run the migration steps.""" + # Add a separation line like this one after each migration step. + print("=" * 72) + + def apply_patch(patch_content: str) -> None: """Apply a patch using the patch utility.""" subprocess.run(["patch", "-p1"], input=patch_content.encode(), check=True) @@ -92,132 +98,6 @@ def replace_file_contents_atomically( # noqa; DOC501 raise -def add_pylint_checks() -> None: - """Add new pylint checks to the project.""" - pyproject_toml = Path("pyproject.toml") - print( - f"{pyproject_toml}: Skip some flaky pylint checks that are checked better by mypy." - ) - marker = ' "no-member",\n' - pyproject_toml_content = pyproject_toml.read_text(encoding="utf-8") - if pyproject_toml_content.find(marker) == -1: - manual_step( - f"""\ -{pyproject_toml}: We couldn't find the marker {marker!r} in the file. -Please add the following lines to the file manually in the -`[tool.pylint.messages_control]` section, under the `disable` key (ideally below other -checks that are disabled because `mypy` already checks them) if they are missing: - "no-name-in-module", - "possibly-used-before-assignment", -""" - ) - return - - replacement = "" - if pyproject_toml_content.find("possibly-used-before-assignment") == -1: - replacement += ' "possibly-used-before-assignment",\n' - if pyproject_toml_content.find("no-name-in-module") == -1: - replacement += ' "no-name-in-module",\n' - - if not replacement: - print(f"{pyproject_toml}: seems to be already up-to-date.") - return - - replace_file_contents_atomically( - pyproject_toml, marker, marker + replacement, content=pyproject_toml_content - ) - - -def fix_default_fixture_scope() -> None: - """Fix the default scope of fixtures to 'function'.""" - pyproject_toml = Path("pyproject.toml") - print(f"{pyproject_toml}: Fix the default scope of fixtures to 'function'.") - marker = 'asyncio_mode = "auto"\n' - pyproject_toml_content = pyproject_toml.read_text(encoding="utf-8") - if pyproject_toml_content.find(marker) == -1: - manual_step( - f"""\ -{pyproject_toml}: We couldn't find the marker {marker!r} in the file. -Please add the following line to the file manually in the -`[tool.pytest.ini_options]` section if it is missing: -asyncio_default_fixture_loop_scope = "function" -""" - ) - return - - replacement = 'asyncio_default_fixture_loop_scope = "function"\n' - if pyproject_toml_content.find(replacement) >= 0: - print(f"{pyproject_toml}: seems to be already up-to-date.") - return - replace_file_contents_atomically( - pyproject_toml, marker, marker + replacement, content=pyproject_toml_content - ) - - -def main() -> None: - """Run the migration steps.""" - # Dependabot patch - dependabot_yaml = Path(".github/dependabot.yml") - print(f"{dependabot_yaml}: Add new grouping for actions/*-artifact updates.") - if dependabot_yaml.read_text(encoding="utf-8").find("actions/*-artifact") == -1: - apply_patch( - """\ ---- a/.github/dependabot.yml -+++ b/.github/dependabot.yml -@@ -39,3 +39,11 @@ updates: - labels: - - "part:tooling" - - "type:tech-debt" -+ groups: -+ compatible: -+ update-types: -+ - "minor" -+ - "patch" -+ artifacts: -+ patterns: -+ - "actions/*-artifact" -""" - ) - else: - print(f"{dependabot_yaml}: seems to be already up-to-date.") - print("=" * 72) - - # Fix labeler configuration - labeler_yml = ".github/labeler.yml" - print(f"{labeler_yml}: Fix the labeler configuration example.") - replace_file_contents_atomically( - labeler_yml, "all-glob-to-all-file", "all-globs-to-all-files" - ) - print("=" * 72) - - # Add new pylint checks - add_pylint_checks() - print("=" * 72) - - # Remove redundant --platform from the dockerfile - dockerfile = Path(".github/containers/test-installation/Dockerfile") - print(f"{dockerfile}: Removing redundant --platform.") - if dockerfile.is_file(): - replace_file_contents_atomically( - dockerfile, "--platform=${TARGETPLATFORM} ", "" - ) - else: - print(f"{dockerfile}: Not found.") - print("=" * 72) - - # Make sure `edit_uri` points to the default branch - manual_step( - "Make sure that the `edit_uri` in the `mkdocs.yml` file points to the default branch." - ) - print("=" * 72) - - # Fix the default scope of fixtures to 'function' - fix_default_fixture_scope() - - # Add a separation line like this one after each migration step. - print("=" * 72) - - def manual_step(message: str) -> None: """Print a manual step message in yellow.""" print(f"\033[0;33m>>> {message}\033[0m")