Repository navigation
Conversation
for more information, see https://pre-commit.ci
alexanto
force-pushed
the
feat/public-sync-transport
branch
from
November 5, 2026 13:28
3df6c8c to
2ef586e
Compare
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Valid falsey custom transports are silently replaced with the default, causing unintended real HTTP requests, while custom transport users also lose control over the SDK retry budget.
2 open issues
What changed in this PR
This PR exposes the synchronous client's HTTP transport API, allowing callers to supply a configured requests.Session or use another HTTP library.
Changes:
- Publishes transport types and adds validated
transport=injection. - Adds session reuse, custom transport headers, and case-insensitive response-header lookup.
- Adds documentation, runnable examples, and transport integration tests.
| File | Description |
|---|---|
UnleashClient/transport.py |
Publishes transport interfaces and configurable requests transport. |
UnleashClient/clients/unleash_client.py |
Validates and forwards custom transports. |
UnleashClient/_unleash_api_client.py |
Uses public transport types and case-insensitive ETag lookup. |
UnleashClient/_transport.py |
Removes the former private transport module. |
UnleashClient/_retry.py |
Imports public transport types. |
UnleashClient/_async_unleash_api_client.py |
Updates transport imports. |
UnleashClient/_aiohttp_transport.py |
Updates request and response imports. |
UnleashClient/__init__.py |
Exports the public sync transport API. |
tests/unit_tests/test_unleash_api_client.py |
Tests case-insensitive response headers. |
tests/unit_tests/test_transport.py |
Tests sessions, headers, timeouts, and retry warnings. |
tests/unit_tests/test_retry.py |
Updates transport imports. |
tests/unit_tests/test_async_unleash_api_client.py |
Updates transport imports. |
tests/unit_tests/test_aiohttp_transport.py |
Updates transport imports. |
tests/unit_tests/clients/test_unleash_client_transport.py |
Tests transport injection, validation, and examples. |
requirements.txt |
Adds httpx for testing. |
README.md |
Documents custom transports and ownership requirements. |
pyproject.toml |
Excludes examples from package discovery. |
examples/httpx_transport.py |
Demonstrates an httpx-backed transport. |
examples/fake_transport.py |
Demonstrates server-free feature testing. |
CHANGELOG.md |
Announces public sync transport support. |
Review effort: Balanced
Comment on lines
+105
to
+106
| built from ``config.http``. A transport passed in is never | ||
| closed: whoever created it closes it. |
Contributor
Author
There was a problem hiding this comment.
seems rare but possibly legit to me, so pushed a fix
Comment on lines
+63
to
+67
| if http is not None: | ||
| raise ValueError( | ||
| "Pass either http or transport, not both. Set headers and the " | ||
| "timeout on the transport: RequestsTransport(headers=..., timeout=...)." | ||
| ) |
Contributor
Author
There was a problem hiding this comment.
this is opinionated, i think default SDK retries should not be configurable, if we need the disable retries option we can add later as non-breaking
This branch has not been deployed
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.


in this PR, I start doing what I set out to really do in the first place
made the generic transport public in the sync client, so users can now bring their own trasport implementation and use a different http library other than
requestsor they can inject a session only depending their needs. haven't removedHttpOptionsyet, but clearly doesn't sit well with this redesign, coming shortly.