Skip to content

Commit 031d2a4

Browse files
committed
Merge polymorphic models support from upstream PR fastapi#1226
2 parents c1dff79 + 6c0410e commit 031d2a4

31 files changed

+115
-92
lines changed

.github/workflows/publish.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,4 @@ jobs:
3434
TIANGOLO_BUILD_PACKAGE: ${{ matrix.package }}
3535
run: python -m build
3636
- name: Publish
37-
uses: pypa/[email protected].3
37+
uses: pypa/[email protected].4

.github/workflows/test.yml

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -32,16 +32,10 @@ jobs:
3232
- "3.10"
3333
- "3.11"
3434
- "3.12"
35+
- "3.13"
3536
pydantic-version:
3637
- pydantic-v1
3738
- pydantic-v2
38-
include:
39-
- os: ubuntu-22.04
40-
python-version: "3.7"
41-
pydantic-version: pydantic-v1
42-
- os: ubuntu-22.04
43-
python-version: "3.7"
44-
pydantic-version: pydantic-v2
4539
fail-fast: false
4640
runs-on: ${{ matrix.os }}
4741
steps:
@@ -71,10 +65,9 @@ jobs:
7165
run: uv pip install --upgrade "pydantic>=1.10.0,<2.0.0"
7266
- name: Install Pydantic v2
7367
if: matrix.pydantic-version == 'pydantic-v2'
74-
run: uv pip install --upgrade "pydantic>=2.0.2,<3.0.0" "typing-extensions==4.6.1"
68+
run: uv pip install --upgrade "pydantic>=2.0.2,<3.0.0"
7569
- name: Lint
76-
# Do not run on Python 3.7 as mypy behaves differently
77-
if: matrix.python-version != '3.7' && matrix.pydantic-version == 'pydantic-v2'
70+
if: matrix.pydantic-version == 'pydantic-v2'
7871
run: bash scripts/lint.sh
7972
- run: mkdir coverage
8073
- name: Test
@@ -97,7 +90,7 @@ jobs:
9790
- uses: actions/checkout@v4
9891
- uses: actions/setup-python@v5
9992
with:
100-
python-version: '3.12'
93+
python-version: '3.13'
10194
- name: Setup uv
10295
uses: astral-sh/setup-uv@v5
10396
with:

.pre-commit-config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ default_language_version:
44
python: python3.10
55
repos:
66
- repo: https://github.com/pre-commit/pre-commit-hooks
7-
rev: v4.6.0
7+
rev: v5.0.0
88
hooks:
99
- id: check-added-large-files
1010
- id: check-toml
@@ -14,7 +14,7 @@ repos:
1414
- id: end-of-file-fixer
1515
- id: trailing-whitespace
1616
- repo: https://github.com/astral-sh/ruff-pre-commit
17-
rev: v0.6.5
17+
rev: v0.11.2
1818
hooks:
1919
- id: ruff
2020
args:

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@
66
<em>SQLModel, SQL databases in Python, designed for simplicity, compatibility, and robustness.</em>
77
</p>
88
<p align="center">
9-
<a href="https://github.com/fastapi/sqlmodel/actions?query=workflow%3ATest" target="_blank">
10-
<img src="https://github.com/fastapi/sqlmodel/workflows/Test/badge.svg" alt="Test">
9+
<a href="https://github.com/fastapi/sqlmodel/actions?query=workflow%3ATest+event%3Apush+branch%3Amain" target="_blank">
10+
<img src="https://github.com/fastapi/sqlmodel/actions/workflows/test.yml/badge.svg?event=push&branch=main" alt="Test">
1111
</a>
1212
<a href="https://github.com/fastapi/sqlmodel/actions?query=workflow%3APublish" target="_blank">
13-
<img src="https://github.com/fastapi/sqlmodel/workflows/Publish/badge.svg" alt="Publish">
13+
<img src="https://github.com/fastapi/sqlmodel/actions/workflows/publish.yml/badge.svg" alt="Publish">
1414
</a>
1515
<a href="https://coverage-badge.samuelcolvin.workers.dev/redirect/fastapi/sqlmodel" target="_blank">
1616
<img src="https://coverage-badge.samuelcolvin.workers.dev/fastapi/sqlmodel.svg" alt="Coverage">

docs/index.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@
1212
<em>SQLModel, SQL databases in Python, designed for simplicity, compatibility, and robustness.</em>
1313
</p>
1414
<p align="center">
15-
<a href="https://github.com/fastapi/sqlmodel/actions?query=workflow%3ATest" target="_blank">
16-
<img src="https://github.com/fastapi/sqlmodel/workflows/Test/badge.svg" alt="Test">
15+
<a href="https://github.com/fastapi/sqlmodel/actions?query=workflow%3ATest+event%3Apush+branch%3Amain" target="_blank">
16+
<img src="https://github.com/fastapi/sqlmodel/actions/workflows/test.yml/badge.svg?event=push&branch=main" alt="Test">
1717
</a>
1818
<a href="https://github.com/fastapi/sqlmodel/actions?query=workflow%3APublish" target="_blank">
19-
<img src="https://github.com/fastapi/sqlmodel/workflows/Publish/badge.svg" alt="Publish">
19+
<img src="https://github.com/fastapi/sqlmodel/actions/workflows/publish.yml/badge.svg" alt="Publish">
2020
</a>
2121
<a href="https://coverage-badge.samuelcolvin.workers.dev/redirect/fastapi/sqlmodel" target="_blank">
2222
<img src="https://coverage-badge.samuelcolvin.workers.dev/fastapi/sqlmodel.svg" alt="Coverage">

