Skip to content

Commit 22bbc00

Browse files
committed
Remove the _extensions key from the replay file
It is not needed in the generated project, we always want to use the ones from the repo-config template. This should ease upgrading projects, making it less likely to have errors about missing extensions. Signed-off-by: Leandro Lucarella <[email protected]>
1 parent ba57c6c commit 22bbc00

File tree

7 files changed

+17
-61
lines changed

7 files changed

+17
-61
lines changed

RELEASE_NOTES.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
### Cookiecutter template
1212

13-
<!-- Here upgrade steps for cookiecutter specifically -->
13+
- If your replay file contains a `_extensions` key, you should remove it, as you most likely want to use the extensions declared by the repo-config cookiecutter template you are upgrading to, otherwise you could get errors about missing extensions.
1414

1515
## New Features
1616

@@ -25,6 +25,12 @@
2525

2626
This makes it easier to upgrade projects to new templates, as removing whole lines is easier than having to edit them.
2727

28+
- Clean up `_extensions` from the generated replay file.
29+
30+
It is not needed in the generated project, we always want to use the ones from the repo-config template.
31+
32+
This should ease upgrading projects, making it less likely to have errors about missing extensions.
33+
2834
## Bug Fixes
2935

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

cookiecutter/hooks/post_gen_project.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,11 @@ def clean_replay_file(
155155
# the generated project.
156156
replay_data["cookiecutter"].pop("_output_dir", None)
157157

158+
# Remove the _extensions key from the replay data because it is not needed in the
159+
# generated project, we always want to use the ones from the repo-config template.
160+
# This should ease upgrading.
161+
replay_data["cookiecutter"].pop("_extensions", None)
162+
158163
if template := replay_data["cookiecutter"].get("_template"):
159164
if not template.startswith(("gh:", "git@", "https://")):
160165
print(

tests_golden/integration/test_cookiecutter_generation/actor/frequenz-actor-test/.cookiecutter-replay.json

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,6 @@
1313
"python_package": "frequenz.actor.test",
1414
"pypi_package_name": "frequenz-actor-test",
1515
"github_repo_name": "frequenz-actor-test",
16-
"default_codeowners": "(like @some-org/some-team; defaults to a team based on the repo type)",
17-
"_extensions": [
18-
"local_extensions.as_identifier",
19-
"local_extensions.default_codeowners",
20-
"local_extensions.github_repo_name",
21-
"local_extensions.introduction",
22-
"local_extensions.keywords",
23-
"local_extensions.pypi_package_name",
24-
"local_extensions.python_package",
25-
"local_extensions.src_path",
26-
"local_extensions.title"
27-
]
16+
"default_codeowners": "(like @some-org/some-team; defaults to a team based on the repo type)"
2817
}
2918
}

tests_golden/integration/test_cookiecutter_generation/api/frequenz-api-test/.cookiecutter-replay.json

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,6 @@
1313
"python_package": "frequenz.api.test",
1414
"pypi_package_name": "frequenz-api-test",
1515
"github_repo_name": "frequenz-api-test",
16-
"default_codeowners": "(like @some-org/some-team; defaults to a team based on the repo type)",
17-
"_extensions": [
18-
"local_extensions.as_identifier",
19-
"local_extensions.default_codeowners",
20-
"local_extensions.github_repo_name",
21-
"local_extensions.introduction",
22-
"local_extensions.keywords",
23-
"local_extensions.pypi_package_name",
24-
"local_extensions.python_package",
25-
"local_extensions.src_path",
26-
"local_extensions.title"
27-
]
16+
"default_codeowners": "(like @some-org/some-team; defaults to a team based on the repo type)"
2817
}
2918
}

tests_golden/integration/test_cookiecutter_generation/app/frequenz-app-test/.cookiecutter-replay.json

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,6 @@
1313
"python_package": "frequenz.app.test",
1414
"pypi_package_name": "frequenz-app-test",
1515
"github_repo_name": "frequenz-app-test",
16-
"default_codeowners": "(like @some-org/some-team; defaults to a team based on the repo type)",
17-
"_extensions": [
18-
"local_extensions.as_identifier",
19-
"local_extensions.default_codeowners",
20-
"local_extensions.github_repo_name",
21-
"local_extensions.introduction",
22-
"local_extensions.keywords",
23-
"local_extensions.pypi_package_name",
24-
"local_extensions.python_package",
25-
"local_extensions.src_path",
26-
"local_extensions.title"
27-
]
16+
"default_codeowners": "(like @some-org/some-team; defaults to a team based on the repo type)"
2817
}
2918
}

tests_golden/integration/test_cookiecutter_generation/lib/frequenz-test-python/.cookiecutter-replay.json

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,6 @@
1313
"python_package": "frequenz.test",
1414
"pypi_package_name": "frequenz-test",
1515
"github_repo_name": "frequenz-test-python",
16-
"default_codeowners": "(like @some-org/some-team; defaults to a team based on the repo type)",
17-
"_extensions": [
18-
"local_extensions.as_identifier",
19-
"local_extensions.default_codeowners",
20-
"local_extensions.github_repo_name",
21-
"local_extensions.introduction",
22-
"local_extensions.keywords",
23-
"local_extensions.pypi_package_name",
24-
"local_extensions.python_package",
25-
"local_extensions.src_path",
26-
"local_extensions.title"
27-
]
16+
"default_codeowners": "(like @some-org/some-team; defaults to a team based on the repo type)"
2817
}
2918
}

tests_golden/integration/test_cookiecutter_generation/model/frequenz-model-test/.cookiecutter-replay.json

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,6 @@
1313
"python_package": "frequenz.model.test",
1414
"pypi_package_name": "frequenz-model-test",
1515
"github_repo_name": "frequenz-model-test",
16-
"default_codeowners": "(like @some-org/some-team; defaults to a team based on the repo type)",
17-
"_extensions": [
18-
"local_extensions.as_identifier",
19-
"local_extensions.default_codeowners",
20-
"local_extensions.github_repo_name",
21-
"local_extensions.introduction",
22-
"local_extensions.keywords",
23-
"local_extensions.pypi_package_name",
24-
"local_extensions.python_package",
25-
"local_extensions.src_path",
26-
"local_extensions.title"
27-
]
16+
"default_codeowners": "(like @some-org/some-team; defaults to a team based on the repo type)"
2817
}
2918
}

0 commit comments

Comments
 (0)