httpx2 2.9.0__tar.gz → 2.9.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. {httpx2-2.9.0 → httpx2-2.9.1}/CHANGELOG.md +6 -0
  2. {httpx2-2.9.0 → httpx2-2.9.1}/PKG-INFO +4 -4
  3. httpx2-2.9.1/httpx2/_alias.py +71 -0
  4. httpx2-2.9.0/httpx2/_alias.py +0 -58
  5. {httpx2-2.9.0 → httpx2-2.9.1}/.gitignore +0 -0
  6. {httpx2-2.9.0 → httpx2-2.9.1}/LICENSE.md +0 -0
  7. {httpx2-2.9.0 → httpx2-2.9.1}/README.md +0 -0
  8. {httpx2-2.9.0 → httpx2-2.9.1}/httpx2/__init__.py +0 -0
  9. {httpx2-2.9.0 → httpx2-2.9.1}/httpx2/__version__.py +0 -0
  10. {httpx2-2.9.0 → httpx2-2.9.1}/httpx2/_api.py +0 -0
  11. {httpx2-2.9.0 → httpx2-2.9.1}/httpx2/_auth.py +0 -0
  12. {httpx2-2.9.0 → httpx2-2.9.1}/httpx2/_client.py +0 -0
  13. {httpx2-2.9.0 → httpx2-2.9.1}/httpx2/_config.py +0 -0
  14. {httpx2-2.9.0 → httpx2-2.9.1}/httpx2/_content.py +0 -0
  15. {httpx2-2.9.0 → httpx2-2.9.1}/httpx2/_decoders.py +0 -0
  16. {httpx2-2.9.0 → httpx2-2.9.1}/httpx2/_exceptions.py +0 -0
  17. {httpx2-2.9.0 → httpx2-2.9.1}/httpx2/_main.py +0 -0
  18. {httpx2-2.9.0 → httpx2-2.9.1}/httpx2/_models.py +0 -0
  19. {httpx2-2.9.0 → httpx2-2.9.1}/httpx2/_multipart.py +0 -0
  20. {httpx2-2.9.0 → httpx2-2.9.1}/httpx2/_sse.py +0 -0
  21. {httpx2-2.9.0 → httpx2-2.9.1}/httpx2/_status_codes.py +0 -0
  22. {httpx2-2.9.0 → httpx2-2.9.1}/httpx2/_transports/__init__.py +0 -0
  23. {httpx2-2.9.0 → httpx2-2.9.1}/httpx2/_transports/asgi.py +0 -0
  24. {httpx2-2.9.0 → httpx2-2.9.1}/httpx2/_transports/base.py +0 -0
  25. {httpx2-2.9.0 → httpx2-2.9.1}/httpx2/_transports/default.py +0 -0
  26. {httpx2-2.9.0 → httpx2-2.9.1}/httpx2/_transports/mock.py +0 -0
  27. {httpx2-2.9.0 → httpx2-2.9.1}/httpx2/_transports/wsgi.py +0 -0
  28. {httpx2-2.9.0 → httpx2-2.9.1}/httpx2/_types.py +0 -0
  29. {httpx2-2.9.0 → httpx2-2.9.1}/httpx2/_urlparse.py +0 -0
  30. {httpx2-2.9.0 → httpx2-2.9.1}/httpx2/_urls.py +0 -0
  31. {httpx2-2.9.0 → httpx2-2.9.1}/httpx2/_utils.py +0 -0
  32. {httpx2-2.9.0 → httpx2-2.9.1}/httpx2/py.typed +0 -0
  33. {httpx2-2.9.0 → httpx2-2.9.1}/httpx2/websockets/__init__.py +0 -0
  34. {httpx2-2.9.0 → httpx2-2.9.1}/httpx2/websockets/_api.py +0 -0
  35. {httpx2-2.9.0 → httpx2-2.9.1}/httpx2/websockets/_exceptions.py +0 -0
  36. {httpx2-2.9.0 → httpx2-2.9.1}/httpx2/websockets/_ping.py +0 -0
  37. {httpx2-2.9.0 → httpx2-2.9.1}/httpx2/websockets/_transport.py +0 -0
  38. {httpx2-2.9.0 → httpx2-2.9.1}/pyproject.toml +0 -0
@@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file.
4
4
 
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
6
6
 
