| 1 |
import importlib.metadata |
| 2 |
import logging |
| 3 |
import sys |
| 4 |
|
| 5 |
from ._internal.lazy_import import ( |
| 6 |
default_dir_implementation, |
| 7 |
default_getattr_implementation, |
| 8 |
load_all_tuple, |
| 9 |
) |
| 10 |
|
| 11 |
__version__ = importlib.metadata.distribution("globus_sdk").version |
| 12 |
|
| 13 |
|
| 14 |
def _force_eager_imports() -> None: |
| 15 |
current_module = sys.modules[__name__] |
| 16 |
|
| 17 |
for attr in __all__: |
| 18 |
getattr(current_module, attr) |
| 19 |
|
| 20 |
|
| 21 |
# |
| 22 |
# all lazy SDK attributes are defined in __init__.pyi |
| 23 |
# |
| 24 |
# to add an attribute, write the relevant import in `__init__.pyi` and update |
| 25 |
# the `__all__` tuple there |
| 26 |
# |
| 27 |
__all__ = load_all_tuple(__name__, "__init__.pyi") |
| 28 |
__getattr__ = default_getattr_implementation(__name__, "__init__.pyi") |
| 29 |
__dir__ = default_dir_implementation(__name__) |
| 30 |
|
| 31 |
del load_all_tuple |
| 32 |
del default_getattr_implementation |
| 33 |
del default_dir_implementation |
| 34 |
|
| 35 |
|
| 36 |
# configure logging for a library, per python best practices: |
| 37 |
# https://docs.python.org/3/howto/logging.html#configuring-logging-for-a-library |
| 38 |
logging.getLogger("globus_sdk").addHandler(logging.NullHandler()) |