From b8d500ab7e664a72736f4238e9022a000060a169 Mon Sep 17 00:00:00 2001 From: Charles Tapley Hoyt Date: Tue, 9 Jul 2024 09:11:56 +0200 Subject: [PATCH] Add note about pydantic v1 deprecation See discussion on https://github.com/biopragmatics/curies/issues/111#issuecomment-2216466120 --- README.md | 5 +++++ src/curies/_pydantic_compat.py | 11 +++++++++++ 2 files changed, 16 insertions(+) diff --git a/README.md b/README.md index a49f5df..e7e2490 100644 --- a/README.md +++ b/README.md @@ -107,6 +107,11 @@ This package currently supports both Pydantic v1 and v2. See the [Pydantic migration guide](https://docs.pydantic.dev/2.0/migration/) for updating your code. +> [!WARNING] +> Pydantic v1 support will be dropped on October 31st, 2024, +> coincident with the [obsolescence of Python 3.8](https://endoflife.date/python). +> This will be accompanied by the v0.8.0 release of the `curies` package. + ## 👐 Contributing Contributions, whether filing an issue, making a pull request, or forking, are appreciated. See diff --git a/src/curies/_pydantic_compat.py b/src/curies/_pydantic_compat.py index 71471ea..937772a 100644 --- a/src/curies/_pydantic_compat.py +++ b/src/curies/_pydantic_compat.py @@ -1,5 +1,7 @@ """A compatibility layer for pydantic 1 and 2.""" +import warnings + from pydantic import __version__ as pydantic_version __all__ = [ @@ -12,6 +14,15 @@ if PYDANTIC_V1: from pydantic import validator as field_validator + + warnings.warn( + "The `curies` package will drop Pydantic V1 support on " + "October 31st, 2024, coincident with the obsolescence of Python 3.8 " + "(see https://endoflife.date/python). This will " + "happen with the v0.8.0 release of the `curies` package.", + DeprecationWarning, + stacklevel=1, + ) else: from pydantic import field_validator