docs/release-notes.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,46 @@
22

33
## Latest Changes
44

5+
### Upgrades
6+
7+
* ⬆️ Drop support for Python 3.7, require Python 3.8 or above. PR [#1316](https://github.com/fastapi/sqlmodel/pull/1316) by [@svlandeg](https://github.com/svlandeg).
8+
9+
### Docs
10+
11+
* ✏️ Update `docs/virtual-environments.md`. PR [#1321](https://github.com/fastapi/sqlmodel/pull/1321) by [@sylvainHellin](https://github.com/sylvainHellin).
12+
13+
### Internal
14+
15+
*[pre-commit.ci] pre-commit autoupdate. PR [#1327](https://github.com/fastapi/sqlmodel/pull/1327) by [@pre-commit-ci[bot]](https://github.com/apps/pre-commit-ci).
16+
* ⬆ 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).
17+
*[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).
18+
19+
## 0.0.24
20+
21+
### Upgrades
22+
23+
* ⬆️ Add support for Python 3.13. PR [#1289](https://github.com/fastapi/sqlmodel/pull/1289) by [@svlandeg](https://github.com/svlandeg).
24+
25+
### Internal
26+
27+
*[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).
28+
* ⬆ 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).
29+
30+
## 0.0.23
31+
32+
### Fixes
33+
34+
* 🐛 Fix type annotation in `Field` constructor. PR [#1304](https://github.com/fastapi/sqlmodel/pull/1304) by [@AlanBogarin](https://github.com/AlanBogarin).
35+
* 🐛 Fix Pydantic version check for version 2.10.x onwards. PR [#1255](https://github.com/fastapi/sqlmodel/pull/1255) by [@asiunov](https://github.com/asiunov).
36+
537
### Refactors
638

739
* 🚨 Fix types for new Pydantic. PR [#1131](https://github.com/fastapi/sqlmodel/pull/1131) by [@tiangolo](https://github.com/tiangolo).
840

941
### Docs
1042

43+
* 🩺 Take the GH badge only from pushes to the `main` branch. PR [#1291](https://github.com/fastapi/sqlmodel/pull/1291) by [@svlandeg](https://github.com/svlandeg).
44+
* 📝 Update documentation to refer to `list` instead of `List`. PR [#1147](https://github.com/fastapi/sqlmodel/pull/1147) by [@bubbletroubles](https://github.com/bubbletroubles).
1145
* ✏️ Fix typo in `databases.md`. PR [#1113](https://github.com/fastapi/sqlmodel/pull/1113) by [@radi-dev](https://github.com/radi-dev).
1246
* ✏️ Fix typo in `docs/tutorial/create-db-and-table.md`. PR [#1252](https://github.com/fastapi/sqlmodel/pull/1252) by [@ArianHamdi](https://github.com/ArianHamdi).
1347
* ✏️ Fix typo in `insert.md`. PR [#1256](https://github.com/fastapi/sqlmodel/pull/1256) by [@Noushadaliam](https://github.com/Noushadaliam).
@@ -22,6 +56,7 @@
2256

2357
### Internal
2458

59+
* ⬆ Bump pypa/gh-action-pypi-publish from 1.12.3 to 1.12.4. PR [#1277](https://github.com/fastapi/sqlmodel/pull/1277) by [@dependabot[bot]](https://github.com/apps/dependabot).
2560
* 💚 Fix CI test suite for Python 3.7. PR [#1309](https://github.com/fastapi/sqlmodel/pull/1309) by [@svlandeg](https://github.com/svlandeg).
2661
* 👷 Revert "Add Codecov to CI, Smokeshow/Cloudflare has been flaky lately (#1303)". PR [#1306](https://github.com/fastapi/sqlmodel/pull/1306) by [@svlandeg](https://github.com/svlandeg).
2762
* 👷 Add Codecov to CI, Smokeshow/Cloudflare has been flaky lately. PR [#1303](https://github.com/fastapi/sqlmodel/pull/1303) by [@tiangolo](https://github.com/tiangolo).

docs/tutorial/automatic-id-none-refresh.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,7 @@ And as we created the **engine** with `echo=True`, we can see the SQL statements
342342

343343
////
344344

345-
//// tab | Python 3.7+
345+
//// tab | Python 3.8+
346346

347347
```Python
348348
{!./docs_src/tutorial/automatic_id_none_refresh/tutorial002.py!}

docs/tutorial/code-structure.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ And this ends up *requiring* the same **circular imports** that are not supporte
183183

184184
But these **type annotations** we want to declare are not needed at *runtime*.
185185

186-
In fact, remember that we used `List["Hero"]`, with a `"Hero"` in a string?
186+
In fact, remember that we used `list["Hero"]`, with a `"Hero"` in a string?
187187

188188
For Python, at runtime, that is **just a string**.
189189

docs/tutorial/create-db-and-table.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -562,7 +562,7 @@ Now, let's give the code a final look:
562562

563563
////
564564

565-
//// tab | Python 3.7+
565+
//// tab | Python 3.8+
566566

567567
```{.python .annotate}
568568
{!./docs_src/tutorial/create_db_and_table/tutorial003.py!}

docs/tutorial/delete.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ Now let's review all that code:
227227

228228
////
229229

230-
//// tab | Python 3.7+
230+
//// tab | Python 3.8+
231231

232232
```{ .python .annotate hl_lines="72-90" }
233233
{!./docs_src/tutorial/delete/tutorial002.py!}

0 commit comments

Comments
 (0)