Skip to content

Commit e8baa54

Browse files
committed
Merge branch 'master' into lint-format-template-with-ruff
2 parents e4eb0df + 1a81521 commit e8baa54

23 files changed

+209
-81
lines changed

.github/contributors.json

+5
Original file line numberDiff line numberDiff line change
@@ -1688,5 +1688,10 @@
16881688
"name": "Ed Morley",
16891689
"github_login": "edmorley",
16901690
"twitter_username": ""
1691+
},
1692+
{
1693+
"name": "Alan Cyment",
1694+
"github_login": "acyment",
1695+
"twitter_username": ""
16911696
}
16921697
]

.github/workflows/ruff-version.yml .github/workflows/align-versions.yml

+18-4
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,33 @@
1-
name: ruff
1+
name: align versions
22

33
on:
44
pull_request:
55
paths:
66
- "{{cookiecutter.project_slug}}/requirements/local.txt"
7+
- "{{cookiecutter.project_slug}}/compose/local/node/Dockerfile"
8+
# Manual trigger
9+
workflow_dispatch:
710

811
permissions:
912
contents: write
1013
pull-requests: write
1114

1215
jobs:
13-
version:
16+
run:
1417
runs-on: ubuntu-latest
1518
env:
1619
GH_PAT: ${{ secrets.GH_PAT }}
20+
21+
strategy:
22+
fail-fast: false
23+
matrix:
24+
job:
25+
- script: scripts/ruff_version.py
26+
name: Ruff
27+
- script: scripts/node_version.py
28+
name: Node
29+
30+
name: "${{ matrix.job.name }} versions"
1731
steps:
1832
- name: Checkout with token
1933
uses: actions/checkout@v4
@@ -30,8 +44,8 @@ jobs:
3044

3145
- uses: astral-sh/setup-uv@v5
3246

33-
- run: uv run scripts/ruff_version.py
47+
- run: uv run ${{ matrix.job.script }}
3448

3549
- uses: stefanzweifel/git-auto-commit-action@v5
3650
with:
37-
commit_message: Align Ruff versions
51+
commit_message: Align versions

.github/workflows/ci.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,6 @@ jobs:
103103
run: uv sync
104104
- uses: actions/setup-node@v4
105105
with:
106-
node-version: "22.13"
106+
node-version: "22.14"
107107
- name: Bare Metal ${{ matrix.script.name }}
108108
run: sh tests/test_bare.sh ${{ matrix.script.args }}

.pre-commit-config.yaml

-8
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,6 @@ repos:
3838
hooks:
3939
- id: pyproject-fmt
4040

41-
- repo: local
42-
hooks:
43-
- id: node-version-checker
44-
name: node-version-checker
45-
entry: python scripts/node_version.py
46-
language: python
47-
files: .
48-
4941
ci:
5042
autoupdate_schedule: weekly
5143
skip: []

CHANGELOG.md

+107
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,113 @@ All enhancements and patches to Cookiecutter Django will be documented in this f
33

44
<!-- GENERATOR_PLACEHOLDER -->
55

