Skip to content

fix(client): make from tether import TetherClient work + ReflexClient alias#225

Open
rylinjames wants to merge 1 commit into
mainfrom
fix/client-sdk-toplevel-import
Open

fix(client): make from tether import TetherClient work + ReflexClient alias#225
rylinjames wants to merge 1 commit into
mainfrom
fix/client-sdk-toplevel-import

Conversation

@rylinjames

Copy link
Copy Markdown
Collaborator

Completes the SDK side of the v0.12.0 rename (audit §3.9, client H1/H2 + L1/L6).

Changes

# Fix Detail
H2 from tether import TetherClient now works The pyproject comment + reflex shim docstring promised it, but the top-level __getattr__ only exposed the validate/fixtures surface → AttributeError. Now re-exports the full SDK lazily from tether.client (httpx is a base dep, so no torch cost).
H1 ReflexClient / ReflexAsyncClient deprecation aliases Pre-rename code doing from tether.client import ReflexClient keeps working through v0.13.x (warns once, removed v0.14.0 — matches the reflex import-shim schedule). README snippets were already fixed to TetherClient in #224; this covers users with the old name in their own code.
L6 encode_image error accuracy Passing an unsupported type (dict/int/…) when Pillow was absent reported "Pillow required" instead of "unsupported image type". Now rejects non-image-like inputs before requiring Pillow; real ndarray/PIL inputs still get the Pillow message.
L1 dead-code cleanup removed unused last_exc (sync retry loop) and an unused glob import.

Verification

  • tests/test_client.py: 29 passed, 2 skipped (the previously-failing test_encode_unsupported_type_raises now passes — it was asserting the L6 behavior).
  • Top-level import + tether.TetherClient is TetherClient + alias DeprecationWarning unit-checked.
  • ruff check clean on all touched files.

Not included (needs a customer-facing API decision, flagged separately): client M5 — capping a server-supplied Retry-After would add a new constructor kwarg.

🤖 Generated with Claude Code

…nt alias

Audit §3.9 (client SDK H1/H2/L1/L6):

- H2: `from tether import TetherClient` was promised by the pyproject comment
  and the reflex shim docstring but raised AttributeError — the top-level
  __getattr__ only lazy-loaded the validate/fixtures surface. Re-export the
  full client SDK (TetherClient, TetherAsyncClient, the 5 exception types,
  encode_image) lazily from tether.client; httpx is a base dep so no torch
  cost. Added to __all__.

- H1: add ReflexClient / ReflexAsyncClient deprecation-alias subclasses in
  tether.client so pre-rename code keeps importing through the v0.13.x compat
  window (warns once, removed v0.14.0 — matches the `reflex` import-shim
  schedule). The README snippets were already fixed to TetherClient in the
  rename-sweep PR; this covers users with the old name in their own code.

- L6: encode_image() reported "Pillow required" for genuinely-unsupported
  types (dict, int, …) when Pillow was absent, blaming a missing optional dep
  on a caller who passed garbage. Now rejects non-image-like types with
  "unsupported image type" BEFORE requiring Pillow; real ndarray/PIL inputs
  still get the Pillow-required message. Fixes the previously-failing
  test_encode_unsupported_type_raises.

- L1: removed dead `last_exc` assignments in the sync retry loop; removed an
  unused `glob` import in __init__.

Verified: tests/test_client.py 29 passed / 2 skipped; top-level + alias import
behavior unit-checked; ruff clean on all touched files.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant