Skip to content

feat: major release on HTTPX2 migration - #157

Open
yamaceay wants to merge 6 commits into
mainfrom
poc/httpx2-major
Open

yamaceay wants to merge 6 commits into
mainfrom
poc/httpx2-major

Conversation

@yamaceay

Copy link
Copy Markdown
Contributor

What this PR does and why it is needed

This PoC migrates packages/gen/ from HTTPX to HTTPX2 directly. Major release needed since HTTPX is entirely removed from the gen package.

Definition of Done

  • Code is tested (Unit, Integration, E2E)
  • Error handling created / updated & covered by the tests above
  • Documentation updated
    • Only Public APIs are allowed to be used in documentation/tutorials/sample code
  • (Optional) Aligned changes with the JS/TS and Java SDK
  • (Optional) Release notes updated -->

@yamaceay yamaceay changed the title PoC: major release on HTTPX2 migration feat: major release on HTTPX2 migration Sep 21, 2026
@yamaceay
yamaceay force-pushed the poc/httpx2-major branch 4 times, most recently from 560ab04 to 96ae5c6 Compare September 21, 2026 16:08
@yamaceay yamaceay mentioned this pull request Sep 21, 2026
5 tasks
@yamaceay yamaceay added duplicate This issue or pull request already exists dependencies Pull requests that update a dependency file python:uv Pull requests that update python:uv code labels Sep 21, 2026
@yamaceay
yamaceay force-pushed the poc/httpx2-major branch 2 times, most recently from 0884456 to 536fa3f Compare September 22, 2026 12:14
@yamaceay

Copy link
Copy Markdown
Contributor Author

The script that was used to migrate to HTTPX2 is attached below
poc1.sh

@yamaceay yamaceay removed don't merge duplicate This issue or pull request already exists labels Sep 23, 2026

@alpkom alpkom 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.

Since we're already touching user interface (even though minimal), let's get rid of any reference to httpx/httpx2 from user facing functions/initializers, so that we don't need breaking changes later on.

message: str,
status_code: int,
headers: httpx.Headers,
headers: httpx2.Headers,

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.

Since we're already changing the user facing type, let's change it to simple dict, in order to avoid disclosing implementation details to users and to avoid breaking changes in the future.

Comment on lines +69 to +70
:param timeout: Default HTTP request timeout passed to httpx2.
:type timeout: Union[int, float, httpx2.Timeout], Optional

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.

Let's not refer to httpx2 at all, and don't accept httpx2.Timeout as type.

proxy_client: Optional[GenAIHubProxyClient] = None,
resource_group: Optional[str] = None,
timeout: Union[int, float, httpx.Timeout, None] = None,
timeout: Union[int, float, httpx2.Timeout, None] = None,

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.

Let's not accept httpx2.Timeout as type at all

provider: str,
model: str,
timeout: Union[int, float, httpx.Timeout, None] = None,
timeout: Union[int, float, httpx2.Timeout, None] = None,

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.

Let's not accept httpx2.Timeout as type at all

:type model: str
:param timeout: Per-request timeout override.
:type timeout: Union[int, float, httpx.Timeout], Optional
:type timeout: Union[int, float, httpx2.Timeout], Optional

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.

Let's not accept httpx2.Timeout as type at all

model_name: Optional[str] = None,
model_version: Optional[str] = None,
timeout: Union[int, float, httpx.Timeout, None] = None,
timeout: Union[int, float, httpx2.Timeout, None] = None,

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.

Let's not accept httpx2.Timeout as type at all

Comment on lines +273 to +274
Can be an integer, float, or an instance of `httpx2.Timeout`.
:type timeout: Union[int, float, httpx2.Timeout, None]

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.

Let's not accept httpx2.Timeout as type at all

Comment on lines +1 to +15
"""
Shared SSL context factory for httpx2 clients.

httpx2 defaults to the OS trust store (truststore). This module preserves
the pre-migration behaviour of using certifi's CA bundle so existing
deployments are not affected. Switch callers to verify=True to adopt the
httpx2 default when ready.
"""
import ssl
import certifi


def default_ssl_context() -> ssl.SSLContext:
"""Return an SSL context backed by certifi's CA bundle."""
return ssl.create_default_context(cafile=certifi.where())

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.

Have you checked if setting this default SSL Context is needed for our use case? Do the tests fail if this is not defined, and default of httpx2 is used instead?

dependencies = [
"httpx>=0.27.0",
"httpx2>=2.0.0",
"certifi",

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.

Let's specify a version here. (not ==, but >=)

"pylint==4.0.8",
"requests-mock==1.12.1",
"respx==0.23.1",
"httpx2-pytest",

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.

Let's specify a version here

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Pull requests that update a dependency file python:uv Pull requests that update python:uv code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants