-
Notifications
You must be signed in to change notification settings - Fork 78
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make 'numba' a soft dependency for the Python server API (#5169)
* Make 'numba' a soft_dependency * Apply suggestions from code review Co-authored-by: Chip Kent <5250374+chipkent@users.noreply.github.com> --------- Co-authored-by: Chip Kent <5250374+chipkent@users.noreply.github.com>
- Loading branch information
Showing
2 changed files
with
76 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# | ||
# Copyright (c) 2016-2023 Deephaven Data Labs and Patent Pending | ||
# | ||
"""This module is an internal module to support dependency management""" | ||
|
||
import importlib | ||
from types import ModuleType | ||
from typing import Optional | ||
|
||
|
||
def soft_dependency(module_name: str) -> Optional[ModuleType]: | ||
"""Attempt to import a module and return it if it exists, otherwise return None. | ||
Args: | ||
module_name (str): the name of the module to import | ||
Returns: | ||
the module if it exists, otherwise None | ||
""" | ||
try: | ||
return importlib.import_module(module_name) | ||
except ImportError: | ||
return None |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters