diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 5e7eb02..4eef39b 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -30,4 +30,4 @@ repos: # No reason to run if only tests have changed. They intentionally break typing. exclude: tests/.* additional_dependencies: - - pydantic~=1.0 + - pydantic>1.10.18,<3 diff --git a/geojson_pydantic/features.py b/geojson_pydantic/features.py index 6797d93..e53d311 100644 --- a/geojson_pydantic/features.py +++ b/geojson_pydantic/features.py @@ -2,8 +2,8 @@ from typing import Any, Dict, Generic, Iterator, List, Literal, Optional, TypeVar, Union -from pydantic import BaseModel, Field, StrictInt, StrictStr, validator -from pydantic.generics import GenericModel +from pydantic.v1 import BaseModel, Field, StrictInt, StrictStr, validator +from pydantic.v1.generics import GenericModel from geojson_pydantic.geo_interface import GeoInterfaceMixin from geojson_pydantic.geometries import Geometry, GeometryCollection diff --git a/geojson_pydantic/geometries.py b/geojson_pydantic/geometries.py index c5e3408..aa4f46c 100644 --- a/geojson_pydantic/geometries.py +++ b/geojson_pydantic/geometries.py @@ -5,8 +5,8 @@ import warnings from typing import Any, Iterator, List, Literal, Optional, Union -from pydantic import BaseModel, Field, ValidationError, validator -from pydantic.error_wrappers import ErrorWrapper +from pydantic.v1 import BaseModel, Field, ValidationError, validator +from pydantic.v1.error_wrappers import ErrorWrapper from typing_extensions import Annotated from geojson_pydantic.geo_interface import GeoInterfaceMixin diff --git a/geojson_pydantic/types.py b/geojson_pydantic/types.py index 142df3b..abe6116 100644 --- a/geojson_pydantic/types.py +++ b/geojson_pydantic/types.py @@ -2,7 +2,7 @@ from typing import TYPE_CHECKING, List, Optional, Tuple, TypeVar, Union -from pydantic import conlist +from pydantic.v1 import conlist T = TypeVar("T") diff --git a/pyproject.toml b/pyproject.toml index ed97cc0..a69a590 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -20,7 +20,7 @@ classifiers = [ "Typing :: Typed", ] dynamic = ["version"] -dependencies = ["pydantic~=1.0"] +dependencies = ["pydantic>1.10.18,<3"] [project.optional-dependencies] test = ["pytest", "pytest-cov", "shapely"] diff --git a/tests/test_features.py b/tests/test_features.py index f607a5c..93f8031 100644 --- a/tests/test_features.py +++ b/tests/test_features.py @@ -3,7 +3,7 @@ from uuid import uuid4 import pytest -from pydantic import BaseModel, ValidationError +from pydantic.v1 import BaseModel, ValidationError from geojson_pydantic.features import Feature, FeatureCollection from geojson_pydantic.geometries import ( diff --git a/tests/test_geometries.py b/tests/test_geometries.py index 626c378..54a797f 100644 --- a/tests/test_geometries.py +++ b/tests/test_geometries.py @@ -2,7 +2,7 @@ from typing import Union import pytest -from pydantic import ValidationError +from pydantic.v1 import ValidationError from shapely.geometry import shape from geojson_pydantic.geometries import (