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

Deprecate support for pydantic v1 #160

Merged
merged 1 commit into from
Oct 9, 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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions docs/release-notes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ Documentation
Deprecations
~~~~~~~~~~~~

* Deprecated support for Pydantic v1. It is scheduled for full removal in release 23.12.0.

Stability, Maintainability, and Testing
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ filterwarnings = [
"ignore:Cannot check if local file:UserWarning",
# Internal deprecations.
"ignore:SSHFileTransfer is deprecated:scitacean.VisibleDeprecationWarning",
"ignore:Support for Pydantic v1 is deprecated:scitacean.VisibleDeprecationWarning",
# From fabric / invoke
"ignore:_SixMetaPathImporter:ImportWarning",
"ignore:the imp module is deprecated in favour of importlib:DeprecationWarning",
Expand Down
17 changes: 16 additions & 1 deletion src/scitacean/_internal/pydantic_compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,22 @@


def is_pydantic_v1() -> bool:
return pydantic.__version__.split(".", 1)[0] == "1"
if pydantic.__version__.split(".", 1)[0] == "1":
import warnings

from ..warning import VisibleDeprecationWarning

warnings.warn(
"Support for Pydantic v1 is deprecated in Scitacean"
"RELEASE_PLACEHOLDER and will be removed in Scitacean v23.12.0."
"If you cannot update your Pydantic version, please comment in this issue:"
" https://github.com/SciCatProject/scitacean/issues/158",
VisibleDeprecationWarning,
stacklevel=2,
)
return True

return False


def field_validator(
Expand Down