Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 22 additions & 3 deletions nui_lambda_shared_utils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,21 @@
This package has been renamed to nui-python-shared-utils.
The import name has changed from nui_lambda_shared_utils to nui_shared_utils.

This shim re-exports everything from nui_shared_utils so existing consumers
This shim forwards attribute access to nui_shared_utils so existing consumers
continue to work without changes. New code should use:

from nui_shared_utils import ...

This shim will be removed in the next major version (2.0.0).

Forwarding is lazy (PEP 562 ``__getattr__``) to preserve the cold-start
optimisation in the underlying package: ``from nui_lambda_shared_utils.jwt_auth
import check_auth`` only imports ``jwt_auth`` and its dependencies, not the
full slack/es/db client surface.
"""

import warnings
from typing import Any, List

warnings.warn(
"nui_lambda_shared_utils is deprecated. Use nui_shared_utils instead. "
Expand All @@ -21,5 +27,18 @@
stacklevel=2,
)

from nui_shared_utils import * # noqa: F401,F403
from nui_shared_utils import __all__ # noqa: F401
import nui_shared_utils as _target

__all__ = list(_target.__all__)


def __getattr__(name: str) -> Any:
# Delegate to the new package's lazy resolver. Cache on this module so
# subsequent accesses avoid the round-trip.
value = getattr(_target, name)
globals()[name] = value
return value


def __dir__() -> List[str]:
return sorted(set(globals()) | set(__all__))
Loading
Loading