Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions .changeset/switch_from_httpx_to_httpx2.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
default: major
---

# Switch from httpx to httpx2

For better or worse, httpx has not been actively maintained and hasn't seen a stable release in years. The Pydantic
org forked this into httpx and took over maintenance. The fork maintains API compatibility with the latest stable httpx
releast 0.28.1.

Hypothetically httpx might see a 1.0 release at some point, I am not sure about the plans for that, even that doesn't
seem to be seeing much activity. Given the potential sensitivity of the generated clients, switching to a more-actively
maintained HTTP client library, including its switch to defaulting to the hopefully-better-updated system certificate
store, given recent issues with web PKI, is prudent.

This generates all usages of httpx2 with `import httpx2 as httpx` rather than importing directly and changing all of
the use sites. This method is endorsed by the httpx2 migration guide and keeps things simpler and does not change any
of the existing API. The primary way this could break usage is for consumers that rely on this package bringing in
httpx as a dependency.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from unittest.mock import MagicMock

import httpx
import httpx2 as httpx

from end_to_end_tests.functional_tests.helpers import (
with_generated_client_fixture,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import ssl
from typing import Any, Self

import httpx
import httpx2 as httpx
from attrs import define, evolve, field


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ include = ["my_test_api_client/py.typed"]

[tool.poetry.dependencies]
python = "^3.11"
httpx = ">=0.23.1,<0.29.0"
httpx2 = ">=2.16.0,<3"
attrs = ">=22.2.0"

[build-system]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from http import HTTPStatus
from typing import Any

import httpx
import httpx2 as httpx

from ... import errors
from ...client import AuthenticatedClient, Client
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from http import HTTPStatus
from typing import Any, cast

import httpx
import httpx2 as httpx

from ... import errors
from ...client import AuthenticatedClient, Client
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from http import HTTPStatus
from typing import Any

import httpx
import httpx2 as httpx

from ... import errors
from ...client import AuthenticatedClient, Client
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from http import HTTPStatus
from typing import Any

import httpx
import httpx2 as httpx

from ... import errors
from ...client import AuthenticatedClient, Client
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from typing import Any
from urllib.parse import quote

import httpx
import httpx2 as httpx

from ... import errors
from ...client import AuthenticatedClient, Client
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import ssl
from typing import Any, Self

import httpx
import httpx2 as httpx
from attrs import define, evolve, field


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ include = ["escapes_client/py.typed"]

[tool.poetry.dependencies]
python = "^3.11"
httpx = ">=0.23.1,<0.29.0"
httpx2 = ">=2.16.0,<3"
attrs = ">=22.2.0"

[build-system]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from http import HTTPStatus
from typing import Any

import httpx
import httpx2 as httpx

from ... import errors
from ...client import AuthenticatedClient, Client
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from http import HTTPStatus
from typing import Any

import httpx
import httpx2 as httpx

from ... import errors
from ...client import AuthenticatedClient, Client
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from http import HTTPStatus
from typing import Any

import httpx
import httpx2 as httpx

from ... import errors
from ...client import AuthenticatedClient, Client
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from http import HTTPStatus
from typing import Any

import httpx
import httpx2 as httpx

from ... import errors
from ...client import AuthenticatedClient, Client
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import ssl
from typing import Any, Self

import httpx
import httpx2 as httpx
from attrs import define, evolve, field


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ include = ["my_enum_api_client/py.typed"]

[tool.poetry.dependencies]
python = "^3.11"
httpx = ">=0.23.1,<0.29.0"
httpx2 = ">=2.16.0,<3"
attrs = ">=22.2.0"

[build-system]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from http import HTTPStatus
from typing import Any

import httpx
import httpx2 as httpx

from ... import errors
from ...client import AuthenticatedClient, Client
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from http import HTTPStatus
from typing import Any

import httpx
import httpx2 as httpx

from ... import errors
from ...client import AuthenticatedClient, Client
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from http import HTTPStatus
from typing import Any

import httpx
import httpx2 as httpx

from ... import errors
from ...client import AuthenticatedClient, Client
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from http import HTTPStatus
from typing import Any

import httpx
import httpx2 as httpx

from ... import errors
from ...client import AuthenticatedClient, Client
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from http import HTTPStatus
from typing import Any, cast

import httpx
import httpx2 as httpx

from ... import errors
from ...client import AuthenticatedClient, Client
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from http import HTTPStatus
from typing import Any

import httpx
import httpx2 as httpx

from ... import errors
from ...client import AuthenticatedClient, Client
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from http import HTTPStatus
from typing import Any

import httpx
import httpx2 as httpx

from ... import errors
from ...client import AuthenticatedClient, Client
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from http import HTTPStatus
from typing import Any

import httpx
import httpx2 as httpx

from ... import errors
from ...client import AuthenticatedClient, Client
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from http import HTTPStatus
from typing import Any

import httpx
import httpx2 as httpx

from ... import errors
from ...client import AuthenticatedClient, Client
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from http import HTTPStatus
from typing import Any

import httpx
import httpx2 as httpx

from ... import errors
from ...client import AuthenticatedClient, Client
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from http import HTTPStatus
from typing import Any

import httpx
import httpx2 as httpx

from ... import errors
from ...client import AuthenticatedClient, Client
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from http import HTTPStatus
from typing import Any

import httpx
import httpx2 as httpx

from ... import errors
from ...client import AuthenticatedClient, Client
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from http import HTTPStatus
from typing import Any

import httpx
import httpx2 as httpx

from ... import errors
from ...client import AuthenticatedClient, Client
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from http import HTTPStatus
from typing import Any

import httpx
import httpx2 as httpx

from ... import errors
from ...client import AuthenticatedClient, Client
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from http import HTTPStatus
from typing import Any

import httpx
import httpx2 as httpx

from ... import errors
from ...client import AuthenticatedClient, Client
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from http import HTTPStatus
from typing import Any

import httpx
import httpx2 as httpx

from ... import errors
from ...client import AuthenticatedClient, Client
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from typing import Any
from urllib.parse import quote

import httpx
import httpx2 as httpx

from ... import errors
from ...client import AuthenticatedClient, Client
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from http import HTTPStatus
from typing import Any

import httpx
import httpx2 as httpx

from ... import errors
from ...client import AuthenticatedClient, Client
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from http import HTTPStatus
from typing import Any

import httpx
import httpx2 as httpx

from ... import errors
from ...client import AuthenticatedClient, Client
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from typing import Any
from urllib.parse import quote

import httpx
import httpx2 as httpx

from ... import errors
from ...client import AuthenticatedClient, Client
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from typing import Any
from urllib.parse import quote

import httpx
import httpx2 as httpx

from ... import errors
from ...client import AuthenticatedClient, Client
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from typing import Any
from urllib.parse import quote

import httpx
import httpx2 as httpx

from ... import errors
from ...client import AuthenticatedClient, Client
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from typing import Any
from urllib.parse import quote

import httpx
import httpx2 as httpx

from ... import errors
from ...client import AuthenticatedClient, Client
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from typing import Any
from urllib.parse import quote

import httpx
import httpx2 as httpx

from ... import errors
from ...client import AuthenticatedClient, Client
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from http import HTTPStatus
from typing import Any

import httpx
import httpx2 as httpx

from ...client import AuthenticatedClient, Client
from ...types import Response
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from http import HTTPStatus
from typing import Any

import httpx
import httpx2 as httpx

from ... import errors
from ...client import AuthenticatedClient, Client
Expand Down
Loading
Loading