diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index db41c642..d5242cb3 100644 --- a/RELEASE_NOTES.md +++ b/RELEASE_NOTES.md @@ -2,17 +2,15 @@ ## 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. @@ -33,7 +31,3 @@ ## 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 de6f69aa..9ca36736 100644 --- a/cookiecutter/migrate.py +++ b/cookiecutter/migrate.py @@ -128,6 +128,32 @@ def add_pylint_checks() -> None: ) +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 @@ -177,6 +203,16 @@ def main() -> None: ) 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) diff --git a/cookiecutter/{{cookiecutter.github_repo_name}}/pyproject.toml b/cookiecutter/{{cookiecutter.github_repo_name}}/pyproject.toml index 8dbd7958..2cdc06b1 100644 --- a/cookiecutter/{{cookiecutter.github_repo_name}}/pyproject.toml +++ b/cookiecutter/{{cookiecutter.github_repo_name}}/pyproject.toml @@ -5,7 +5,7 @@ requires = [ "setuptools == 75.5.0", "setuptools_scm[toml] == 8.1.0", - "frequenz-repo-config[{{cookiecutter.type}}] == 0.10.0", + "frequenz-repo-config[{{cookiecutter.type}}] == 0.11.0", {%- if cookiecutter.type == "api" %} # We need to pin the protobuf, grpcio and grpcio-tools dependencies to make # sure the code is generated using the minimum supported versions, as older @@ -101,7 +101,7 @@ dev-mkdocs = [ "mkdocs-material == 9.5.45", "mkdocstrings[python] == 0.27.0", "mkdocstrings-python == 1.12.2", - "frequenz-repo-config[{{cookiecutter.type}}] == 0.10.0", + "frequenz-repo-config[{{cookiecutter.type}}] == 0.11.0", ] dev-mypy = [ "mypy == 1.9.0", @@ -114,7 +114,7 @@ dev-mypy = [ ] dev-noxfile = [ "nox == 2024.10.9", - "frequenz-repo-config[{{cookiecutter.type}}] == 0.10.0", + "frequenz-repo-config[{{cookiecutter.type}}] == 0.11.0", ] dev-pylint = [ # dev-pytest already defines a dependency to pylint because of the examples @@ -124,7 +124,7 @@ dev-pylint = [ dev-pytest = [ "pytest == 8.3.3", "pylint == 3.3.1", # We need this to check for the examples - "frequenz-repo-config[extra-lint-examples] == 0.10.0", + "frequenz-repo-config[extra-lint-examples] == 0.11.0", {%- if cookiecutter.type != "api" %} "pytest-mock == 3.14.0", "pytest-asyncio == 0.24.0", diff --git a/tests_golden/integration/test_cookiecutter_generation/actor/frequenz-actor-test/pyproject.toml b/tests_golden/integration/test_cookiecutter_generation/actor/frequenz-actor-test/pyproject.toml index 632c2e77..45a10a9c 100644 --- a/tests_golden/integration/test_cookiecutter_generation/actor/frequenz-actor-test/pyproject.toml +++ b/tests_golden/integration/test_cookiecutter_generation/actor/frequenz-actor-test/pyproject.toml @@ -5,7 +5,7 @@ requires = [ "setuptools == 75.5.0", "setuptools_scm[toml] == 8.1.0", - "frequenz-repo-config[actor] == 0.10.0", + "frequenz-repo-config[actor] == 0.11.0", ] build-backend = "setuptools.build_meta" @@ -60,7 +60,7 @@ dev-mkdocs = [ "mkdocs-material == 9.5.45", "mkdocstrings[python] == 0.27.0", "mkdocstrings-python == 1.12.2", - "frequenz-repo-config[actor] == 0.10.0", + "frequenz-repo-config[actor] == 0.11.0", ] dev-mypy = [ "mypy == 1.9.0", @@ -70,7 +70,7 @@ dev-mypy = [ ] dev-noxfile = [ "nox == 2024.10.9", - "frequenz-repo-config[actor] == 0.10.0", + "frequenz-repo-config[actor] == 0.11.0", ] dev-pylint = [ # dev-pytest already defines a dependency to pylint because of the examples @@ -80,7 +80,7 @@ dev-pylint = [ dev-pytest = [ "pytest == 8.3.3", "pylint == 3.3.1", # We need this to check for the examples - "frequenz-repo-config[extra-lint-examples] == 0.10.0", + "frequenz-repo-config[extra-lint-examples] == 0.11.0", "pytest-mock == 3.14.0", "pytest-asyncio == 0.24.0", "async-solipsism == 0.6", diff --git a/tests_golden/integration/test_cookiecutter_generation/api/frequenz-api-test/pyproject.toml b/tests_golden/integration/test_cookiecutter_generation/api/frequenz-api-test/pyproject.toml index 07a7a5c1..b399b89f 100644 --- a/tests_golden/integration/test_cookiecutter_generation/api/frequenz-api-test/pyproject.toml +++ b/tests_golden/integration/test_cookiecutter_generation/api/frequenz-api-test/pyproject.toml @@ -5,7 +5,7 @@ requires = [ "setuptools == 75.5.0", "setuptools_scm[toml] == 8.1.0", - "frequenz-repo-config[api] == 0.10.0", + "frequenz-repo-config[api] == 0.11.0", # We need to pin the protobuf, grpcio and grpcio-tools dependencies to make # sure the code is generated using the minimum supported versions, as older # versions can't work with code that was generated with newer versions. @@ -71,7 +71,7 @@ dev-mkdocs = [ "mkdocs-material == 9.5.45", "mkdocstrings[python] == 0.27.0", "mkdocstrings-python == 1.12.2", - "frequenz-repo-config[api] == 0.10.0", + "frequenz-repo-config[api] == 0.11.0", ] dev-mypy = [ "mypy == 1.9.0", @@ -82,7 +82,7 @@ dev-mypy = [ ] dev-noxfile = [ "nox == 2024.10.9", - "frequenz-repo-config[api] == 0.10.0", + "frequenz-repo-config[api] == 0.11.0", ] dev-pylint = [ # dev-pytest already defines a dependency to pylint because of the examples @@ -92,7 +92,7 @@ dev-pylint = [ dev-pytest = [ "pytest == 8.3.3", "pylint == 3.3.1", # We need this to check for the examples - "frequenz-repo-config[extra-lint-examples] == 0.10.0", + "frequenz-repo-config[extra-lint-examples] == 0.11.0", ] dev = [ "frequenz-api-test[dev-mkdocs,dev-flake8,dev-formatting,dev-mkdocs,dev-mypy,dev-noxfile,dev-pylint,dev-pytest]", diff --git a/tests_golden/integration/test_cookiecutter_generation/app/frequenz-app-test/pyproject.toml b/tests_golden/integration/test_cookiecutter_generation/app/frequenz-app-test/pyproject.toml index 5274acad..6f21a230 100644 --- a/tests_golden/integration/test_cookiecutter_generation/app/frequenz-app-test/pyproject.toml +++ b/tests_golden/integration/test_cookiecutter_generation/app/frequenz-app-test/pyproject.toml @@ -5,7 +5,7 @@ requires = [ "setuptools == 75.5.0", "setuptools_scm[toml] == 8.1.0", - "frequenz-repo-config[app] == 0.10.0", + "frequenz-repo-config[app] == 0.11.0", ] build-backend = "setuptools.build_meta" @@ -59,7 +59,7 @@ dev-mkdocs = [ "mkdocs-material == 9.5.45", "mkdocstrings[python] == 0.27.0", "mkdocstrings-python == 1.12.2", - "frequenz-repo-config[app] == 0.10.0", + "frequenz-repo-config[app] == 0.11.0", ] dev-mypy = [ "mypy == 1.9.0", @@ -69,7 +69,7 @@ dev-mypy = [ ] dev-noxfile = [ "nox == 2024.10.9", - "frequenz-repo-config[app] == 0.10.0", + "frequenz-repo-config[app] == 0.11.0", ] dev-pylint = [ # dev-pytest already defines a dependency to pylint because of the examples @@ -79,7 +79,7 @@ dev-pylint = [ dev-pytest = [ "pytest == 8.3.3", "pylint == 3.3.1", # We need this to check for the examples - "frequenz-repo-config[extra-lint-examples] == 0.10.0", + "frequenz-repo-config[extra-lint-examples] == 0.11.0", "pytest-mock == 3.14.0", "pytest-asyncio == 0.24.0", "async-solipsism == 0.6", diff --git a/tests_golden/integration/test_cookiecutter_generation/lib/frequenz-test-python/pyproject.toml b/tests_golden/integration/test_cookiecutter_generation/lib/frequenz-test-python/pyproject.toml index 9b3dbc77..a2c6979b 100644 --- a/tests_golden/integration/test_cookiecutter_generation/lib/frequenz-test-python/pyproject.toml +++ b/tests_golden/integration/test_cookiecutter_generation/lib/frequenz-test-python/pyproject.toml @@ -5,7 +5,7 @@ requires = [ "setuptools == 75.5.0", "setuptools_scm[toml] == 8.1.0", - "frequenz-repo-config[lib] == 0.10.0", + "frequenz-repo-config[lib] == 0.11.0", ] build-backend = "setuptools.build_meta" @@ -56,7 +56,7 @@ dev-mkdocs = [ "mkdocs-material == 9.5.45", "mkdocstrings[python] == 0.27.0", "mkdocstrings-python == 1.12.2", - "frequenz-repo-config[lib] == 0.10.0", + "frequenz-repo-config[lib] == 0.11.0", ] dev-mypy = [ "mypy == 1.9.0", @@ -66,7 +66,7 @@ dev-mypy = [ ] dev-noxfile = [ "nox == 2024.10.9", - "frequenz-repo-config[lib] == 0.10.0", + "frequenz-repo-config[lib] == 0.11.0", ] dev-pylint = [ # dev-pytest already defines a dependency to pylint because of the examples @@ -76,7 +76,7 @@ dev-pylint = [ dev-pytest = [ "pytest == 8.3.3", "pylint == 3.3.1", # We need this to check for the examples - "frequenz-repo-config[extra-lint-examples] == 0.10.0", + "frequenz-repo-config[extra-lint-examples] == 0.11.0", "pytest-mock == 3.14.0", "pytest-asyncio == 0.24.0", "async-solipsism == 0.6", diff --git a/tests_golden/integration/test_cookiecutter_generation/model/frequenz-model-test/pyproject.toml b/tests_golden/integration/test_cookiecutter_generation/model/frequenz-model-test/pyproject.toml index d0e4bef8..6e4410d0 100644 --- a/tests_golden/integration/test_cookiecutter_generation/model/frequenz-model-test/pyproject.toml +++ b/tests_golden/integration/test_cookiecutter_generation/model/frequenz-model-test/pyproject.toml @@ -5,7 +5,7 @@ requires = [ "setuptools == 75.5.0", "setuptools_scm[toml] == 8.1.0", - "frequenz-repo-config[model] == 0.10.0", + "frequenz-repo-config[model] == 0.11.0", ] build-backend = "setuptools.build_meta" @@ -60,7 +60,7 @@ dev-mkdocs = [ "mkdocs-material == 9.5.45", "mkdocstrings[python] == 0.27.0", "mkdocstrings-python == 1.12.2", - "frequenz-repo-config[model] == 0.10.0", + "frequenz-repo-config[model] == 0.11.0", ] dev-mypy = [ "mypy == 1.9.0", @@ -70,7 +70,7 @@ dev-mypy = [ ] dev-noxfile = [ "nox == 2024.10.9", - "frequenz-repo-config[model] == 0.10.0", + "frequenz-repo-config[model] == 0.11.0", ] dev-pylint = [ # dev-pytest already defines a dependency to pylint because of the examples @@ -80,7 +80,7 @@ dev-pylint = [ dev-pytest = [ "pytest == 8.3.3", "pylint == 3.3.1", # We need this to check for the examples - "frequenz-repo-config[extra-lint-examples] == 0.10.0", + "frequenz-repo-config[extra-lint-examples] == 0.11.0", "pytest-mock == 3.14.0", "pytest-asyncio == 0.24.0", "async-solipsism == 0.6",