From ae006e8093abe8a21d64968fee6ddfd81318811a Mon Sep 17 00:00:00 2001 From: Tillman Date: Sat, 6 Jan 2024 12:44:27 +0100 Subject: [PATCH 1/4] adjsut pydantic version in setup.py --- setup.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/setup.py b/setup.py index 85f74b0..0108ee8 100644 --- a/setup.py +++ b/setup.py @@ -4,8 +4,7 @@ import os import re -from setuptools import setup, find_packages - +from setuptools import find_packages, setup with open("README.rst") as file: long_description = file.read() @@ -42,7 +41,7 @@ def get_var(var_name): "supervisor", "pyyaml", "packaging", - "pydantic<2", + "pydantic>=2", "jsonref", "requests", "requests-unixsocket", From 570040eab068b9a21e014cd7123606f0c518699a Mon Sep 17 00:00:00 2001 From: Tillman Date: Sat, 6 Jan 2024 12:46:12 +0100 Subject: [PATCH 2/4] Specify pydantic version to be of version 1 --- gravity/config_manager.py | 7 ++----- gravity/settings.py | 11 +++-------- gravity/state.py | 10 +++------- 3 files changed, 8 insertions(+), 20 deletions(-) diff --git a/gravity/config_manager.py b/gravity/config_manager.py index 8ab5c03..8d6294a 100644 --- a/gravity/config_manager.py +++ b/gravity/config_manager.py @@ -7,15 +7,12 @@ import xml.etree.ElementTree as elementtree from typing import Union -from pydantic import ValidationError +from pydantic.v1 import ValidationError from yaml import safe_load import gravity.io from gravity.settings import Settings -from gravity.state import ( - ConfigFile, - service_for_service_type, -) +from gravity.state import ConfigFile, service_for_service_type from gravity.util import recursive_update log = logging.getLogger(__name__) diff --git a/gravity/settings.py b/gravity/settings.py index 6e3eda4..5c9a788 100644 --- a/gravity/settings.py +++ b/gravity/settings.py @@ -1,13 +1,8 @@ import os from enum import Enum -from typing import ( - Any, - Dict, - List, - Optional, - Union, -) -from pydantic import BaseModel, BaseSettings, Extra, Field, validator +from typing import Any, Dict, List, Optional, Union + +from pydantic.v1 import BaseModel, BaseSettings, Extra, Field, validator DEFAULT_INSTANCE_NAME = "_default_" GX_IT_PROXY_MIN_VERSION = "0.0.6" diff --git a/gravity/state.py b/gravity/state.py index c3c91b6..dfd3d93 100644 --- a/gravity/state.py +++ b/gravity/state.py @@ -2,6 +2,7 @@ state data. """ from __future__ import annotations + import enum import hashlib import os @@ -9,17 +10,12 @@ import time from typing import Any, Dict, List, Optional -from pydantic import BaseModel, validator +from pydantic.v1 import BaseModel, validator import gravity.io -from gravity.settings import ( - AppServer, - ProcessManager, - ServiceCommandStyle, -) +from gravity.settings import AppServer, ProcessManager, ServiceCommandStyle from gravity.util import http_check - DEFAULT_GALAXY_ENVIRONMENT = { "PYTHONPATH": "lib", "GALAXY_CONFIG_FILE": "{galaxy_conf}", From 7a44841d6866f817137c5bd2545f4ccdcd235297 Mon Sep 17 00:00:00 2001 From: mvdbeek Date: Sun, 7 Jan 2024 11:55:20 +0100 Subject: [PATCH 3/4] Support pydantic 1, make pydantic.v1 import conditional --- gravity/config_manager.py | 5 ++++- gravity/settings.py | 5 ++++- gravity/state.py | 5 ++++- setup.py | 2 +- 4 files changed, 13 insertions(+), 4 deletions(-) diff --git a/gravity/config_manager.py b/gravity/config_manager.py index 8d6294a..394ecb1 100644 --- a/gravity/config_manager.py +++ b/gravity/config_manager.py @@ -7,7 +7,10 @@ import xml.etree.ElementTree as elementtree from typing import Union -from pydantic.v1 import ValidationError +try: + from pydantic.v1 import ValidationError +except ImportError: + from pydantic import ValidationError from yaml import safe_load import gravity.io diff --git a/gravity/settings.py b/gravity/settings.py index 5c9a788..eeab02f 100644 --- a/gravity/settings.py +++ b/gravity/settings.py @@ -2,7 +2,10 @@ from enum import Enum from typing import Any, Dict, List, Optional, Union -from pydantic.v1 import BaseModel, BaseSettings, Extra, Field, validator +try: + from pydantic.v1 import BaseModel, BaseSettings, Extra, Field, validator +except ImportError: + from pydantic import BaseModel, BaseSettings, Extra, Field, validator DEFAULT_INSTANCE_NAME = "_default_" GX_IT_PROXY_MIN_VERSION = "0.0.6" diff --git a/gravity/state.py b/gravity/state.py index dfd3d93..3879372 100644 --- a/gravity/state.py +++ b/gravity/state.py @@ -10,7 +10,10 @@ import time from typing import Any, Dict, List, Optional -from pydantic.v1 import BaseModel, validator +try: + from pydantic.v1 import BaseModel, validator +except ImportError: + from pydantic import BaseModel, validator import gravity.io from gravity.settings import AppServer, ProcessManager, ServiceCommandStyle diff --git a/setup.py b/setup.py index 0108ee8..baacb77 100644 --- a/setup.py +++ b/setup.py @@ -41,7 +41,7 @@ def get_var(var_name): "supervisor", "pyyaml", "packaging", - "pydantic>=2", + "pydantic<3", # pydantic.v1 import will be removed in v3 "jsonref", "requests", "requests-unixsocket", From 46d5ce47a2f415e9be6a048f948b1f423794da6e Mon Sep 17 00:00:00 2001 From: mvdbeek Date: Sun, 7 Jan 2024 17:33:26 +0100 Subject: [PATCH 4/4] Update supported python versions --- .github/workflows/test.yaml | 4 ++-- setup.py | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index b6b975f..f3b2580 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -10,8 +10,8 @@ jobs: strategy: fail-fast: false matrix: - python-version: ['3.7', '3.10'] - galaxy-branch: ['release_22.01', 'dev'] + python-version: ['3.8', '3.11'] + galaxy-branch: ['release_23.0', 'dev'] exclude: # this results in lengthy and expensive numpy wheel builds - python-version: '3.10' diff --git a/setup.py b/setup.py index baacb77..764cdc5 100644 --- a/setup.py +++ b/setup.py @@ -35,7 +35,7 @@ def get_var(var_name): author_email="team@galaxyproject.org", license="MIT", keywords="gravity galaxy", - python_requires=">=3.6", + python_requires=">=3.7", install_requires=[ "Click", "supervisor", @@ -56,10 +56,10 @@ def get_var(var_name): "Natural Language :: English", "Operating System :: POSIX", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.6", - "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", ], zip_safe=False, )