Skip to content

feat: public sync transport - #473

Merged
alexanto merged 3 commits into
mainfrom
feat/public-sync-transport
Nov 11, 2026
Merged

alexanto merged 3 commits into
mainfrom
feat/public-sync-transport

Conversation

@alexanto

@alexanto alexanto commented Nov 5, 2026

Copy link
Copy Markdown
Contributor

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 requests or they can inject a session only depending their needs. haven't removed HttpOptions yet, but clearly doesn't sit well with this redesign, coming shortly.

@alexanto
alexanto added this pull request to stack #468 November 5, 2026 11:44
@alexanto
alexanto force-pushed the feat/public-sync-transport branch from 3df6c8c to 2ef586e Compare November 5, 2026 13:28
@gastonfournier gastonfournier moved this from New to In Progress in Issues and PRs Nov 6, 2026
@alexanto
alexanto requested review from ppicom and a balanced review from Copilot November 6, 2026 09:17

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 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 thread UnleashClient/_unleash_api_client.py Resolved
Comment thread UnleashClient/clients/unleash_client.py Resolved
Comment thread UnleashClient/clients/unleash_client.py Resolved
Comment thread examples/httpx_transport.py Resolved
Comment thread UnleashClient/clients/unleash_client.py Resolved
Comment thread UnleashClient/clients/unleash_client.py Resolved
@github-project-automation github-project-automation Bot moved this from In Progress to Approved PRs in Issues and PRs Nov 10, 2026
Base automatically changed from refactor/retry-policy to main November 11, 2026 11:46
@alexanto
alexanto force-pushed the feat/public-sync-transport branch from e78c9cd to 6cca3d4 Compare November 11, 2026 11:56
@alexanto
alexanto force-pushed the feat/public-sync-transport branch from 6cca3d4 to ebe9a8b Compare November 11, 2026 12:14
@alexanto
alexanto merged commit 96065fc into main Nov 11, 2026
8 checks passed
@github-project-automation github-project-automation Bot moved this from Approved PRs to Done in Issues and PRs Nov 11, 2026
@alexanto
alexanto deleted the feat/public-sync-transport branch November 11, 2026 12:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants