diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index cc7e6449..498e41a1 100644 --- a/RELEASE_NOTES.md +++ b/RELEASE_NOTES.md @@ -22,7 +22,7 @@ But you might still need to adapt your code: ## New Features - +* `mkdocsstrings-python` v2 is now supported. ### Cookiecutter template @@ -31,6 +31,8 @@ But you might still need to adapt your code: - Dependencies have been updated. - Added Dependabot auto-merge workflow using `frequenz-floss/dependabot-auto-approve` action. - Migration script now creates auto-merge workflow and disables CODEOWNERS review requirement via GitHub API. +- The `import` key in `mkdocs.yml` under `mkdocstrings` has to be renamed to `inventories`. +- The `paths` key in `mkdocs.yml` under `mkdocstrings` has to be moved from the `options` key to the `python` key. ## Bug Fixes diff --git a/cookiecutter/migrate.py b/cookiecutter/migrate.py index b5f80fbf..9264720e 100644 --- a/cookiecutter/migrate.py +++ b/cookiecutter/migrate.py @@ -39,10 +39,31 @@ def main() -> None: print("Disabling CODEOWNERS review requirement in GitHub ruleset...") disable_codeowners_review_requirement() print("=" * 72) + print("Updating the mkdocs.yml for mkdocstrings-python v2 compatibility...") + update_mkdocs_yml_mkdocstrings_python_v2() + print("=" * 72) print("Migration script finished. Remember to follow any manual instructions.") print("=" * 72) +def update_mkdocs_yml_mkdocstrings_python_v2() -> None: + """Rename 'inventories' imports to 'inventory'.""" + replace_file_contents_atomically( + filepath=Path("mkdocs.yml"), + old=" import:", + new=" inventories:", + ) + replace_file_contents_atomically( + filepath=Path("mkdocs.yml"), + old="""\ + options: + paths: ["src"]""", + new="""\ + paths: ["src"] + options:""", + ) + + def create_dependabot_auto_merge_workflow() -> None: """Create the Dependabot auto-merge workflow file.""" workflow_dir = Path(".github") / "workflows" diff --git a/cookiecutter/{{cookiecutter.github_repo_name}}/mkdocs.yml b/cookiecutter/{{cookiecutter.github_repo_name}}/mkdocs.yml index 476d4c34..f8ae329c 100644 --- a/cookiecutter/{{cookiecutter.github_repo_name}}/mkdocs.yml +++ b/cookiecutter/{{cookiecutter.github_repo_name}}/mkdocs.yml @@ -102,8 +102,8 @@ plugins: - mkdocstrings: default_handler: python handlers: + paths: ["{{cookiecutter | src_path}}"] python: - paths: ["{{cookiecutter | src_path}}"] options: docstring_section_style: spacy inherited_members: true diff --git a/cookiecutter/{{cookiecutter.github_repo_name}}/pyproject.toml b/cookiecutter/{{cookiecutter.github_repo_name}}/pyproject.toml index af4e247b..e7b5eb45 100644 --- a/cookiecutter/{{cookiecutter.github_repo_name}}/pyproject.toml +++ b/cookiecutter/{{cookiecutter.github_repo_name}}/pyproject.toml @@ -99,8 +99,8 @@ dev-mkdocs = [ "mkdocs-literate-nav == 0.6.2", "mkdocs-macros-plugin == 1.3.9", "mkdocs-material == 9.6.18", - "mkdocstrings[python] == 0.30.0", - "mkdocstrings-python == 1.17.0", + "mkdocstrings[python] == 1.0.0", + "mkdocstrings-python == 2.0.1", "frequenz-repo-config[{{cookiecutter.type}}] == 0.13.1", ] dev-mypy = [ diff --git a/pyproject.toml b/pyproject.toml index 47d03225..6be23a59 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -41,7 +41,7 @@ dependencies = [ "mkdocs-gen-files >= 0.4.0, < 0.6.0", "semver >= 3.0.1, < 4", "github-action-utils >= 1.1.0, < 2", - "mkdocstrings-python >= 1.14.6, < 2", + "mkdocstrings-python >= 1.14.6, < 3", ] dynamic = ["version"] @@ -83,8 +83,8 @@ dev-mkdocs = [ "mkdocs-literate-nav == 0.6.2", "mkdocs-macros-plugin == 1.4.0", "mkdocs-material == 9.6.21", - "mkdocstrings[python] == 0.30.1", - "mkdocstrings-python == 1.18.2", + "mkdocstrings[python] == 1.0.0", + "mkdocstrings-python == 2.0.1", ] dev-mypy = [ "mypy == 1.18.2", diff --git a/tests_golden/integration/test_cookiecutter_generation/actor/frequenz-actor-test/mkdocs.yml b/tests_golden/integration/test_cookiecutter_generation/actor/frequenz-actor-test/mkdocs.yml index 2a28152f..887a4a9e 100644 --- a/tests_golden/integration/test_cookiecutter_generation/actor/frequenz-actor-test/mkdocs.yml +++ b/tests_golden/integration/test_cookiecutter_generation/actor/frequenz-actor-test/mkdocs.yml @@ -102,8 +102,8 @@ plugins: - mkdocstrings: default_handler: python handlers: + paths: ["src"] python: - paths: ["src"] options: docstring_section_style: spacy inherited_members: true 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 18d955ff..9f4daa8d 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 @@ -58,8 +58,8 @@ dev-mkdocs = [ "mkdocs-literate-nav == 0.6.2", "mkdocs-macros-plugin == 1.3.9", "mkdocs-material == 9.6.18", - "mkdocstrings[python] == 0.30.0", - "mkdocstrings-python == 1.17.0", + "mkdocstrings[python] == 1.0.0", + "mkdocstrings-python == 2.0.1", "frequenz-repo-config[actor] == 0.13.1", ] dev-mypy = [ diff --git a/tests_golden/integration/test_cookiecutter_generation/api/frequenz-api-test/mkdocs.yml b/tests_golden/integration/test_cookiecutter_generation/api/frequenz-api-test/mkdocs.yml index 337aaf66..f138d3e2 100644 --- a/tests_golden/integration/test_cookiecutter_generation/api/frequenz-api-test/mkdocs.yml +++ b/tests_golden/integration/test_cookiecutter_generation/api/frequenz-api-test/mkdocs.yml @@ -102,8 +102,8 @@ plugins: - mkdocstrings: default_handler: python handlers: + paths: ["py"] python: - paths: ["py"] options: docstring_section_style: spacy inherited_members: true 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 2937992b..3a563d64 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 @@ -69,8 +69,8 @@ dev-mkdocs = [ "mkdocs-literate-nav == 0.6.2", "mkdocs-macros-plugin == 1.3.9", "mkdocs-material == 9.6.18", - "mkdocstrings[python] == 0.30.0", - "mkdocstrings-python == 1.17.0", + "mkdocstrings[python] == 1.0.0", + "mkdocstrings-python == 2.0.1", "frequenz-repo-config[api] == 0.13.1", ] dev-mypy = [ diff --git a/tests_golden/integration/test_cookiecutter_generation/app/frequenz-app-test/mkdocs.yml b/tests_golden/integration/test_cookiecutter_generation/app/frequenz-app-test/mkdocs.yml index 78209bdf..76ca19c5 100644 --- a/tests_golden/integration/test_cookiecutter_generation/app/frequenz-app-test/mkdocs.yml +++ b/tests_golden/integration/test_cookiecutter_generation/app/frequenz-app-test/mkdocs.yml @@ -102,8 +102,8 @@ plugins: - mkdocstrings: default_handler: python handlers: + paths: ["src"] python: - paths: ["src"] options: docstring_section_style: spacy inherited_members: true 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 4737b8ab..78c11d10 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 @@ -57,8 +57,8 @@ dev-mkdocs = [ "mkdocs-literate-nav == 0.6.2", "mkdocs-macros-plugin == 1.3.9", "mkdocs-material == 9.6.18", - "mkdocstrings[python] == 0.30.0", - "mkdocstrings-python == 1.17.0", + "mkdocstrings[python] == 1.0.0", + "mkdocstrings-python == 2.0.1", "frequenz-repo-config[app] == 0.13.1", ] dev-mypy = [ diff --git a/tests_golden/integration/test_cookiecutter_generation/lib/frequenz-test-python/mkdocs.yml b/tests_golden/integration/test_cookiecutter_generation/lib/frequenz-test-python/mkdocs.yml index 721c8280..da0c4ae8 100644 --- a/tests_golden/integration/test_cookiecutter_generation/lib/frequenz-test-python/mkdocs.yml +++ b/tests_golden/integration/test_cookiecutter_generation/lib/frequenz-test-python/mkdocs.yml @@ -102,8 +102,8 @@ plugins: - mkdocstrings: default_handler: python handlers: + paths: ["src"] python: - paths: ["src"] options: docstring_section_style: spacy inherited_members: true 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 1d6d5942..a068f130 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 @@ -54,8 +54,8 @@ dev-mkdocs = [ "mkdocs-literate-nav == 0.6.2", "mkdocs-macros-plugin == 1.3.9", "mkdocs-material == 9.6.18", - "mkdocstrings[python] == 0.30.0", - "mkdocstrings-python == 1.17.0", + "mkdocstrings[python] == 1.0.0", + "mkdocstrings-python == 2.0.1", "frequenz-repo-config[lib] == 0.13.1", ] dev-mypy = [ diff --git a/tests_golden/integration/test_cookiecutter_generation/model/frequenz-model-test/mkdocs.yml b/tests_golden/integration/test_cookiecutter_generation/model/frequenz-model-test/mkdocs.yml index 946df0b4..29eab59f 100644 --- a/tests_golden/integration/test_cookiecutter_generation/model/frequenz-model-test/mkdocs.yml +++ b/tests_golden/integration/test_cookiecutter_generation/model/frequenz-model-test/mkdocs.yml @@ -102,8 +102,8 @@ plugins: - mkdocstrings: default_handler: python handlers: + paths: ["src"] python: - paths: ["src"] options: docstring_section_style: spacy inherited_members: true 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 a377f14e..ae997a0d 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 @@ -58,8 +58,8 @@ dev-mkdocs = [ "mkdocs-literate-nav == 0.6.2", "mkdocs-macros-plugin == 1.3.9", "mkdocs-material == 9.6.18", - "mkdocstrings[python] == 0.30.0", - "mkdocstrings-python == 1.17.0", + "mkdocstrings[python] == 1.0.0", + "mkdocstrings-python == 2.0.1", "frequenz-repo-config[model] == 0.13.1", ] dev-mypy = [