Skip to content

Commit

Permalink
Switch to Pydantic v1 namespace and allow Pydantic v1 or v2
Browse files Browse the repository at this point in the history
  • Loading branch information
josephgruber-umbra committed Oct 9, 2024
1 parent 8a07ab8 commit 1cbd1f0
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 2 additions & 2 deletions geojson_pydantic/features.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions geojson_pydantic/geometries.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion geojson_pydantic/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand Down
2 changes: 1 addition & 1 deletion tests/test_features.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down
2 changes: 1 addition & 1 deletion tests/test_geometries.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down

0 comments on commit 1cbd1f0

Please sign in to comment.