7
+ ## 2.9.1 (July 24th, 2026)
8
+
9
+ ### Fixed
10
+
11
+ * Alias `httpcore` imports to `httpcore2` in `alias_httpx()`. ([#1082](https://github.com/pydantic/httpx2/pull/1082))
12
+
7
13
  ## 2.9.0 (July 23rd, 2026)
8
14
 
9
15
  ### Added
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: httpx2
3
- Version: 2.9.0
3
+ Version: 2.9.1
4
4
  Summary: The next generation HTTP client.
5
5
  Project-URL: Changelog, https://github.com/pydantic/httpx2/blob/main/src/httpx2/CHANGELOG.md
6
6
  Project-URL: Homepage, https://github.com/pydantic/httpx2
@@ -26,7 +26,7 @@ Classifier: Programming Language :: Python :: 3.14
26
26
  Classifier: Topic :: Internet :: WWW/HTTP
27
27
  Requires-Python: >=3.10
28
28
  Requires-Dist: anyio>=4.10
29
- Requires-Dist: httpcore2==2.9.0
29
+ Requires-Dist: httpcore2==2.9.1
30
30
  Requires-Dist: idna>=3.18
31
31
  Requires-Dist: truststore>=0.10
32
32
  Requires-Dist: typing-extensions>=4.5.0; python_version < '3.13'
@@ -188,9 +188,9 @@ inspiration around the lower-level networking details.
188
188
 
189
189
  ## Release Information
190
190
 
191
- ### Added
191
+ ### Fixed
192
192
 
193
- * Add `alias_httpx()`, letting applications make `import httpx` resolve to `httpx2` process-wide. ([#1077](https://github.com/pydantic/httpx2/pull/1077))
193
+ * Alias `httpcore` imports to `httpcore2` in `alias_httpx()`. ([#1082](https://github.com/pydantic/httpx2/pull/1082))
194
194
 
195
195
 
196
196
  ---
@@ -0,0 +1,71 @@
1
+ from __future__ import annotations
2
+
3
+ import importlib
4
+ import importlib.abc
5
+ import importlib.machinery
6
+ import importlib.util
7
+ import sys
8
+ from collections.abc import Sequence
9
+ from types import ModuleType
10
+
11
+ __all__ = ["alias_httpx"]
12
+
13
+
14
+ class _AliasLoader(importlib.abc.Loader):
15
+ _original_spec: importlib.machinery.ModuleSpec | None
16
+
17
+ def __init__(self, real_name: str) -> None:
18
+ self._real_name = real_name
19
+
20
+ def create_module(self, spec: importlib.machinery.ModuleSpec) -> ModuleType:
21
+ module = importlib.import_module(self._real_name)
22
+ self._original_spec = module.__spec__
23
+ return module
24
+
25
+ def exec_module(self, module: ModuleType) -> None:
26
+ module.__spec__ = self._original_spec
27
+
28
+
29
+ class _AliasFinder(importlib.abc.MetaPathFinder):
30
+ def __init__(self, alias: str, real: str) -> None:
31
+ self._alias = alias
32
+ self._real = real
33
+
34
+ def find_spec(
35
+ self,
36
+ fullname: str,
37
+ path: Sequence[str] | None = None,
38
+ target: ModuleType | None = None,
39
+ ) -> importlib.machinery.ModuleSpec | None:
40
+ if fullname != self._alias and not fullname.startswith(self._alias + "."):
41
+ return None
42
+ real_name = self._real + fullname.removeprefix(self._alias)
43
+ if real_name not in sys.modules and importlib.util.find_spec(real_name) is None:
44
+ return None
45
+ return importlib.machinery.ModuleSpec(fullname, _AliasLoader(real_name))
46
+
47
+
48
+ def _alias(alias: str, module: ModuleType) -> None:
49
+ existing = sys.modules.get(alias)
50
+ if existing is not None and existing is not module:
51
+ raise RuntimeError(f"{alias} was already imported; call `alias_httpx()` before any `import {alias}`.")
52
+
53
+ if not any(isinstance(finder, _AliasFinder) and finder._alias == alias for finder in sys.meta_path):
54
+ sys.meta_path.insert(0, _AliasFinder(alias, module.__name__))
55
+ sys.modules[alias] = module
56
+
57
+
58
+ def alias_httpx() -> None:
59
+ """
60
+ Make `import httpx` resolve to `httpx2`, and `import httpcore` to `httpcore2`, process-wide.
61
+
62
+ Intended for applications migrating from `httpx`, so that dependencies still
63
+ importing `httpx` or `httpcore` share the `httpx2` classes. Libraries should never call this.
64
+
65
+ Must be called before anything imports `httpx` or `httpcore`. Calling it again is a no-op.
66
+ """
67
+ import httpcore2
68
+ import httpx2
69
+
70
+ _alias("httpx", httpx2)
71
+ _alias("httpcore", httpcore2)
@@ -1,58 +0,0 @@
1
- from __future__ import annotations
2
-
3
- import importlib
4
- import importlib.abc
5
- import importlib.machinery
6
- import importlib.util
7
- import sys
8
- from collections.abc import Sequence
9
- from types import ModuleType
10
-
11
- __all__ = ["alias_httpx"]
12
-
13
-
14
- class _AliasLoader(importlib.abc.Loader):
15
- _original_spec: importlib.machinery.ModuleSpec | None
16
-
17
- def create_module(self, spec: importlib.machinery.ModuleSpec) -> ModuleType:
18
- module = importlib.import_module("httpx2" + spec.name.removeprefix("httpx"))
19
- self._original_spec = module.__spec__
20
- return module
21
-
22
- def exec_module(self, module: ModuleType) -> None:
23
- module.__spec__ = self._original_spec
24
-
25
-
26
- class _AliasFinder(importlib.abc.MetaPathFinder):
27
- def find_spec(
28
- self,
29
- fullname: str,
30
- path: Sequence[str] | None = None,
31
- target: ModuleType | None = None,
32
- ) -> importlib.machinery.ModuleSpec | None:
33
- if fullname != "httpx" and not fullname.startswith("httpx."):
34
- return None
35
- real_name = "httpx2" + fullname.removeprefix("httpx")
36
- if real_name not in sys.modules and importlib.util.find_spec(real_name) is None:
37
- return None
38
- return importlib.machinery.ModuleSpec(fullname, _AliasLoader())
39
-
40
-
41
- def alias_httpx() -> None:
42
- """
43
- Make `import httpx` resolve to `httpx2`, process-wide.
44
-
45
- Intended for applications migrating from `httpx`, so that dependencies still
46
- importing `httpx` share the `httpx2` classes. Libraries should never call this.
47
-
48
- Must be called before anything imports `httpx`. Calling it again is a no-op.
49
- """
50
- import httpx2
51
-
52
- existing = sys.modules.get("httpx")
53
- if existing is not None and existing is not httpx2:
54
- raise RuntimeError("httpx was already imported; call `alias_httpx()` before any `import httpx`.")
55
-
56
- if not any(isinstance(finder, _AliasFinder) for finder in sys.meta_path):
57
- sys.meta_path.insert(0, _AliasFinder())
58
- sys.modules["httpx"] = httpx2
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes