Skip to content

Commit

Permalink
Merge pull request #350 from lsst/tickets/DM-39876
Browse files Browse the repository at this point in the history
DM-39876: Force v1 pydantic API if running v2
  • Loading branch information
timj committed Jul 5, 2023
2 parents 07d78ed + 4953f65 commit e6f13a4
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 5 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ dependencies = [
"lsst-daf-butler",
"lsst-pex-config",
"astropy",
"pydantic",
"pydantic <3.0",
"networkx",
"pyyaml >= 5.1",
"numpy >= 1.17",
Expand Down
6 changes: 5 additions & 1 deletion python/lsst/pipe/base/_task_metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,11 @@
from collections.abc import Collection, Iterator, Mapping, Sequence
from typing import Any, Protocol

from pydantic import BaseModel, Field, StrictBool, StrictFloat, StrictInt, StrictStr
try:
from pydantic.v1 import BaseModel, Field, StrictBool, StrictFloat, StrictInt, StrictStr
except ModuleNotFoundError:
from pydantic import BaseModel, Field, StrictBool, StrictFloat, StrictInt, StrictStr # type: ignore


_DEPRECATION_REASON = "Will be removed after v25."
_DEPRECATION_VERSION = "v24"
Expand Down
6 changes: 5 additions & 1 deletion python/lsst/pipe/base/graph/quantumNode.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,11 @@
SerializedQuantum,
)
from lsst.utils.introspection import find_outside_stacklevel
from pydantic import BaseModel

try:
from pydantic.v1 import BaseModel
except ModuleNotFoundError:
from pydantic import BaseModel # type: ignore

from ..pipeline import TaskDef

Expand Down
5 changes: 4 additions & 1 deletion python/lsst/pipe/base/tests/mocks/_storage_class.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,10 @@
from collections.abc import Callable, Iterable, Mapping
from typing import Any, cast

import pydantic
try:
import pydantic.v1 as pydantic
except ModuleNotFoundError:
import pydantic # type: ignore
from lsst.daf.butler import (
DatasetComponent,
Formatter,
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
pyyaml >= 5.1
pydantic < 2
pydantic < 3.0
numpy >= 1.17
networkx
frozendict
Expand Down

0 comments on commit e6f13a4

Please sign in to comment.