diff --git a/xarray/namedarray/utils.py b/xarray/namedarray/utils.py index 3097cd820a0..339a5037832 100644 --- a/xarray/namedarray/utils.py +++ b/xarray/namedarray/utils.py @@ -3,6 +3,7 @@ import sys import warnings from collections.abc import Hashable, Iterable, Iterator, Mapping +from functools import lru_cache from typing import TYPE_CHECKING, Any, TypeVar, cast import numpy as np @@ -32,6 +33,7 @@ T = TypeVar("T") +@lru_cache def module_available(module: str) -> bool: """Checks whether a module is installed without importing it.