Skip to content

Commit 141e4d5

Browse files
committed
build: bump to pydantic v2
1 parent 3a36107 commit 141e4d5

4 files changed

Lines changed: 15 additions & 12 deletions

File tree

pyproject.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@ classifiers = [
3030
]
3131

3232
[tool.poetry.dependencies]
33-
python = "^3.6.1"
33+
python = "^3.8.1"
3434
SQLAlchemy = ">=1.4.17,<1.5.0"
35-
pydantic = "^1.8.2"
35+
pydantic = ">=2.0,<3.0"
3636
sqlalchemy2-stubs = {version = "*", allow-prereleases = true}
3737

3838
[tool.poetry.dev-dependencies]
@@ -44,7 +44,7 @@ mkdocs = "^1.2.1"
4444
mkdocs-material = "^8.1.4"
4545
mdx-include = "^1.4.1"
4646
coverage = {extras = ["toml"], version = "^5.5"}
47-
fastapi = "^0.68.0"
47+
fastapi = "^0.115.12"
4848
requests = "^2.26.0"
4949
autoflake = "^1.4"
5050
isort = "^5.9.3"

scripts/generate_select.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
import black
66
from jinja2 import Template
7-
from pydantic import BaseModel
7+
from pydantic.v1 import BaseModel
88

99
template_path = Path(__file__).parent.parent / "sqlmodel/sql/expression.py.jinja2"
1010
destiny_path = Path(__file__).parent.parent / "sqlmodel/sql/expression.py"

sqlmodel/main.py

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
Callable,
1212
ClassVar,
1313
Dict,
14+
ForwardRef,
1415
List,
1516
Mapping,
1617
Optional,
@@ -23,13 +24,13 @@
2324
cast,
2425
)
2526

26-
from pydantic import BaseConfig, BaseModel
27-
from pydantic.errors import ConfigError, DictError
28-
from pydantic.fields import FieldInfo as PydanticFieldInfo
29-
from pydantic.fields import ModelField, Undefined, UndefinedType
30-
from pydantic.main import ModelMetaclass, validate_model
31-
from pydantic.typing import ForwardRef, NoArgAnyCallable, resolve_annotations
32-
from pydantic.utils import ROOT_KEY, Representation
27+
from pydantic.v1 import BaseConfig, BaseModel
28+
from pydantic.v1.errors import ConfigError, DictError
29+
from pydantic.v1.fields import FieldInfo as PydanticFieldInfo
30+
from pydantic.v1.fields import ModelField, Undefined, UndefinedType
31+
from pydantic.v1.main import validate_model
32+
from pydantic.v1.typing import NoArgAnyCallable, resolve_annotations
33+
from pydantic.v1.utils import ROOT_KEY, Representation
3334
from sqlalchemy import (
3435
Boolean,
3536
Column,
@@ -53,6 +54,8 @@
5354

5455
_T = TypeVar("_T")
5556

57+
ModelMetaclass = type(BaseModel)
58+
5659

5760
def __dataclass_transform__(
5861
*,

tests/conftest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
from typing import Any, Callable, Dict, List, Union
55

66
import pytest
7-
from pydantic import BaseModel
7+
from pydantic.v1 import BaseModel
88
from sqlmodel import SQLModel
99
from sqlmodel.main import default_registry
1010

0 commit comments

Comments
 (0)