Repository navigation
Release 18.1.0: add async token authentication - #256
Merged
Merged
Conversation
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)
…c94ff3d51f871ab0 [skip ci]
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
❌ 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.
gavinsharp
approved these changes
Oct 8, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

18.0.0 → 18.1.0
Adds async bearer-token suppliers to
AsyncPhenomlClientand 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 toTrueand allows the async authentication path to defer token injection.Migration notes
To use asynchronous token acquisition, pass an
async defcallable asasync_tokeninstead oftoken; no changes are required for existing authentication call sites.Validation
poetry run mypy .passes for all 479 source files.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_tokenis used; mistakes could break auth or double-fetch tokens, though defaulttoken/OAuth behavior is unchanged whenasync_tokenis omitted.Overview
Releases phenoml 18.1.0 with async-friendly bearer authentication for the async client.
AsyncPhenomlClientnow accepts an optionalasync_tokencallable (Callable[[], Awaitable[str]]) so token refresh can use async I/O without OAuth client credentials. A dedicated@overloadhelps type checkers treatasync_token-only construction separately fromtoken. Token-auth initialization runs when eithertokenorasync_tokenis set, and the wrapper receivesasync_token.AsyncClientWrapper.async_get_headers()builds base headers withget_headers(include_token=False)when an async supplier is configured, then awaitsasync_token()forAuthorization, avoiding a redundant sync token fetch (including on the OAuth async path, which passes the provider’s asyncget_token).BaseClientWrapper.get_headers()addsinclude_token(defaultTrue) 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.