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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
> went on. It needs to be consolidated into what will eventually become the
> final changelog + documentation changes (if any).

* (Minor): `AsyncUnleashClient` is now exported from the package root: `from UnleashClient import AsyncUnleashClient`. It still requires the `async` extra (`pip install UnleashClient[async]`), and importing it without `aiohttp` raises an `ImportError` asking for it. `import UnleashClient` keeps working without `aiohttp`, so nothing changes for code using `UnleashClient`.
* (Bugfix): `UnleashClient` can be imported again without the optional `aiohttp` dependency. Importing the package used to fail with an `ImportError` asking for `UnleashClient[async]`, even for code that never touches the asynchronous client. Only the asynchronous client requires `aiohttp` now, and importing it without `aiohttp` still raises that `ImportError`.
* (Minor): The in-progress asynchronous client now exposes `feature_definitions()`. It returns the same dict as `UnleashClient`, keyed by feature name with each toggle's `type` and `project`. It is a plain method, not a coroutine, and it does not wait for the server: before the first fetch it answers from the cached state, and without any state it returns an empty dict. Every method on the client is now implemented. The client is still unexported. Nothing changes for code using `UnleashClient`.
* (Minor): The in-progress asynchronous client can now resolve variants. `get_variant()` returns the same variant dict as `UnleashClient` and emits the same impression events. It is a plain method, not a coroutine, and it does not wait for the server: before the first fetch it answers from the cached state, and a toggle the client does not know resolves to the disabled variant. When an initialized client is asked for a toggle it does not know, it logs at `verbose_log_level` that the client does not know the toggle. `feature_definitions()` still raises `NotImplementedError`. The client is still unexported. Nothing changes for code using `UnleashClient`.
Expand Down
13 changes: 13 additions & 0 deletions UnleashClient/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,20 @@
# ruff: noqa: F401
from typing import TYPE_CHECKING

from .clients import (
INSTANCES,
ExperimentalMode,
UnleashClient,
build_ready_callback,
)

if TYPE_CHECKING:
from .clients.async_unleash_client import AsyncUnleashClient


def __getattr__(name: str):
if name == "AsyncUnleashClient":
from .clients.async_unleash_client import AsyncUnleashClient # noqa: PLC0415

return AsyncUnleashClient
raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
Loading