Skip to content

Commit ce92be3

Browse files
mdellwegdralley
authored andcommitted
Update cookiecutter to use uv
1 parent d4515d5 commit ce92be3

30 files changed

Lines changed: 260 additions & 428 deletions

File tree

cookiecutter/apply_templates.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,22 @@
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 migrate_src_layout
19+
import tomllib
1820
import yaml
19-
2021
from cookiecutter.main import cookiecutter
2122

22-
import migrate_src_layout
2323

2424
@click.option("--bootstrap/--no-bootstrap")
2525
@click.option("--force/--no-force")
@@ -47,6 +47,12 @@ def main(bootstrap: bool, force: bool) -> None:
4747
except (FileNotFoundError, KeyError):
4848
raise click.ClickException("This does not look like a pulp cli repository.")
4949

50+
if config.get("src_layout") is not True:
51+
raise click.ClickException(
52+
"In oder to proceed, this repository needs to be migrated to the src_layout. "
53+
"See the adjacent `migrate_src_layout.py` script."
54+
)
55+
5056
config.setdefault("main_package", config["app_label"])
5157
config["current_version"] = pyproject_toml["project"]["version"]
5258

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 & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,5 +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.mypy]

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: 9 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)
@@ -32,6 +38,9 @@
3238
"pyproject.toml.update",
3339
".bumpversion.cfg",
3440
".flake8",
41+
"test_requirements.txt",
42+
"lint_requirements.txt",
43+
".ci/scripts/calc_constraints.py",
3544
{%- if not cookiecutter.glue %}
3645
"pulp-glue{{ cookiecutter.__app_label_suffix }}",
3746
"CHANGES/pulp-glue{{ cookiecutter.__app_label_suffix }}",

cookiecutter/ci/templates/cache_action

Lines changed: 0 additions & 8 deletions
This file was deleted.

cookiecutter/ci/templates/macros

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,10 @@ concurrency:
3636
with:
3737
enable-cache: true
3838
{%- endmacro -%}
39+
40+
{%- macro setup_git() -%}
41+
- name: "Setup git"
42+
run: |
43+
git config user.name pulpbot
44+
git config user.email pulp-infra@redhat.com
45+
{%- endmacro -%}

cookiecutter/ci/{{ cookiecutter.__project_name }}/.ci/scripts/calc_constraints.py

Lines changed: 0 additions & 119 deletions
This file was deleted.

cookiecutter/ci/{{ cookiecutter.__project_name }}/.ci/scripts/collect_changes.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/env python3
22
# /// script
3-
# requires-python = ">=3.11"
3+
# requires-python = ">=3.13"
44
# dependencies = [
55
# "gitpython>=3.1.46,<3.2.0",
66
# "packaging>=25.0,<25.1",

cookiecutter/ci/{{ cookiecutter.__project_name }}/.ci/scripts/validate_commit_message.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,15 +40,15 @@
4040
repo = g.get_repo("pulp/pulp-cli{{ cookiecutter.__app_label_suffix }}")
4141

4242

43-
def check_status(issue):
43+
def check_status(issue: str) -> None:
4444
gi = repo.get_issue(int(issue))
4545
if gi.pull_request:
4646
sys.exit(f"Error: issue #{issue} is a pull request.")
4747
if gi.closed_at:
4848
sys.exit(f"Error: issue #{issue} is closed.")
4949

5050

51-
def check_changelog(issue):
51+
def check_changelog(issue: str) -> None:
5252
matches = list(Path("CHANGES").rglob(f"{issue}.*"))
5353

5454
if len(matches) < 1:

0 commit comments

Comments
 (0)