Skip to content

Commit 71cb27d

Browse files
authored
Merge branch 'fastapi:main' into main
2 parents 2b6de42 + a85de91 commit 71cb27d

File tree

7 files changed

+40
-13
lines changed

7 files changed

+40
-13
lines changed

.github/workflows/test.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,8 @@ jobs:
2626
strategy:
2727
matrix:
2828
os: [ ubuntu-latest, windows-latest, macos-latest ]
29-
python-version: [ "3.13" ]
29+
python-version: [ "3.14" ]
3030
pydantic-version:
31-
- pydantic-v1
3231
- pydantic-v2
3332
include:
3433
- os: macos-latest
@@ -47,7 +46,10 @@ jobs:
4746
python-version: "3.12"
4847
pydantic-version: pydantic-v1
4948
- os: ubuntu-latest
50-
python-version: "3.12"
49+
python-version: "3.13"
50+
pydantic-version: pydantic-v1
51+
- os: macos-latest
52+
python-version: "3.13"
5153
pydantic-version: pydantic-v2
5254
fail-fast: false
5355
runs-on: ${{ matrix.os }}

docs/release-notes.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,14 @@
22

33
## Latest Changes
44

5+
## 0.0.27
6+
7+
### Upgrades
8+
9+
* ⬆️ Add support for Python 3.14. PR [#1578](https://github.com/fastapi/sqlmodel/pull/1578) by [@svlandeg](https://github.com/svlandeg).
10+
11+
## 0.0.26
12+
513
### Fixes
614

715
* 🐛 Fix attribute handling in `model_dump` for compatibility with the latest Pydantic versions. PR [#1595](https://github.com/fastapi/sqlmodel/pull/1595) by [@spazm](https://github.com/spazm).
@@ -12,6 +20,7 @@
1220

1321
### Internal
1422

23+
* ⬆ Bump mypy from 1.4.1 to 1.18.2. PR [#1560](https://github.com/fastapi/sqlmodel/pull/1560) by [@dependabot[bot]](https://github.com/apps/dependabot).
1524
* ✅ Add test that runs select with 3 or 4 arguments. PR [#1590](https://github.com/fastapi/sqlmodel/pull/1590) by [@svlandeg](https://github.com/svlandeg).
1625
* ⬆ Bump mkdocs-macros-plugin from 1.3.9 to 1.4.0. PR [#1581](https://github.com/fastapi/sqlmodel/pull/1581) by [@dependabot[bot]](https://github.com/apps/dependabot).
1726
* ⬆ Bump mkdocs-material from 9.6.20 to 9.6.21. PR [#1588](https://github.com/fastapi/sqlmodel/pull/1588) by [@dependabot[bot]](https://github.com/apps/dependabot).

pyproject.toml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ classifiers = [
2626
"Programming Language :: Python :: 3.11",
2727
"Programming Language :: Python :: 3.12",
2828
"Programming Language :: Python :: 3.13",
29+
"Programming Language :: Python :: 3.14",
2930
"Topic :: Database",
3031
"Topic :: Database :: Database Engines/Servers",
3132
"Topic :: Internet",
@@ -98,10 +99,7 @@ show_contexts = true
9899

99100
[tool.mypy]
100101
strict = true
101-
102-
[[tool.mypy.overrides]]
103-
module = "sqlmodel.sql._expression_select_gen"
104-
warn_unused_ignores = false
102+
exclude = "sqlmodel.sql._expression_select_gen"
105103

106104
[[tool.mypy.overrides]]
107105
module = "docs_src.*"

requirements-tests.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22
-r requirements-docs-tests.txt
33
pytest >=7.0.1,<9.0.0
44
coverage[toml] >=6.2,<8.0
5-
mypy ==1.4.1
5+
# Remove when support for Python 3.8 is dropped
6+
mypy ==1.14.1; python_version < "3.9"
7+
mypy ==1.18.2; python_version >= "3.9"
68
ruff ==0.13.2
79
# For FastAPI tests
810
fastapi >=0.103.2

sqlmodel/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
__version__ = "0.0.25"
1+
__version__ = "0.0.27"
22

33
# Re-export from SQLAlchemy
44
from sqlalchemy.engine import create_engine as create_engine

sqlmodel/_compat.py

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import sys
12
import types
23
from contextlib import contextmanager
34
from contextvars import ContextVar
@@ -123,7 +124,20 @@ def init_pydantic_private_attrs(new_object: InstanceOrType["SQLModel"]) -> None:
123124
object.__setattr__(new_object, "__pydantic_private__", None)
124125

125126
def get_annotations(class_dict: Dict[str, Any]) -> Dict[str, Any]:
126-
return class_dict.get("__annotations__", {})
127+
raw_annotations: Dict[str, Any] = class_dict.get("__annotations__", {})
128+
if sys.version_info >= (3, 14) and "__annotations__" not in class_dict:
129+
# See https://github.com/pydantic/pydantic/pull/11991
130+
from annotationlib import (
131+
Format,
132+
call_annotate_function,
133+
get_annotate_from_class_namespace,
134+
)
135+
136+
if annotate := get_annotate_from_class_namespace(class_dict):
137+
raw_annotations = call_annotate_function(
138+
annotate, format=Format.FORWARDREF
139+
)
140+
return raw_annotations
127141

128142
def is_table_model_class(cls: Type[Any]) -> bool:
129143
config = getattr(cls, "model_config", {})
@@ -180,7 +194,7 @@ def is_field_noneable(field: "FieldInfo") -> bool:
180194
if not field.is_required():
181195
if field.default is Undefined:
182196
return False
183-
if field.annotation is None or field.annotation is NoneType: # type: ignore[comparison-overlap]
197+
if field.annotation is None or field.annotation is NoneType:
184198
return True
185199
return False
186200
return False
@@ -509,7 +523,7 @@ def _calculate_keys(
509523
keys -= update.keys()
510524

511525
if exclude:
512-
keys -= {k for k, v in exclude.items() if ValueItems.is_true(v)}
526+
keys -= {str(k) for k, v in exclude.items() if ValueItems.is_true(v)}
513527

514528
return keys
515529

sqlmodel/main.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
from __future__ import annotations
2+
13
import ipaddress
24
import uuid
35
import weakref
@@ -614,7 +616,7 @@ def __init__(
614616
setattr(cls, rel_name, rel_info.sa_relationship) # Fix #315
615617
continue
616618
raw_ann = cls.__annotations__[rel_name]
617-
origin = get_origin(raw_ann)
619+
origin: Any = get_origin(raw_ann)
618620
if origin is Mapped:
619621
ann = raw_ann.__args__[0]
620622
else:

0 commit comments

Comments
 (0)