Skip to content

Release 18.1.0: add async token authentication - #256

Merged
gavinsharp merged 5 commits into
mainfrom
fern-bot/2026-10-08_17-04-43_336
Oct 8, 2026
Merged

gavinsharp merged 5 commits into
mainfrom
fern-bot/2026-10-08_17-04-43_336

Conversation

@fern-api

@fern-api fern-api Bot commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

18.0.0 → 18.1.0

Adds async bearer-token suppliers to AsyncPhenomlClient and avoids calling a synchronous token supplier when async authentication is configured; existing synchronous token and OAuth constructor call sites remain supported, so this is a minor release.

Added

  • phenoml.AsyncPhenomlClient(async_token=...) — accepts an async callable returning a bearer token, with a dedicated constructor overload for type checkers, so token acquisition can perform async I/O without OAuth client credentials.

Changed

  • phenoml.core.client_wrapper.AsyncClientWrapper.async_get_headers() — skips the synchronous token supplier when an async supplier is configured, including the existing OAuth token provider, so each async request uses only the async authentication path.
  • phenoml.core.client_wrapper.BaseClientWrapper.get_headers(include_token=...) — adds an optional keyword argument that defaults to True and allows the async authentication path to defer token injection.

Migration notes

To use asynchronous token acquisition, pass an async def callable as async_token instead of token; no changes are required for existing authentication call sites.

Validation

  • poetry run mypy . passes for all 479 source files.
  • Local utility/authentication tests: 76 passed, 4 skipped; mocked requests verify async token refresh, synchronous supplier bypass, OAuth caching, and existing token authentication.
  • GitHub CI passes: compile succeeds and the full WireMock test suite reports 172 passed, 4 skipped; artifact sync also passes.
  • Wheel and source distribution contain the bundled OpenAPI spec and consistent 18.1.0 version metadata.

Release follow-up

The development lock retains Pydantic 2.13.5 and pydantic-core 2.46.5 because Pydantic 2.14 exposes a generated-code type-checking issue tracked in fern-api/fern#18156; published dependency constraints are unchanged.


Note

Medium Risk
Changes how every async request obtains Authorization headers when async_token is used; mistakes could break auth or double-fetch tokens, though default token/OAuth behavior is unchanged when async_token is omitted.

Overview
Releases phenoml 18.1.0 with async-friendly bearer authentication for the async client.

AsyncPhenomlClient now accepts an optional async_token callable (Callable[[], Awaitable[str]]) so token refresh can use async I/O without OAuth client credentials. A dedicated @overload helps type checkers treat async_token-only construction separately from token. Token-auth initialization runs when either token or async_token is set, and the wrapper receives async_token.

AsyncClientWrapper.async_get_headers() builds base headers with get_headers(include_token=False) when an async supplier is configured, then awaits async_token() for Authorization, avoiding a redundant sync token fetch (including on the OAuth async path, which passes the provider’s async get_token).

BaseClientWrapper.get_headers() adds include_token (default True) so the async path can defer bearer injection. Version strings and Fern replay/metadata bump to 18.1.0 / generator 5.34.2; changelog and bundled spec commit are updated.

Reviewed by Cursor Bugbot for commit f6468fb. Bugbot is set up for automated code reviews on this repo. Configure here.

fern-api Bot and others added 4 commits October 8, 2026 17:04
Generated by Fern
CLI Version: unknown
Generators:
  - fernapi/fern-python-sdk: 5.34.2
Introduce an `async_token` parameter on `AsyncPhenomlClient.__init__`
that accepts an async callable returning a bearer token. This enables
token acquisition involving async I/O (e.g., refreshing tokens via an
async HTTP client) without blocking the event loop. A new `@overload`
signature is added so type checkers surface the parameter correctly.

Internally, `AsyncClientWrapper.async_get_headers()` now skips the
synchronous token lookup when `async_token` is provided, and
`BaseClientWrapper.get_headers()` gains an `include_token` keyword
argument to support this flow cleanly.

Key changes:
- Add `async_token: Optional[Callable[[], Awaitable[str]]]` parameter to `AsyncPhenomlClient.__init__`
- Add `@overload` for `AsyncPhenomlClient.__init__` accepting `async_token` exclusively
- Update `AsyncClientWrapper.async_get_headers()` to await `async_token` and skip sync token when present
- Add `include_token` keyword argument to `BaseClientWrapper.get_headers()`
- Update `code-examples.json` to reflect latest spec and example output changes

🌿 Generated with Fern
Patches applied (1):
  - patch-6516695e: Release 15.0.2: restore bundled openapi.json packaging (#169)

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 9776fff. Configure here.

Comment thread src/phenoml/core/client_wrapper.py Outdated
@gavinsharp gavinsharp changed the title feat: add async_token support to AsyncPhenomlClient Release 18.1.0: add async token authentication Oct 8, 2026
@gavinsharp
gavinsharp merged commit 424cc36 into main Oct 8, 2026
9 checks passed
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