6+
## 2025.02.17
7+
8+
9+
### Updated
10+
11+
- Update sentry-sdk to 2.22.0 ([#5692](https://github.com/cookiecutter/cookiecutter-django/pull/5692))
12+
13+
- Update django-storages to 1.14.5 ([#5690](https://github.com/cookiecutter/cookiecutter-django/pull/5690))
14+
15+
## 2025.02.14
16+
17+
18+
### Updated
19+
20+
- Bump node from 22.13 to 22.14 ([#5688](https://github.com/cookiecutter/cookiecutter-django/pull/5688))
21+
22+
## 2025.02.13
23+
24+
25+
### Updated
26+
27+
- Update sentry-sdk to 2.21.0 ([#5687](https://github.com/cookiecutter/cookiecutter-django/pull/5687))
28+
29+
## 2025.02.11
30+
31+
32+
### Updated
33+
34+
- Update coverage to 7.6.12 ([#5686](https://github.com/cookiecutter/cookiecutter-django/pull/5686))
35+
36+
## 2025.02.10
37+
38+
39+
### Updated
40+
41+
- Update pytest-django to 4.10.0 ([#5684](https://github.com/cookiecutter/cookiecutter-django/pull/5684))
42+
43+
- Update ruff to 0.9.6 ([#5683](https://github.com/cookiecutter/cookiecutter-django/pull/5683))
44+
45+
- Bump amazon/aws-cli from 2.23.0 to 2.24.0 ([#5682](https://github.com/cookiecutter/cookiecutter-django/pull/5682))
46+
47+
## 2025.02.08
48+
49+
50+
### Updated
51+
52+
- Update coverage to 7.6.11 ([#5681](https://github.com/cookiecutter/cookiecutter-django/pull/5681))
53+
54+
## 2025.02.07
55+
56+
57+
### Updated
58+
59+
- Update mypy to 1.15.0 ([#5664](https://github.com/cookiecutter/cookiecutter-django/pull/5664))
60+
61+
- Update django-stubs to 5.1.3 ([#5680](https://github.com/cookiecutter/cookiecutter-django/pull/5680))
62+
63+
- Bump python from 3.12.8 to 3.12.9 in local Docker image ([#5678](https://github.com/cookiecutter/cookiecutter-django/pull/5678))
64+
65+
- Bump python from 3.12.8 to 3.12.9 in production Docker image ([#5677](https://github.com/cookiecutter/cookiecutter-django/pull/5677))
66+
67+
- Bump python from 3.12.8 to 3.12.9 in docs Docker image ([#5676](https://github.com/cookiecutter/cookiecutter-django/pull/5676))
68+
69+
- Update django-allauth to 65.4.1 ([#5679](https://github.com/cookiecutter/cookiecutter-django/pull/5679))
70+
71+
- Update django-cors-headers to 4.7.0 ([#5675](https://github.com/cookiecutter/cookiecutter-django/pull/5675))
72+
73+
- Update whitenoise to 6.9.0 ([#5674](https://github.com/cookiecutter/cookiecutter-django/pull/5674))
74+
75+
## 2025.02.06
76+
77+
78+
### Fixed
79+
80+
- Bump node version in production Dockerfile from 20 to 22.13 ([#5672](https://github.com/cookiecutter/cookiecutter-django/pull/5672))
81+
82+
### Updated
83+
84+
- Update ruff to 0.9.5 ([#5673](https://github.com/cookiecutter/cookiecutter-django/pull/5673))
85+
86+
## 2025.02.05
87+
88+
89+
### Changed
90+
91+
- Add missing trailing slash in test `MEDIA_URL` ([#5666](https://github.com/cookiecutter/cookiecutter-django/pull/5666))
92+
93+
### Updated
94+
95+
- Update django to 5.0.12 ([#5667](https://github.com/cookiecutter/cookiecutter-django/pull/5667))
96+
97+
## 2025.02.03
98+
99+
100+
### Updated
101+
102+
- Bump traefik from 3.3.2 to 3.3.3 ([#5660](https://github.com/cookiecutter/cookiecutter-django/pull/5660))
103+
104+
- Update factory-boy to 3.3.2 ([#5661](https://github.com/cookiecutter/cookiecutter-django/pull/5661))
105+
106+
## 2025.01.30
107+
108+
109+
### Updated
110+
111+
- Update ruff to 0.9.4 ([#5659](https://github.com/cookiecutter/cookiecutter-django/pull/5659))
112+
6113
## 2025.01.26
7114

8115

CONTRIBUTORS.md

+7
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,13 @@ Listed in alphabetical order.
201201
</td>
202202
<td></td>
203203
</tr>
204+
<tr>
205+
<td>Alan Cyment</td>
206+
<td>
207+
<a href="https://github.com/acyment">acyment</a>
208+
</td>
209+
<td></td>
210+
</tr>
204211
<tr>
205212
<td>Alberto Sanchez</td>
206213
<td>

pyproject.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "cookiecutter-django"
3-
version = "2025.01.26"
3+
version = "2025.02.17"
44
description = "A Cookiecutter template for creating production-ready Django projects quickly."
55
readme = "README.md"
66
keywords = [
@@ -43,7 +43,7 @@ dependencies = [
4343
"pytest-xdist==3.6.1",
4444
"pyyaml==6.0.2",
4545
"requests==2.32.3",
46-
"ruff==0.9.3",
46+
"ruff==0.9.6",
4747
"sh==2.1; sys_platform!='win23'",
4848
"tox==4.23.2",
4949
"tox-uv>=1.17",

scripts/node_version.py

+19-11
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,26 @@
1+
from __future__ import annotations
2+
13
import json
24
from pathlib import Path
35

46
ROOT = Path(__file__).parent.parent
57
TEMPLATED_ROOT = ROOT / "{{cookiecutter.project_slug}}"
68
DOCKERFILE = TEMPLATED_ROOT / "compose" / "local" / "node" / "Dockerfile"
9+
PROD_DOCKERFILE = TEMPLATED_ROOT / "compose" / "production" / "django" / "Dockerfile"
710
PACKAGE_JSON = TEMPLATED_ROOT / "package.json"
811
CI_YML = ROOT / ".github" / "workflows" / "ci.yml"
912

1013

11-
class VersionNotFoundError(RuntimeError):
12-
def __init__(self):
13-
super().__init__("Could not find version in Dockerfile")
14-
15-
16-
def main():
14+
def main() -> None:
1715
new_version = get_version_from_dockerfile()
1816
old_version = get_version_from_package_json()
1917
if old_version != new_version:
2018
update_package_json_version(old_version, new_version)
2119
update_ci_node_version(old_version, new_version)
20+
update_production_node_version(old_version, new_version)
2221

2322

24-
def get_version_from_dockerfile():
23+
def get_version_from_dockerfile() -> str:
2524
# Extract version out of base image name:
2625
# FROM docker.io/node:22.13-bookworm-slim
2726
# -> 22.13
@@ -31,15 +30,15 @@ def get_version_from_dockerfile():
3130
_, _, docker_tag = line.partition(":")
3231
version_str, _, _ = docker_tag.partition("-")
3332
return version_str
34-
raise VersionNotFoundError
33+
raise RuntimeError("Could not find version in Dockerfile") # noqa: TRY003
3534

3635

37-
def get_version_from_package_json():
36+
def get_version_from_package_json() -> str:
3837
package_json = json.loads(PACKAGE_JSON.read_text())
3938
return package_json["engines"]["node"]
4039

4140

42-
def update_package_json_version(old_version, new_version):
41+
def update_package_json_version(old_version: str, new_version: str) -> None:
4342
package_json_text = PACKAGE_JSON.read_text()
4443
package_json_text = package_json_text.replace(
4544
f'"node": "{old_version}"',
@@ -48,7 +47,7 @@ def update_package_json_version(old_version, new_version):
4847
PACKAGE_JSON.write_text(package_json_text)
4948

5049

51-
def update_ci_node_version(old_version, new_version):
50+
def update_ci_node_version(old_version: str, new_version: str) -> None:
5251
yml_content = CI_YML.read_text()
5352
yml_content = yml_content.replace(
5453
f'node-version: "{old_version}"',
@@ -57,5 +56,14 @@ def update_ci_node_version(old_version, new_version):
5756
CI_YML.write_text(yml_content)
5857

5958

59+
def update_production_node_version(old_version: str, new_version: str) -> None:
60+
dockerfile_content = PROD_DOCKERFILE.read_text()
61+
dockerfile_content = dockerfile_content.replace(
62+
f"FROM docker.io/node:{old_version}",
63+
f"FROM docker.io/node:{new_version}",
64+
)
65+
PROD_DOCKERFILE.write_text(dockerfile_content)
66+
67+
6068
if __name__ == "__main__":
6169
main()

scripts/ruff_version.py

+1-6
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,6 @@
1010
PYPROJECT_TOML = ROOT / "pyproject.toml"
1111

1212

13-
class VersionNotFoundError(RuntimeError):
14-
def __init__(self, filename):
15-
super().__init__(f"Could not find version in {filename}")
16-
17-
1813
def main():
1914
new_version = get_requirements_txt_version()
2015
old_version = get_pyproject_toml_version()
@@ -38,7 +33,7 @@ def get_pyproject_toml_version():
3833
for dependency in data["project"]["dependencies"]:
3934
if dependency.startswith("ruff=="):
4035
return dependency.split("==")[1]
41-
raise VersionNotFoundError("pyproject.toml")
36+
raise RuntimeError("Could not find version in pyproject.toml") # noqa: TRY003
4237

4338

4439
def update_ruff_version(old_version, new_version):

uv.lock

+23-23
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)