Skip to content

Commit

Permalink
use ver specific fix for pydantic instead of OS
Browse files Browse the repository at this point in the history
- pydantic possibly needs to be pinned at 1.10.19 @talonchandler
- implemented ver specific import for now
  • Loading branch information
amitabhverma committed Dec 17, 2024
1 parent e311496 commit ee8e09f
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions recOrder/plugin/tab_recon.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,23 @@
from concurrent.futures import ThreadPoolExecutor

import pydantic.v1, pydantic
import importlib.metadata

try:
if sys.platform == "win32":
# windows
from pydantic.v1.main import ModelMetaclass
elif sys.platform == "darwin":
# macOS
from pydantic.main import ModelMetaclass
elif sys.platform.startswith("linux"):
# Use version specific pydantic import for ModelMetaclass
# prefer to pin to 1.10.19
version = importlib.metadata.version('pydantic')
# print("Your Pydantic library ver:{v}.".format(v=version))
if version >= "2.0.0":
print("Your Pydantic library ver:{v}. Recommended ver is: 1.10.19".format(v=version))
from pydantic.main import ModelMetaclass
elif version >= "1.10.19":
from pydantic.main import ModelMetaclass
else:
print("Your Pydantic library ver:{v}. Recommended ver is: 1.10.19".format(v=version))
from pydantic.v1.main import ModelMetaclass
except:
pass
print("Pydantic library was not found. Ver 1.10.19 is recommended.")

STATUS_submitted_pool = "Submitted_Pool"
STATUS_submitted_job = "Submitted_Job"
Expand Down

0 comments on commit ee8e09f

Please sign in to comment.