Skip to content

Commit ae672ce

Browse files
authored
🔨 Add pre-commit hook to ensure latest release header has date (#1786)
1 parent f9e8e4c commit ae672ce

File tree

3 files changed

+84
-37
lines changed

3 files changed

+84
-37
lines changed

.pre-commit-config.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,13 @@ repos:
4141
entry: uv run ./scripts/generate_select.py
4242
files: ^scripts/generate_select\.py|sqlmodel/sql/_expression_select_gen\.py\.jinja2$
4343

44+
- id: add-release-date
45+
language: unsupported
46+
name: add date to latest release header
47+
entry: uv run python scripts/add_latest_release_date.py
48+
files: ^docs/release-notes\.md$
49+
pass_filenames: false
50+
4451
- id: generate-readme
4552
language: unsupported
4653
name: generate README.md from index.md

docs/release-notes.md

Lines changed: 37 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -60,19 +60,19 @@
6060
* ⬆ Bump fastapi from 0.128.8 to 0.129.0. PR [#1769](https://github.com/fastapi/sqlmodel/pull/1769) by [@dependabot[bot]](https://github.com/apps/dependabot).
6161
* ⬆ Bump black from 25.12.0 to 26.1.0. PR [#1768](https://github.com/fastapi/sqlmodel/pull/1768) by [@dependabot[bot]](https://github.com/apps/dependabot).
6262

63-
## 0.0.37
63+
## 0.0.37 (2026-02-21)
6464

6565
### Internal
6666

6767
* 👷 Fix build CI to not attempt to build `sqlmodel-slim`. PR [#1773](https://github.com/fastapi/sqlmodel/pull/1773) by [@tiangolo](https://github.com/tiangolo).
6868

69-
## 0.0.36
69+
## 0.0.36 (2026-02-21)
7070

7171
### Internal
7272

7373
* ➖ Drop support for `sqlmodel-slim`, no more versions will be released, use only `sqmodel`. PR [#1772](https://github.com/fastapi/sqlmodel/pull/1772) by [@tiangolo](https://github.com/tiangolo).
7474

75-
## 0.0.35
75+
## 0.0.35 (2026-02-20)
7676

7777
### Breaking Changes
7878

@@ -84,7 +84,7 @@
8484
* ⬆ Bump prek from 0.3.2 to 0.3.3. PR [#1761](https://github.com/fastapi/sqlmodel/pull/1761) by [@dependabot[bot]](https://github.com/apps/dependabot).
8585
* ⬆ Bump typer from 0.23.1 to 0.23.2. PR [#1760](https://github.com/fastapi/sqlmodel/pull/1760) by [@dependabot[bot]](https://github.com/apps/dependabot).
8686

87-
## 0.0.34
87+
## 0.0.34 (2026-02-16)
8888

8989
### Internal
9090

@@ -94,7 +94,7 @@
9494
* ⬆ Bump typer from 0.21.2 to 0.23.0. PR [#1756](https://github.com/fastapi/sqlmodel/pull/1756) by [@dependabot[bot]](https://github.com/apps/dependabot).
9595
* ⬆ Bump fastapi from 0.128.7 to 0.128.8. PR [#1755](https://github.com/fastapi/sqlmodel/pull/1755) by [@dependabot[bot]](https://github.com/apps/dependabot).
9696

97-
## 0.0.33
97+
## 0.0.33 (2026-02-11)
9898

9999
### Docs
100100

@@ -118,7 +118,7 @@
118118
* 👷 Run mypy by pre-commit. PR [#1738](https://github.com/fastapi/sqlmodel/pull/1738) by [@YuriiMotov](https://github.com/YuriiMotov).
119119
* ⬆ Bump prek from 0.3.0 to 0.3.1. PR [#1739](https://github.com/fastapi/sqlmodel/pull/1739) by [@dependabot[bot]](https://github.com/apps/dependabot).
120120

121-
## 0.0.32
121+
## 0.0.32 (2026-02-01)
122122

123123
### Fixes
124124

@@ -149,7 +149,7 @@
149149
* ⬆ Update fastapi requirement from >=0.103.2,<0.126.0 to >=0.103.2,<0.129.0. PR [#1703](https://github.com/fastapi/sqlmodel/pull/1703) by [@dependabot[bot]](https://github.com/apps/dependabot).
150150
* ✅ Update tests, remove conditionals for Pydantic v1. PR [#1702](https://github.com/fastapi/sqlmodel/pull/1702) by [@tiangolo](https://github.com/tiangolo).
151151

152-
## 0.0.31
152+
## 0.0.31 (2025-12-28)
153153

154154
### Breaking Changes
155155

@@ -162,7 +162,7 @@
162162
* ⬆ Bump typer from 0.20.1 to 0.21.0. PR [#1694](https://github.com/fastapi/sqlmodel/pull/1694) by [@dependabot[bot]](https://github.com/apps/dependabot).
163163
* 📌 Relax `prek` version pin to `>=0.2.24,<1.0.0`. PR [#1698](https://github.com/fastapi/sqlmodel/pull/1698) by [@YuriiMotov](https://github.com/YuriiMotov).
164164

165-
## 0.0.30
165+
## 0.0.30 (2025-12-26)
166166

167167
### Breaking Changes
168168

@@ -187,13 +187,13 @@
187187
* ⬆ Bump typer from 0.20.0 to 0.20.1. PR [#1685](https://github.com/fastapi/sqlmodel/pull/1685) by [@dependabot[bot]](https://github.com/apps/dependabot).
188188
* ⬆ Bump ruff from 0.14.8 to 0.14.10. PR [#1681](https://github.com/fastapi/sqlmodel/pull/1681) by [@dependabot[bot]](https://github.com/apps/dependabot).
189189

190-
## 0.0.29
190+
## 0.0.29 (2025-12-23)
191191

192192
### Fixes
193193

194194
* 🐛 Fix `alias` support for Pydantic v2. PR [#1577](https://github.com/fastapi/sqlmodel/pull/1577) by [@ravishan16](https://github.com/ravishan16).
195195

196-
## 0.0.28
196+
## 0.0.28 (2025-12-23)
197197

198198
### Fixes
199199

@@ -244,13 +244,13 @@
244244
* ⬆ Bump typer from 0.19.2 to 0.20.0. PR [#1612](https://github.com/fastapi/sqlmodel/pull/1612) by [@dependabot[bot]](https://github.com/apps/dependabot).
245245
* ✅ Remove unused type ignores since SQLAlchemy 2.0.44. PR [#1613](https://github.com/fastapi/sqlmodel/pull/1613) by [@svlandeg](https://github.com/svlandeg).
246246

247-
## 0.0.27
247+
## 0.0.27 (2025-10-08)
248248

249249
### Upgrades
250250

251251
* ⬆️ Add support for Python 3.14. PR [#1578](https://github.com/fastapi/sqlmodel/pull/1578) by [@svlandeg](https://github.com/svlandeg).
252252

253-
## 0.0.26
253+
## 0.0.26 (2025-10-08)
254254

255255
### Fixes
256256

@@ -276,7 +276,7 @@
276276
* ⬆ Bump ruff from 0.13.0 to 0.13.2. PR [#1576](https://github.com/fastapi/sqlmodel/pull/1576) by [@dependabot[bot]](https://github.com/apps/dependabot).
277277
* 💚 Fix CI test suite for Windows and MacOS. PR [#1307](https://github.com/fastapi/sqlmodel/pull/1307) by [@svlandeg](https://github.com/svlandeg).
278278

279-
## 0.0.25
279+
## 0.0.25 (2025-09-17)
280280

281281
### Features
282282

@@ -364,7 +364,7 @@
364364
* ⬆ Bump jinja2 from 3.1.4 to 3.1.6. PR [#1317](https://github.com/fastapi/sqlmodel/pull/1317) by [@dependabot[bot]](https://github.com/apps/dependabot).
365365
*[pre-commit.ci] pre-commit autoupdate. PR [#1319](https://github.com/fastapi/sqlmodel/pull/1319) by [@pre-commit-ci[bot]](https://github.com/apps/pre-commit-ci).
366366

367-
## 0.0.24
367+
## 0.0.24 (2025-03-07)
368368

369369
### Upgrades
370370

@@ -375,7 +375,7 @@
375375
*[pre-commit.ci] pre-commit autoupdate. PR [#1114](https://github.com/fastapi/sqlmodel/pull/1114) by [@pre-commit-ci[bot]](https://github.com/apps/pre-commit-ci).
376376
* ⬆ Bump ruff from 0.6.2 to 0.9.6. PR [#1294](https://github.com/fastapi/sqlmodel/pull/1294) by [@dependabot[bot]](https://github.com/apps/dependabot).
377377

378-
## 0.0.23
378+
## 0.0.23 (2025-02-28)
379379

380380
### Fixes
381381

@@ -433,7 +433,7 @@
433433
* 💚 Set `include-hidden-files` to `True` when using the `upload-artifact` GH action. PR [#1098](https://github.com/fastapi/sqlmodel/pull/1098) by [@svlandeg](https://github.com/svlandeg).
434434
*[pre-commit.ci] pre-commit autoupdate. PR [#1088](https://github.com/fastapi/sqlmodel/pull/1088) by [@pre-commit-ci[bot]](https://github.com/apps/pre-commit-ci).
435435

436-
## 0.0.22
436+
## 0.0.22 (2024-08-31)
437437

438438
### Fixes
439439

@@ -479,7 +479,7 @@
479479
* 👷 Update issue-manager.yml GitHub Action permissions. PR [#1040](https://github.com/tiangolo/sqlmodel/pull/1040) by [@tiangolo](https://github.com/tiangolo).
480480
* ♻️ Refactor Deploy Docs GitHub Action to be a script and update token preparing for org. PR [#1039](https://github.com/tiangolo/sqlmodel/pull/1039) by [@tiangolo](https://github.com/tiangolo).
481481

482-
## 0.0.21
482+
## 0.0.21 (2024-07-21)
483483

484484
### Features
485485

@@ -499,7 +499,7 @@
499499
* ⬆ Bump mkdocstrings[python] from 0.23.0 to 0.25.1. PR [#927](https://github.com/tiangolo/sqlmodel/pull/927) by [@dependabot[bot]](https://github.com/apps/dependabot).
500500
* ⬆ Bump dorny/paths-filter from 2 to 3. PR [#972](https://github.com/tiangolo/sqlmodel/pull/972) by [@dependabot[bot]](https://github.com/apps/dependabot).
501501

502-
## 0.0.20
502+
## 0.0.20 (2024-07-17)
503503

504504
### Features
505505

@@ -520,7 +520,7 @@
520520
*[pre-commit.ci] pre-commit autoupdate. PR [#979](https://github.com/tiangolo/sqlmodel/pull/979) by [@pre-commit-ci[bot]](https://github.com/apps/pre-commit-ci).
521521
* 🔨 Update docs Termynal scripts to not include line nums for local dev. PR [#1018](https://github.com/tiangolo/sqlmodel/pull/1018) by [@tiangolo](https://github.com/tiangolo).
522522

523-
## 0.0.19
523+
## 0.0.19 (2024-06-04)
524524

525525
### Fixes
526526

@@ -547,7 +547,7 @@
547547
* 👷 Update GitHub Actions to download and upload artifacts. PR [#936](https://github.com/tiangolo/sqlmodel/pull/936) by [@tiangolo](https://github.com/tiangolo).
548548
* 👷 Tweak CI for test-redistribute, add needed env vars for slim. PR [#929](https://github.com/tiangolo/sqlmodel/pull/929) by [@tiangolo](https://github.com/tiangolo).
549549

550-
## 0.0.18
550+
## 0.0.18 (2024-04-30)
551551

552552
### Internal
553553

@@ -557,7 +557,7 @@ In the future SQLModel will include the standard default recommended packages, a
557557

558558
* 🔧 Re-enable MkDocs Material Social plugin. PR [#915](https://github.com/tiangolo/sqlmodel/pull/915) by [@tiangolo](https://github.com/tiangolo).
559559

560-
## 0.0.17
560+
## 0.0.17 (2024-04-29)
561561

562562
### Refactors
563563

@@ -578,15 +578,15 @@ In the future SQLModel will include the standard default recommended packages, a
578578
* ⬆️ Upgrade Ruff version and configs. PR [#859](https://github.com/tiangolo/sqlmodel/pull/859) by [@tiangolo](https://github.com/tiangolo).
579579
* 🔥 Remove Jina QA Bot as it has been discontinued. PR [#840](https://github.com/tiangolo/sqlmodel/pull/840) by [@tiangolo](https://github.com/tiangolo).
580580

581-
## 0.0.16
581+
## 0.0.16 (2024-02-17)
582582

583583
### Features
584584

585585
* ✨ Add new method `.sqlmodel_update()` to update models in place, including an `update` parameter for extra data. And fix implementation for the (now documented) `update` parameter for `.model_validate()`. PR [#804](https://github.com/tiangolo/sqlmodel/pull/804) by [@tiangolo](https://github.com/tiangolo).
586586
* Updated docs: [Update Data with FastAPI](https://sqlmodel.tiangolo.com/tutorial/fastapi/update/).
587587
* New docs: [Update with Extra Data (Hashed Passwords) with FastAPI](https://sqlmodel.tiangolo.com/tutorial/fastapi/update-extra-data/).
588588

589-
## 0.0.15
589+
## 0.0.15 (2024-02-17)
590590

591591
### Fixes
592592

@@ -597,13 +597,13 @@ In the future SQLModel will include the standard default recommended packages, a
597597
* ⬆ Bump tiangolo/issue-manager from 0.4.0 to 0.4.1. PR [#775](https://github.com/tiangolo/sqlmodel/pull/775) by [@dependabot[bot]](https://github.com/apps/dependabot).
598598
* 👷 Fix GitHub Actions build docs filter paths for GitHub workflows. PR [#738](https://github.com/tiangolo/sqlmodel/pull/738) by [@tiangolo](https://github.com/tiangolo).
599599

600-
## 0.0.14
600+
## 0.0.14 (2023-12-04)
601601

602602
### Features
603603

604604
* ✨ Add support for Pydantic v2 (while keeping support for v1 if v2 is not available). PR [#722](https://github.com/tiangolo/sqlmodel/pull/722) by [@tiangolo](https://github.com/tiangolo) including initial work in PR [#699](https://github.com/tiangolo/sqlmodel/pull/699) by [@AntonDeMeester](https://github.com/AntonDeMeester).
605605

606-
## 0.0.13
606+
## 0.0.13 (2023-12-04)
607607

608608
### Fixes
609609

@@ -633,7 +633,7 @@ In the future SQLModel will include the standard default recommended packages, a
633633
* 🔧 Show line numbers in docs during local development. PR [#714](https://github.com/tiangolo/sqlmodel/pull/714) by [@tiangolo](https://github.com/tiangolo).
634634
* 📝 Update details syntax with new pymdown extensions format. PR [#713](https://github.com/tiangolo/sqlmodel/pull/713) by [@tiangolo](https://github.com/tiangolo).
635635

636-
## 0.0.12
636+
## 0.0.12 (2023-11-18)
637637

638638
### Features
639639

@@ -644,7 +644,7 @@ In the future SQLModel will include the standard default recommended packages, a
644644
*[pre-commit.ci] pre-commit autoupdate. PR [#686](https://github.com/tiangolo/sqlmodel/pull/686) by [@pre-commit-ci[bot]](https://github.com/apps/pre-commit-ci).
645645
* 👷 Upgrade latest-changes GitHub Action. PR [#693](https://github.com/tiangolo/sqlmodel/pull/693) by [@tiangolo](https://github.com/tiangolo).
646646

647-
## 0.0.11
647+
## 0.0.11 (2023-10-29)
648648

649649
### Features
650650

@@ -664,7 +664,7 @@ In the future SQLModel will include the standard default recommended packages, a
664664
* ⬆ Update black requirement from ^22.10.0 to >=22.10,<24.0. PR [#664](https://github.com/tiangolo/sqlmodel/pull/664) by [@dependabot[bot]](https://github.com/apps/dependabot).
665665
* 👷 Update CI to build MkDocs Insiders only when the secrets are available, for Dependabot. PR [#683](https://github.com/tiangolo/sqlmodel/pull/683) by [@tiangolo](https://github.com/tiangolo).
666666

667-
## 0.0.10
667+
## 0.0.10 (2023-10-26)
668668

669669
### Features
670670

@@ -674,7 +674,7 @@ In the future SQLModel will include the standard default recommended packages, a
674674

675675
* 🔧 Adopt Ruff for formatting. PR [#679](https://github.com/tiangolo/sqlmodel/pull/679) by [@tiangolo](https://github.com/tiangolo).
676676

677-
## 0.0.9
677+
## 0.0.9 (2023-10-23)
678678

679679
### Breaking Changes
680680

@@ -752,7 +752,7 @@ In the future SQLModel will include the standard default recommended packages, a
752752
* ⬆ Bump dawidd6/action-download-artifact from 2.9.0 to 2.24.0. PR [#470](https://github.com/tiangolo/sqlmodel/pull/470) by [@dependabot[bot]](https://github.com/apps/dependabot).
753753
* 👷 Update Dependabot config. PR [#484](https://github.com/tiangolo/sqlmodel/pull/484) by [@tiangolo](https://github.com/tiangolo).
754754

755-
## 0.0.8
755+
## 0.0.8 (2022-08-30)
756756

757757
### Fixes
758758

@@ -764,7 +764,7 @@ In the future SQLModel will include the standard default recommended packages, a
764764
* 📝 Adjust and clarify docs for `docs/tutorial/create-db-and-table.md`. PR [#426](https://github.com/tiangolo/sqlmodel/pull/426) by [@tiangolo](https://github.com/tiangolo).
765765
* ✏ Fix typo in `docs/tutorial/connect/remove-data-connections.md`. PR [#421](https://github.com/tiangolo/sqlmodel/pull/421) by [@VerdantFox](https://github.com/VerdantFox).
766766

767-
## 0.0.7
767+
## 0.0.7 (2022-08-28)
768768

769769
### Features
770770

@@ -828,7 +828,7 @@ In the future SQLModel will include the standard default recommended packages, a
828828
* 🔧 Upgrade MkDocs Material and update configs. PR [#217](https://github.com/tiangolo/sqlmodel/pull/217) by [@tiangolo](https://github.com/tiangolo).
829829
* ⬆ Upgrade mypy, fix type annotations. PR [#218](https://github.com/tiangolo/sqlmodel/pull/218) by [@tiangolo](https://github.com/tiangolo).
830830

831-
## 0.0.6
831+
## 0.0.6 (2021-12-28)
832832

833833
### Breaking Changes
834834

@@ -899,7 +899,7 @@ Here's the new, extensive documentation explaining indexes and how to use them:
899899
* ✏ Fix typo in `docs/tutorial/automatic-id-none-refresh.md`. PR [#14](https://github.com/tiangolo/sqlmodel/pull/14) by [@leynier](https://github.com/leynier).
900900
* ✏ Fix typos in `docs/tutorial/index.md` and `docs/databases.md`. PR [#5](https://github.com/tiangolo/sqlmodel/pull/5) by [@sebastianmarines](https://github.com/sebastianmarines).
901901

902-
## 0.0.5
902+
## 0.0.5 (2021-12-13)
903903

904904
### Features
905905

@@ -917,19 +917,19 @@ Here's the new, extensive documentation explaining indexes and how to use them:
917917
* 🔧 Add MkDocs Material social cards. PR [#90](https://github.com/tiangolo/sqlmodel/pull/90) by [@tiangolo](https://github.com/tiangolo).
918918
* ✨ Update type annotations and upgrade mypy. PR [#173](https://github.com/tiangolo/sqlmodel/pull/173) by [@tiangolo](https://github.com/tiangolo).
919919

920-
## 0.0.4
920+
## 0.0.4 (2021-08-25)
921921

922922
* 🎨 Fix type detection of select results in PyCharm. PR [#15](https://github.com/tiangolo/sqlmodel/pull/15) by [@tiangolo](https://github.com/tiangolo).
923923

924-
## 0.0.3
924+
## 0.0.3 (2021-08-24)
925925

926926
* ⬆️ Update and relax specification range for `sqlalchemy-stubs`. PR [#4](https://github.com/tiangolo/sqlmodel/pull/4) by [@tiangolo](https://github.com/tiangolo).
927927

928-
## 0.0.2
928+
## 0.0.2 (2021-08-24)
929929

930930
* This includes several small bug fixes detected during the first CI runs.
931931
* 💚 Fix CI installs and tests. PR [#2](https://github.com/tiangolo/sqlmodel/pull/2) by [@tiangolo](https://github.com/tiangolo).
932932

933-
## 0.0.1
933+
## 0.0.1 (2021-08-24)
934934

935935
* First release. 🎉

scripts/add_latest_release_date.py

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
"""Check release-notes.md and add today's date to the latest release header if missing."""
2+
3+
import re
4+
import sys
5+
from datetime import date
6+
7+
RELEASE_NOTES_FILE = "docs/release-notes.md"
8+
RELEASE_HEADER_PATTERN = re.compile(r"^## (\d+\.\d+\.\d+)\s*(\(.*\))?\s*$")
9+
10+
11+
def main() -> None:
12+
with open(RELEASE_NOTES_FILE) as f:
13+
lines = f.readlines()
14+
15+
for i, line in enumerate(lines):
16+
match = RELEASE_HEADER_PATTERN.match(line)
17+
if not match:
18+
continue
19+
20+
version = match.group(1)
21+
date_part = match.group(2)
22+
23+
if date_part:
24+
print(f"Latest release {version} already has a date: {date_part}")
25+
sys.exit(0)
26+
27+
today = date.today().isoformat()
28+
lines[i] = f"## {version} ({today})\n"
29+
print(f"Added date: {version} ({today})")
30+
31+
with open(RELEASE_NOTES_FILE, "w") as f:
32+
f.writelines(lines)
33+
sys.exit(0)
34+
35+
print("No release header found")
36+
sys.exit(1)
37+
38+
39+
if __name__ == "__main__":
40+
main()

0 commit comments

Comments
 (0)