Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DM-39876: Force v1 pydantic API if running v2 #350

Merged
merged 3 commits into from
Jul 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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

Check warning on line 33 in python/lsst/pipe/base/_task_metadata.py

View check run for this annotation

Codecov / codecov/patch

python/lsst/pipe/base/_task_metadata.py#L32-L33

Added lines #L32 - L33 were not covered by tests


_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

Check warning on line 43 in python/lsst/pipe/base/graph/quantumNode.py

View check run for this annotation

Codecov / codecov/patch

python/lsst/pipe/base/graph/quantumNode.py#L42-L43

Added lines #L42 - L43 were not covered by tests

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

Check warning on line 40 in python/lsst/pipe/base/tests/mocks/_storage_class.py

View check run for this annotation

Codecov / codecov/patch

python/lsst/pipe/base/tests/mocks/_storage_class.py#L39-L40

Added lines #L39 - L40 were not covered by tests
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