From 88d384996005c57601b73cc35ea5d10666c6819e Mon Sep 17 00:00:00 2001 From: Nicola Soranzo Date: Wed, 19 Jun 2024 19:16:25 +0100 Subject: [PATCH] Pin pydantic to >=2.7.4 Pydantic <2.7.4 is broken on Python>=3.12.4 , see https://github.com/pydantic/pydantic/issues/9609 . Fixed upstream in https://github.com/pydantic/pydantic/pull/9639 . Fix the following traceback in startup test on Python 3.12: ``` Traceback (most recent call last): File "/home/runner/work/galaxy/galaxy/galaxy root/.venv/bin/galaxyctl", line 10, in sys.exit(galaxyctl()) ^^^^^^^^^^^ File "/home/runner/work/galaxy/galaxy/galaxy root/.venv/lib/python3.12/site-packages/click/core.py", line 1157, in __call__ return self.main(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/runner/work/galaxy/galaxy/galaxy root/.venv/lib/python3.12/site-packages/click/core.py", line 1078, in main rv = self.invoke(ctx) ^^^^^^^^^^^^^^^^ File "/home/runner/work/galaxy/galaxy/galaxy root/.venv/lib/python3.12/site-packages/click/core.py", line 1682, in invoke cmd_name, cmd, args = self.resolve_command(ctx, args) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/runner/work/galaxy/galaxy/galaxy root/.venv/lib/python3.12/site-packages/click/core.py", line 1729, in resolve_command cmd = self.get_command(ctx, cmd_name) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/runner/work/galaxy/galaxy/galaxy root/.venv/lib/python3.12/site-packages/gravity/cli.py", line 59, in get_command return name_to_command(name) ^^^^^^^^^^^^^^^^^^^^^ File "/home/runner/work/galaxy/galaxy/galaxy root/.venv/lib/python3.12/site-packages/gravity/cli.py", line 45, in name_to_command mod = __import__(mod_name, None, None, ["cli"]) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/runner/work/galaxy/galaxy/galaxy root/.venv/lib/python3.12/site-packages/gravity/commands/cmd_stop.py", line 4, in from gravity import process_manager File "/home/runner/work/galaxy/galaxy/galaxy root/.venv/lib/python3.12/site-packages/gravity/process_manager/__init__.py", line 14, in from gravity.config_manager import ConfigManager File "/home/runner/work/galaxy/galaxy/galaxy root/.venv/lib/python3.12/site-packages/gravity/config_manager.py", line 18, in from gravity.state import ConfigFile, service_for_service_type File "/home/runner/work/galaxy/galaxy/galaxy root/.venv/lib/python3.12/site-packages/gravity/state.py", line 42, in class ConfigFile(BaseModel): File "/home/runner/work/galaxy/galaxy/galaxy root/.venv/lib/python3.12/site-packages/pydantic/v1/main.py", line 286, in __new__ cls.__try_update_forward_refs__() File "/home/runner/work/galaxy/galaxy/galaxy root/.venv/lib/python3.12/site-packages/pydantic/v1/main.py", line 807, in __try_update_forward_refs__ update_model_forward_refs(cls, cls.__fields__.values(), cls.__config__.json_encoders, localns, (NameError,)) File "/home/runner/work/galaxy/galaxy/galaxy root/.venv/lib/python3.12/site-packages/pydantic/v1/typing.py", line 554, in update_model_forward_refs update_field_forward_refs(f, globalns=globalns, localns=localns) File "/home/runner/work/galaxy/galaxy/galaxy root/.venv/lib/python3.12/site-packages/pydantic/v1/typing.py", line 520, in update_field_forward_refs field.type_ = evaluate_forwardref(field.type_, globalns, localns or None) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/runner/work/galaxy/galaxy/galaxy root/.venv/lib/python3.12/site-packages/pydantic/v1/typing.py", line 66, in evaluate_forwardref return cast(Any, type_)._evaluate(globalns, localns, set()) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ TypeError: ForwardRef._evaluate() missing 1 required keyword-only argument: 'recursive_guard' ``` Example: https://github.com/galaxyproject/galaxy/actions/runs/9581802216/job/26419972297 --- lib/galaxy/dependencies/pinned-requirements.txt | 6 +++--- lib/galaxy/dependencies/pinned-typecheck-requirements.txt | 4 ++-- packages/app/setup.cfg | 2 +- packages/data/setup.cfg | 2 +- packages/schema/setup.cfg | 2 +- packages/tool_shed/setup.cfg | 2 +- packages/tours/setup.cfg | 2 +- packages/web_apps/setup.cfg | 2 +- packages/web_framework/setup.cfg | 2 +- pyproject.toml | 4 ++-- 10 files changed, 14 insertions(+), 14 deletions(-) diff --git a/lib/galaxy/dependencies/pinned-requirements.txt b/lib/galaxy/dependencies/pinned-requirements.txt index f25d7b6a27c7..f76dfff9d22f 100644 --- a/lib/galaxy/dependencies/pinned-requirements.txt +++ b/lib/galaxy/dependencies/pinned-requirements.txt @@ -133,10 +133,10 @@ psutil==5.9.8 ; python_version >= "3.8" and python_version < "3.13" pulsar-galaxy-lib==0.15.6 ; python_version >= "3.8" and python_version < "3.13" pycparser==2.22 ; python_version >= "3.8" and python_version < "3.13" pycryptodome==3.20.0 ; python_version >= "3.8" and python_version < "3.13" -pydantic-core==2.18.2 ; python_version >= "3.8" and python_version < "3.13" +pydantic-core==2.18.4 ; python_version >= "3.8" and python_version < "3.13" pydantic-tes==0.1.5 ; python_version >= "3.8" and python_version < "3.13" -pydantic==2.7.1 ; python_version >= "3.8" and python_version < "3.13" -pydantic[email]==2.7.1 ; python_version >= "3.8" and python_version < "3.13" +pydantic==2.7.4 ; python_version >= "3.8" and python_version < "3.13" +pydantic[email]==2.7.4 ; python_version >= "3.8" and python_version < "3.13" pydot==2.0.0 ; python_version >= "3.8" and python_version < "3.13" pyeventsystem==0.1.0 ; python_version >= "3.8" and python_version < "3.13" pyfaidx==0.8.1.1 ; python_version >= "3.8" and python_version < "3.13" diff --git a/lib/galaxy/dependencies/pinned-typecheck-requirements.txt b/lib/galaxy/dependencies/pinned-typecheck-requirements.txt index a18d0745af0d..d4cb93e53f3f 100644 --- a/lib/galaxy/dependencies/pinned-typecheck-requirements.txt +++ b/lib/galaxy/dependencies/pinned-typecheck-requirements.txt @@ -8,8 +8,8 @@ mypy-boto3-s3==1.34.105 ; python_version >= "3.8" and python_version < "3.13" mypy-extensions==1.0.0 ; python_version >= "3.8" and python_version < "3.13" mypy==1.10.0 ; python_version >= "3.8" and python_version < "3.13" pycparser==2.22 ; python_version >= "3.8" and python_version < "3.13" and platform_python_implementation != "PyPy" -pydantic-core==2.18.2 ; python_version >= "3.8" and python_version < "3.13" -pydantic==2.7.1 ; python_version >= "3.8" and python_version < "3.13" +pydantic-core==2.18.4 ; python_version >= "3.8" and python_version < "3.13" +pydantic==2.7.4 ; python_version >= "3.8" and python_version < "3.13" tomli==2.0.1 ; python_version >= "3.8" and python_version < "3.11" types-awscrt==0.20.9 ; python_version >= "3.8" and python_version < "3.13" types-bleach==6.1.0.20240331 ; python_version >= "3.8" and python_version < "3.13" diff --git a/packages/app/setup.cfg b/packages/app/setup.cfg index 1879c3437ee9..640cacc77d3d 100644 --- a/packages/app/setup.cfg +++ b/packages/app/setup.cfg @@ -61,7 +61,7 @@ install_requires = paramiko!=2.9.0,!=2.9.1 pebble pulsar-galaxy-lib>=0.15.0.dev0 - pydantic>=2,!=2.6.0,!=2.6.1 + pydantic>=2.7.4 pysam>=0.21 PyJWT PyYAML diff --git a/packages/data/setup.cfg b/packages/data/setup.cfg index cd53e425aa10..6f1ce7204eb6 100644 --- a/packages/data/setup.cfg +++ b/packages/data/setup.cfg @@ -53,7 +53,7 @@ install_requires = numpy parsley pycryptodome - pydantic[email]>=2,!=2.6.0,!=2.6.1 + pydantic[email]>=2.7.4 pylibmagic python-magic pysam>=0.21 diff --git a/packages/schema/setup.cfg b/packages/schema/setup.cfg index dce6efc479ef..1ebcb6abef60 100644 --- a/packages/schema/setup.cfg +++ b/packages/schema/setup.cfg @@ -33,7 +33,7 @@ version = 23.2.dev0 include_package_data = True install_requires = galaxy-util - pydantic[email]>=2,!=2.6.0,!=2.6.1 + pydantic[email]>=2.7.4 packages = find: python_requires = >=3.8 diff --git a/packages/tool_shed/setup.cfg b/packages/tool_shed/setup.cfg index 9ec024a7992c..0181412712ea 100644 --- a/packages/tool_shed/setup.cfg +++ b/packages/tool_shed/setup.cfg @@ -50,7 +50,7 @@ install_requires = MarkupSafe mercurial Paste - pydantic>=2,!=2.6.0,!=2.6.1 + pydantic>=2.7.4 Routes SQLAlchemy>=2.0,<2.1 starlette diff --git a/packages/tours/setup.cfg b/packages/tours/setup.cfg index 1e14d2215a75..3197c7e1eeab 100644 --- a/packages/tours/setup.cfg +++ b/packages/tours/setup.cfg @@ -33,7 +33,7 @@ version = 23.2.dev0 include_package_data = True install_requires = galaxy-navigation - pydantic>=2,!=2.6.0,!=2.6.1 + pydantic>=2.7.4 PyYAML packages = find: python_requires = >=3.8 diff --git a/packages/web_apps/setup.cfg b/packages/web_apps/setup.cfg index 02b2a8005312..ee9b36f2f70c 100644 --- a/packages/web_apps/setup.cfg +++ b/packages/web_apps/setup.cfg @@ -50,7 +50,7 @@ install_requires = Mako MarkupSafe Paste - pydantic>=2,!=2.6.0,!=2.6.1 + pydantic>=2.7.4 PyJWT python-dateutil python-multipart # required to support form parsing in FastAPI/Starlette diff --git a/packages/web_framework/setup.cfg b/packages/web_framework/setup.cfg index 55d3421dade9..2cdcd90c3776 100644 --- a/packages/web_framework/setup.cfg +++ b/packages/web_framework/setup.cfg @@ -37,7 +37,7 @@ install_requires = babel MarkupSafe paste - pydantic>=2,!=2.6.0,!=2.6.1 + pydantic>=2.7.4 requests Routes SQLAlchemy>=2.0,<2.1 diff --git a/pyproject.toml b/pyproject.toml index f7b93e63990c..b5ce3a9cae38 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -92,7 +92,7 @@ pillow = "*" psutil = "*" pulsar-galaxy-lib = ">=0.15.0.dev0" pycryptodome = "*" -pydantic = {version = ">=2.7.0", extras = ["email"]} # https://github.com/pydantic/pydantic/issues/8760 +pydantic = {version = ">=2.7.4", extras = ["email"]} # https://github.com/pydantic/pydantic/pull/9639 PyJWT = "*" pykwalify = "*" pylibmagic = "*" @@ -175,7 +175,7 @@ Werkzeug = "*" mypy = "*" boto3-stubs = {version = "*", extras = ["s3"]} lxml-stubs = "*" -pydantic = ">=2, !=2.6.0, !=2.6.1" # for pydantic.mypy plugin +pydantic = ">=2.7.4" # for pydantic.mypy plugin types-bleach = "*" types-boto = "*" types-contextvars = "*"