Skip to content

Commit f958ec5

Browse files
committed
Update cookiecutter
1 parent 3accfde commit f958ec5

7 files changed

Lines changed: 63 additions & 24 deletions

File tree

.github/workflows/cookiecutter.yml

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,20 +21,22 @@ jobs:
2121
with:
2222
token: "${{ secrets.RELEASE_TOKEN }}"
2323
path: "pulp-cli"
24-
- name: "Set up Python"
25-
uses: "actions/setup-python@v6"
26-
with:
27-
python-version: "3.x"
2824
- name: "Setup git"
2925
run: |
3026
git config user.name pulpbot
3127
git config user.email pulp-infra@redhat.com
32-
- name: "Install python dependencies"
33-
run: |
34-
pip install cookiecutter tomlkit
28+
- name: "Set up Python"
29+
uses: "actions/setup-python@v6"
30+
with:
31+
python-version: "3.14"
32+
allow-prereleases: true
33+
- name: "Install uv"
34+
uses: "astral-sh/setup-uv@v7"
35+
with:
36+
enable-cache: true
3537
- name: "Apply cookiecutter templates"
3638
run: |
37-
../pulp-cli/cookiecutter/apply_templates.py
39+
uv run ../pulp-cli/cookiecutter/apply_templates.py
3840
if [ "$(git status --porcelain)" ]
3941
then
4042
git add .

cookiecutter/ci/templates/macros

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
{%- macro concurrency() -%}
2+
concurrency:
3+
{%- raw %}
4+
group: "main-${{ github.ref_name }}-${{ github.workflow }}"
5+
{%- endraw %}
6+
cancel-in-progress: true
7+
{%- endmacro -%}
8+
9+
{%- macro checkout(deep=false) -%}
10+
- name: "Checkout"
11+
uses: "actions/checkout@v6"
12+
{%- if deep %}
13+
with:
14+
fetch-depth: 0
15+
{%- endif %}
16+
{%- endmacro -%}
17+
18+
{%- macro download_wheels() -%}
19+
- name: "Download wheels"
20+
uses: "actions/download-artifact@v8"
21+
with:
22+
name: "pulp_cli_packages"
23+
{%- endmacro -%}
24+
25+
{%- macro setup_python(version="3.14") -%}
26+
- name: "Set up Python"
27+
uses: "actions/setup-python@v6"
28+
with:
29+
python-version: "{{ version }}"
30+
allow-prereleases: true
31+
{%- endmacro -%}
32+
33+
{%- macro install_uv() -%}
34+
- name: "Install uv"
35+
uses: "astral-sh/setup-uv@v7"
36+
with:
37+
enable-cache: true
38+
{%- endmacro -%}

cookiecutter/ci/{{ cookiecutter.__project_name }}/.github/workflows/cookiecutter.yml

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
{%- import 'macros' as macros with context -%}
12
---
23
name: "Update CI from cookiecutter"
34
on:
@@ -23,20 +24,15 @@ jobs:
2324
token: "${{ secrets.RELEASE_TOKEN }}"
2425
{%- endraw %}
2526
path: "pulp-cli{{ cookiecutter.__app_label_suffix }}"
26-
- name: "Set up Python"
27-
uses: "actions/setup-python@v6"
28-
with:
29-
python-version: "3.x"
3027
- name: "Setup git"
3128
run: |
3229
git config user.name pulpbot
3330
git config user.email pulp-infra@redhat.com
34-
- name: "Install python dependencies"
35-
run: |
36-
pip install cookiecutter tomlkit
31+
{{ macros.setup_python() | indent(6) }}
32+
{{ macros.install_uv() | indent(6) }}
3733
- name: "Apply cookiecutter templates"
3834
run: |
39-
../pulp-cli/cookiecutter/apply_templates.py
35+
uv run ../pulp-cli/cookiecutter/apply_templates.py
4036
if [ "$(git status --porcelain)" ]
4137
then
4238
git add .
@@ -77,20 +73,15 @@ jobs:
7773
token: "${{ secrets.RELEASE_TOKEN }}"
7874
{%- endraw %}
7975
path: "pulp-cli{{ cookiecutter.__app_label_suffix }}"
80-
- name: "Set up Python"
81-
uses: "actions/setup-python@v6"
82-
with:
83-
python-version: "3.x"
8476
- name: "Setup git"
8577
run: |
8678
git config user.name pulpbot
8779
git config user.email pulp-infra@redhat.com
88-
- name: "Install python dependencies"
89-
run: |
90-
pip install packaging tomlkit
80+
{{ macros.setup_python() | indent(6) }}
81+
{{ macros.install_uv() | indent(6) }}
9182
- name: "Apply cookiecutter templates"
9283
run: |
93-
../pulp-cli/cookiecutter/update_pulp_cli.py
84+
uv run ../pulp-cli/cookiecutter/update_pulp_cli.py
9485
if [ "$(git status --porcelain)" ]
9586
then
9687
git add .

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ files = "{% if cookiecutter.src_layout %}src{% else %}pulp_glue{% endif %}/**/*.
2929
mypy_path = ["{% if cookiecutter.src_layout %}src{% else %}.{% endif %}"]
3030
namespace_packages = true
3131
explicit_package_bases = true
32+
{%- if cookiecutter.__app_label_suffix == "" %}
33+
plugins = ["pydantic.mypy"]
34+
{%- endif %}
3235

3336
[[tool.mypy.overrides]]
3437
# This section is managed by the cookiecutter templates.

cookiecutter/ci/{{ cookiecutter.__project_name }}/pyproject.toml.update

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,9 @@ files = "{% if cookiecutter.src_layout %}src{% else %}pulpcore{% endif %}/**/*.p
181181
mypy_path = ["{% if cookiecutter.src_layout %}src{% else %}.{% endif %}"{% if cookiecutter.glue %}, "pulp-glue{{ cookiecutter.__app_label_suffix }}{% if cookiecutter.src_layout %}/src{% endif %}"{% endif %}]
182182
namespace_packages = true
183183
explicit_package_bases = true
184+
{%- if cookiecutter.__app_label_suffix == "" %}
185+
plugins = ["pydantic.mypy"]
186+
{%- endif %}
184187

185188
[[tool.mypy.overrides]]
186189
# This section is managed by the cookiecutter templates.

pulp-glue/pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ files = "src/**/*.py, tests/**/*.py"
5454
mypy_path = ["src"]
5555
namespace_packages = true
5656
explicit_package_bases = true
57+
plugins = ["pydantic.mypy"]
5758

5859
[[tool.mypy.overrides]]
5960
# This section is managed by the cookiecutter templates.

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,7 @@ files = "src/**/*.py, tests/*.py"
235235
mypy_path = ["src", "pulp-glue/src"]
236236
namespace_packages = true
237237
explicit_package_bases = true
238+
plugins = ["pydantic.mypy"]
238239

239240
[[tool.mypy.overrides]]
240241
# This section is managed by the cookiecutter templates.

0 commit comments

Comments
 (0)