Skip to content

Commit ecab532

Browse files
committed
Update cookiecutter to use uv
1 parent 89ef700 commit ecab532

File tree

32 files changed

+238
-284
lines changed

32 files changed

+238
-284
lines changed

cookiecutter/apply_templates.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,19 @@
44
# dependencies = [
55
# "click>=8.3.1,<8.4",
66
# "cookiecutter>=2.6.0,<2.7",
7+
# "jamldump>=1.2.0,<1.3.0",
78
# "pyyaml>=6.0.3,<6.1",
89
# "tomlkit>=0.13.3,<0.14",
910
# ]
1011
# ///
1112

1213

1314
import os
14-
import tomllib
1515
from pathlib import Path
1616

1717
import click
18+
import tomllib
1819
import yaml
19-
2020
from cookiecutter.main import cookiecutter
2121

2222

@@ -43,6 +43,12 @@ def main(bootstrap: bool, force: bool) -> None:
4343
except (FileNotFoundError, KeyError):
4444
raise click.ClickException("This does not look like a pulp cli repository.")
4545

46+
if config.get("src_layout") is not True:
47+
raise click.ClickException(
48+
"In oder to proceed, this repository needs to be migrated to the src_layout. "
49+
"See the adjacent `migrate_src_layout.py` script."
50+
)
51+
4652
config.setdefault("main_package", config["app_label"])
4753
config["current_version"] = pyproject_toml["project"]["version"]
4854

cookiecutter/bootstrap/cookiecutter.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,5 @@
1515
"repository": "https://github.com/pulp/{{ cookiecutter.__project_name }}",
1616
"_copy_without_render": [
1717
],
18-
"_extensions": [".pulp_filter_extension.PulpFilterExtension"]
18+
"_extensions": ["jamldump.jinja2.Jaml", ".pulp_filter_extension.PulpFilterExtension"]
1919
}

cookiecutter/bootstrap/{{ cookiecutter.__project_name }}/pulp-glue{{ cookiecutter.__app_label_suffix }}/pyproject.toml

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -28,24 +28,3 @@ dependencies = [
2828
[project.urls]
2929
repository = "https://github.com/pulp/{{ cookiecutter.__project_name }}"
3030
changelog = "https://github.com/pulp/{{ cookiecutter.__project_name }}/blob/main/CHANGES.md"
31-
32-
[tool.setuptools.packages.find]
33-
where = ["."]
34-
include = ["pulp_glue.*"]
35-
namespaces = true
36-
37-
[tool.setuptools.package-data]
38-
"*" = ["py.typed", "locale/*/LC_MESSAGES/*.mo"]
39-
40-
[tool.mypy]
41-
strict = true
42-
show_error_codes = true
43-
files = "pulp_glue/**/*.py"
44-
namespace_packages = true
45-
explicit_package_bases = true
46-
47-
[[tool.mypy.overrides]]
48-
module = [
49-
"schema.*",
50-
]
51-
ignore_missing_imports = true

cookiecutter/bootstrap/{{ cookiecutter.__project_name }}/pulp-glue{{ cookiecutter.__app_label_suffix }}/pulp_glue/{{ cookiecutter.app_label }}/py.typed renamed to cookiecutter/bootstrap/{{ cookiecutter.__project_name }}/pulp-glue{{ cookiecutter.__app_label_suffix }}/src/pulp_glue/{{ cookiecutter.app_label }}/__init__.py

File renamed without changes.

cookiecutter/bootstrap/{{ cookiecutter.__project_name }}/pulp-glue{{ cookiecutter.__app_label_suffix }}/pulp_glue/{{ cookiecutter.app_label }}/context.py renamed to cookiecutter/bootstrap/{{ cookiecutter.__project_name }}/pulp-glue{{ cookiecutter.__app_label_suffix }}/src/pulp_glue/{{ cookiecutter.app_label }}/context.py

File renamed without changes.

cookiecutter/bootstrap/{{ cookiecutter.__project_name }}/pulpcore/cli/{{ cookiecutter.app_label }}/py.typed renamed to cookiecutter/bootstrap/{{ cookiecutter.__project_name }}/pulp-glue{{ cookiecutter.__app_label_suffix }}/src/pulp_glue/{{ cookiecutter.app_label }}/py.typed

File renamed without changes.

cookiecutter/bootstrap/{{ cookiecutter.__project_name }}/pulpcore/cli/{{ cookiecutter.app_label }}/__init__.py renamed to cookiecutter/bootstrap/{{ cookiecutter.__project_name }}/src/pulpcore/cli/{{ cookiecutter.app_label }}/__init__.py

File renamed without changes.

cookiecutter/bootstrap/{{ cookiecutter.__project_name }}/src/pulpcore/cli/{{ cookiecutter.app_label }}/py.typed

Whitespace-only changes.

cookiecutter/ci/cookiecutter.json

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,7 @@
1515
"repository": "https://github.com/pulp/{{ cookiecutter.__project_name }}",
1616
"_copy_without_render": [
1717
"CHANGES/.TEMPLATE.md",
18-
".github/workflows/collect_changes.yml",
19-
".github/workflows/release.yml",
20-
".github/workflows/release_branch.yml",
21-
".github/workflows/pr_checks.yml",
2218
".ci/nginx.conf.j2"
2319
],
24-
"_extensions": [".pulp_filter_extension.PulpFilterExtension"]
20+
"_extensions": ["jamldump.jinja2.Jaml", ".pulp_filter_extension.PulpFilterExtension"]
2521
}

cookiecutter/ci/hooks/post_gen_project.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,12 @@
1919
# Is merging on the tool level appropriate?
2020
pyproject_toml["tool"].update(pyproject_toml_update["tool"])
2121

22+
if "dependency-groups" in pyproject_toml_update:
23+
if "dependency-groups" not in pyproject_toml:
24+
pyproject_toml["dependency-groups"]=pyproject_toml_update["dependency-groups"]
25+
else:
26+
pyproject_toml["dependency-groups"].update(pyproject_toml_update["dependency-groups"])
27+
2228
# Remove legacy tools.
2329
for tool in ["flake8", "black", "isort"]:
2430
pyproject_toml["tool"].pop(tool, None)

0 commit comments

Comments
 (0)