From 4e96c1dcdde4ed820822df1d1b7b2b4b7a314922 Mon Sep 17 00:00:00 2001 From: Ben Clifford Date: Thu, 24 Oct 2024 15:11:44 +0000 Subject: [PATCH] Some type annotation work: For static checking: tell mypy to ignore missing imports - specifically Client when the globus compute SDK is not installed. For dynamic type annotations: tell Python to use deferred type resolution. This lets the module be imported even though the Client type annotation does not exist in some setups. --- mypy.ini | 3 +++ parsl/executors/globus_compute.py | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/mypy.ini b/mypy.ini index 4b64a12de2..e46e11fd63 100644 --- a/mypy.ini +++ b/mypy.ini @@ -177,6 +177,9 @@ ignore_missing_imports = True #[mypy-multiprocessing.synchronization.*] #ignore_missing_imports = True +[mypy-globus_compute_sdk.*] +ignore_missing_imports = True + [mypy-pandas.*] ignore_missing_imports = True diff --git a/parsl/executors/globus_compute.py b/parsl/executors/globus_compute.py index cac59be20c..1003fe979a 100644 --- a/parsl/executors/globus_compute.py +++ b/parsl/executors/globus_compute.py @@ -1,3 +1,5 @@ +from __future__ import annotations + import uuid from concurrent.futures import Future from typing import Any, Callable, Dict, Optional, Union @@ -11,7 +13,6 @@ _globus_compute_enabled = True except ImportError: _globus_compute_enabled = False - Client: Any # type: ignore[no-redef] UUID_LIKE_T = Union[uuid.UUID, str]