httpcore2 2.9.1__tar.gz → 2.10.0__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. {httpcore2-2.9.1 → httpcore2-2.10.0}/CHANGELOG.md +15 -0
  2. {httpcore2-2.9.1 → httpcore2-2.10.0}/PKG-INFO +41 -25
  3. {httpcore2-2.9.1 → httpcore2-2.10.0}/README.md +23 -23
  4. {httpcore2-2.9.1 → httpcore2-2.10.0}/httpcore2/_async/http2.py +7 -5
  5. {httpcore2-2.9.1 → httpcore2-2.10.0}/httpcore2/_async/socks_proxy.py +1 -1
  6. {httpcore2-2.9.1 → httpcore2-2.10.0}/httpcore2/_sync/http2.py +7 -5
  7. {httpcore2-2.9.1 → httpcore2-2.10.0}/httpcore2/_sync/socks_proxy.py +1 -1
  8. {httpcore2-2.9.1 → httpcore2-2.10.0}/pyproject.toml +3 -2
  9. {httpcore2-2.9.1 → httpcore2-2.10.0}/.gitignore +0 -0
  10. {httpcore2-2.9.1 → httpcore2-2.10.0}/LICENSE.md +0 -0
  11. {httpcore2-2.9.1 → httpcore2-2.10.0}/httpcore2/__init__.py +0 -0
  12. {httpcore2-2.9.1 → httpcore2-2.10.0}/httpcore2/_api.py +0 -0
  13. {httpcore2-2.9.1 → httpcore2-2.10.0}/httpcore2/_async/__init__.py +0 -0
  14. {httpcore2-2.9.1 → httpcore2-2.10.0}/httpcore2/_async/connection.py +0 -0
  15. {httpcore2-2.9.1 → httpcore2-2.10.0}/httpcore2/_async/connection_pool.py +0 -0
  16. {httpcore2-2.9.1 → httpcore2-2.10.0}/httpcore2/_async/http11.py +0 -0
  17. {httpcore2-2.9.1 → httpcore2-2.10.0}/httpcore2/_async/http_proxy.py +0 -0
  18. {httpcore2-2.9.1 → httpcore2-2.10.0}/httpcore2/_async/interfaces.py +0 -0
  19. {httpcore2-2.9.1 → httpcore2-2.10.0}/httpcore2/_backends/__init__.py +0 -0
  20. {httpcore2-2.9.1 → httpcore2-2.10.0}/httpcore2/_backends/anyio.py +0 -0
  21. {httpcore2-2.9.1 → httpcore2-2.10.0}/httpcore2/_backends/auto.py +0 -0
  22. {httpcore2-2.9.1 → httpcore2-2.10.0}/httpcore2/_backends/base.py +0 -0
  23. {httpcore2-2.9.1 → httpcore2-2.10.0}/httpcore2/_backends/mock.py +0 -0
  24. {httpcore2-2.9.1 → httpcore2-2.10.0}/httpcore2/_backends/sync.py +0 -0
  25. {httpcore2-2.9.1 → httpcore2-2.10.0}/httpcore2/_backends/trio.py +0 -0
  26. {httpcore2-2.9.1 → httpcore2-2.10.0}/httpcore2/_exceptions.py +0 -0
  27. {httpcore2-2.9.1 → httpcore2-2.10.0}/httpcore2/_models.py +0 -0
  28. {httpcore2-2.9.1 → httpcore2-2.10.0}/httpcore2/_ssl.py +0 -0
  29. {httpcore2-2.9.1 → httpcore2-2.10.0}/httpcore2/_sync/__init__.py +0 -0
  30. {httpcore2-2.9.1 → httpcore2-2.10.0}/httpcore2/_sync/connection.py +0 -0
  31. {httpcore2-2.9.1 → httpcore2-2.10.0}/httpcore2/_sync/connection_pool.py +0 -0
  32. {httpcore2-2.9.1 → httpcore2-2.10.0}/httpcore2/_sync/http11.py +0 -0
  33. {httpcore2-2.9.1 → httpcore2-2.10.0}/httpcore2/_sync/http_proxy.py +0 -0
  34. {httpcore2-2.9.1 → httpcore2-2.10.0}/httpcore2/_sync/interfaces.py +0 -0
  35. {httpcore2-2.9.1 → httpcore2-2.10.0}/httpcore2/_synchronization.py +0 -0
  36. {httpcore2-2.9.1 → httpcore2-2.10.0}/httpcore2/_trace.py +0 -0
  37. {httpcore2-2.9.1 → httpcore2-2.10.0}/httpcore2/_utils.py +0 -0
  38. {httpcore2-2.9.1 → httpcore2-2.10.0}/httpcore2/py.typed +0 -0
@@ -4,6 +4,21 @@ 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.10.0 (August 9th, 2026)
8
+
9
+ ### Added
10
+
11
+ * Add support for Python 3.15. ([#1090](https://github.com/pydantic/httpx2/pull/1090))
12
+
13
+ ### Changed
14
+
15
+ * Avoid quadratic copying when sending large HTTP/2 request bodies. ([#1127](https://github.com/pydantic/httpx2/pull/1127))
16
+
17
+ ### Fixed
18
+
19
+ * Propagate the original exception instead of raising `KeyError` when an HTTP/2 stream fails. ([#1093](https://github.com/pydantic/httpx2/pull/1093))
20
+ * Start TLS for the `wss` scheme in SOCKS5 proxy connections. ([#1104](https://github.com/pydantic/httpx2/pull/1104))
21
+
7
22
  ## 2.9.1 (July 24th, 2026)
8
23
 
9
24
  No changes since `2.9.0`. Version bumped to stay in lockstep with `httpx2`.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: httpcore2
3
- Version: 2.9.1
3
+ Version: 2.10.0
4
4
  Summary: A minimal low-level HTTP client.
5
5
  Project-URL: Changelog, https://github.com/pydantic/httpx2/blob/main/src/httpcore2/CHANGELOG.md
6
6
  Project-URL: Homepage, https://github.com/pydantic/httpx2
@@ -24,6 +24,7 @@ Classifier: Programming Language :: Python :: 3.11
24
24
  Classifier: Programming Language :: Python :: 3.12
25
25
  Classifier: Programming Language :: Python :: 3.13
26
26
  Classifier: Programming Language :: Python :: 3.14
27
+ Classifier: Programming Language :: Python :: 3.15
27
28
  Classifier: Topic :: Internet :: WWW/HTTP
28
29
  Requires-Python: >=3.10
29
30
  Requires-Dist: h11>=0.16
@@ -35,17 +36,17 @@ Requires-Dist: h2<5,>=3; extra == 'http2'
35
36
  Provides-Extra: socks
36
37
  Requires-Dist: socksio==1.*; extra == 'socks'
37
38
  Provides-Extra: trio
38
- Requires-Dist: trio<1.0,>=0.22.0; extra == 'trio'
39
+ Requires-Dist: trio<1.0,>=0.33.0; extra == 'trio'
39
40
  Description-Content-Type: text/markdown
40
41
 
41
- # HTTP Core
42
+ # HTTPCore 2
42
43
 
43
- [![Test Suite](https://github.com/encode/httpcore/workflows/Test%20Suite/badge.svg)](https://github.com/encode/httpcore/actions)
44
- [![Package version](https://badge.fury.io/py/httpcore.svg)](https://pypi.org/project/httpcore/)
44
+ [![Test Suite](https://github.com/pydantic/httpx2/workflows/Test%20Suite/badge.svg)](https://github.com/pydantic/httpx2/actions)
45
+ [![Package version](https://badge.fury.io/py/httpcore2.svg)](https://pypi.org/project/httpcore2/)
45
46
 
46
47
  > *Do one thing, and do it well.*
47
48
 
48
- The HTTP Core package provides a minimal low-level HTTP client, which does
49
+ The HTTPCore 2 package provides a minimal low-level HTTP client, which does
49
50
  one thing only. Sending HTTP requests.
50
51
 
51
52
  It does not provide any high level model abstractions over the API,
@@ -54,7 +55,7 @@ transparent HTTP caching, URL parsing, session cookie handling,
54
55
  content or charset decoding, handling JSON, environment based configuration
55
56
  defaults, or any of that Jazz.
56
57
 
57
- Some things HTTP Core does do:
58
+ Some things HTTPCore 2 does do:
58
59
 
59
60
  * Sending HTTP requests.
60
61
  * Thread-safe / task-safe connection pooling.
@@ -68,13 +69,13 @@ Some things HTTP Core does do:
68
69
  For HTTP/1.1 only support, install with:
69
70
 
70
71
  ```shell
71
- pip install httpcore
72
+ pip install httpcore2
72
73
  ```
73
74
 
74
75
  There are also a number of optional extras available...
75
76
 
76
77
  ```shell
77
- pip install httpcore['asyncio,trio,http2,socks']
78
+ pip install 'httpcore2[asyncio,trio,http2,socks]'
78
79
  ```
79
80
 
80
81
  ## Sending requests
@@ -82,9 +83,9 @@ pip install httpcore['asyncio,trio,http2,socks']
82
83
  Send an HTTP request:
83
84
 
84
85
  ```python
85
- import httpcore
86
+ import httpcore2
86
87
 
87
- response = httpcore.request("GET", "https://www.example.com/")
88
+ response = httpcore2.request("GET", "https://www.example.com/")
88
89
 
89
90
  print(response)
90
91
  # <Response [200]>
@@ -96,25 +97,25 @@ print(response.content)
96
97
  # b'<!doctype html>\n<html>\n<head>\n<title>Example Domain</title>\n\n<meta charset="utf-8"/>\n ...'
97
98
  ```
98
99
 
99
- The top-level `httpcore.request()` function is provided for convenience. In practice whenever you're working with `httpcore` you'll want to use the connection pooling functionality that it provides.
100
+ The top-level `httpcore2.request()` function is provided for convenience. In practice whenever you're working with `httpcore2` you'll want to use the connection pooling functionality that it provides.
100
101
 
101
102
  ```python
102
- import httpcore
103
+ import httpcore2
103
104
 
104
- http = httpcore.ConnectionPool()
105
+ http = httpcore2.ConnectionPool()
105
106
  response = http.request("GET", "https://www.example.com/")
106
107
  ```
107
108
 
108
- Once you're ready to get going, [head over to the documentation](https://www.encode.io/httpcore/).
109
+ Once you're ready to get going, [head over to the documentation](https://github.com/pydantic/httpx2/tree/main/src/httpcore2/docs).
109
110
 
110
111
  ## Motivation
111
112
 
112
- You *probably* don't want to be using HTTP Core directly. It might make sense if
113
+ You *probably* don't want to be using HTTPCore 2 directly. It might make sense if
113
114
  you're writing something like a proxy service in Python, and you just want
114
115
  something at the lowest possible level, but more typically you'll want to use
115
- a higher level client library, such as `httpx`.
116
+ a higher level client library, such as `httpx2`.
116
117
 
117
- The motivation for `httpcore` is:
118
+ The motivation for `httpcore2` is:
118
119
 
119
120
  * To provide a reusable low-level client library, that other packages can then build on top of.
120
121
  * To provide a *really clear interface split* between the networking code and client logic,
@@ -122,17 +123,17 @@ The motivation for `httpcore` is:
122
123
 
123
124
  ## Dependencies
124
125
 
125
- The `httpcore` package has the following dependencies...
126
+ The `httpcore2` package has the following dependencies...
126
127
 
127
128
  * `h11`
128
129
  * `truststore`
129
130
 
130
131
  And the following optional extras...
131
132
 
132
- * `anyio` - Required by `pip install httpcore['asyncio']`.
133
- * `trio` - Required by `pip install httpcore['trio']`.
134
- * `h2` - Required by `pip install httpcore['http2']`.
135
- * `socksio` - Required by `pip install httpcore['socks']`.
133
+ * `anyio` - Required by `pip install 'httpcore2[asyncio]'`.
134
+ * `trio` - Required by `pip install 'httpcore2[trio]'`.
135
+ * `h2` - Required by `pip install 'httpcore2[http2]'`.
136
+ * `socksio` - Required by `pip install 'httpcore2[socks]'`.
136
137
 
137
138
  ## Versioning
138
139
 
@@ -142,8 +143,8 @@ For changes between package versions please see our [project changelog](CHANGELO
142
143
 
143
144
  We recommend pinning your requirements either the most current major version, or a more specific version range:
144
145
 
145
- ```python
146
- pip install 'httpcore==1.*'
146
+ ```shell
147
+ pip install 'httpcore2==2.*'
147
148
  ```
148
149
  # Changelog
149
150
 
@@ -151,6 +152,21 @@ All notable changes to this project will be documented in this file.
151
152
 
152
153
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
153
154
 
155
+ ## 2.10.0 (August 9th, 2026)
156
+
157
+ ### Added
158
+
159
+ * Add support for Python 3.15. ([#1090](https://github.com/pydantic/httpx2/pull/1090))
160
+
161
+ ### Changed
162
+
163
+ * Avoid quadratic copying when sending large HTTP/2 request bodies. ([#1127](https://github.com/pydantic/httpx2/pull/1127))
164
+
165
+ ### Fixed
166
+
167
+ * Propagate the original exception instead of raising `KeyError` when an HTTP/2 stream fails. ([#1093](https://github.com/pydantic/httpx2/pull/1093))
168
+ * Start TLS for the `wss` scheme in SOCKS5 proxy connections. ([#1104](https://github.com/pydantic/httpx2/pull/1104))
169
+
154
170
  ## 2.9.1 (July 24th, 2026)
155
171
 
156
172
  No changes since `2.9.0`. Version bumped to stay in lockstep with `httpx2`.
@@ -1,11 +1,11 @@
1
- # HTTP Core
1
+ # HTTPCore 2
2
2
 
3
- [![Test Suite](https://github.com/encode/httpcore/workflows/Test%20Suite/badge.svg)](https://github.com/encode/httpcore/actions)
4
- [![Package version](https://badge.fury.io/py/httpcore.svg)](https://pypi.org/project/httpcore/)
3
+ [![Test Suite](https://github.com/pydantic/httpx2/workflows/Test%20Suite/badge.svg)](https://github.com/pydantic/httpx2/actions)
4
+ [![Package version](https://badge.fury.io/py/httpcore2.svg)](https://pypi.org/project/httpcore2/)
5
5
 
6
6
  > *Do one thing, and do it well.*
7
7
 
8
- The HTTP Core package provides a minimal low-level HTTP client, which does
8
+ The HTTPCore 2 package provides a minimal low-level HTTP client, which does
9
9
  one thing only. Sending HTTP requests.
10
10
 
11
11
  It does not provide any high level model abstractions over the API,
@@ -14,7 +14,7 @@ transparent HTTP caching, URL parsing, session cookie handling,
14
14
  content or charset decoding, handling JSON, environment based configuration
15
15
  defaults, or any of that Jazz.
16
16
 
17
- Some things HTTP Core does do:
17
+ Some things HTTPCore 2 does do:
18
18
 
19
19
  * Sending HTTP requests.
20
20
  * Thread-safe / task-safe connection pooling.
@@ -28,13 +28,13 @@ Some things HTTP Core does do:
28
28
  For HTTP/1.1 only support, install with:
29
29
 
30
30
  ```shell
31
- pip install httpcore
31
+ pip install httpcore2
32
32
  ```
33
33
 
34
34
  There are also a number of optional extras available...
35
35
 
36
36
  ```shell
37
- pip install httpcore['asyncio,trio,http2,socks']
37
+ pip install 'httpcore2[asyncio,trio,http2,socks]'
38
38
  ```
39
39
 
40
40
  ## Sending requests
@@ -42,9 +42,9 @@ pip install httpcore['asyncio,trio,http2,socks']
42
42
  Send an HTTP request:
43
43
 
44
44
  ```python
45
- import httpcore
45
+ import httpcore2
46
46
 
47
- response = httpcore.request("GET", "https://www.example.com/")
47
+ response = httpcore2.request("GET", "https://www.example.com/")
48
48
 
49
49
  print(response)
50
50
  # <Response [200]>
@@ -56,25 +56,25 @@ print(response.content)
56
56
  # b'<!doctype html>\n<html>\n<head>\n<title>Example Domain</title>\n\n<meta charset="utf-8"/>\n ...'
57
57
  ```
58
58
 
59
- The top-level `httpcore.request()` function is provided for convenience. In practice whenever you're working with `httpcore` you'll want to use the connection pooling functionality that it provides.
59
+ The top-level `httpcore2.request()` function is provided for convenience. In practice whenever you're working with `httpcore2` you'll want to use the connection pooling functionality that it provides.
60
60
 
61
61
  ```python
62
- import httpcore
62
+ import httpcore2
63
63
 
64
- http = httpcore.ConnectionPool()
64
+ http = httpcore2.ConnectionPool()
65
65
  response = http.request("GET", "https://www.example.com/")
66
66
  ```
67
67
 
68
- Once you're ready to get going, [head over to the documentation](https://www.encode.io/httpcore/).
68
+ Once you're ready to get going, [head over to the documentation](https://github.com/pydantic/httpx2/tree/main/src/httpcore2/docs).
69
69
 
70
70
  ## Motivation
71
71
 
72
- You *probably* don't want to be using HTTP Core directly. It might make sense if
72
+ You *probably* don't want to be using HTTPCore 2 directly. It might make sense if
73
73
  you're writing something like a proxy service in Python, and you just want
74
74
  something at the lowest possible level, but more typically you'll want to use
75
- a higher level client library, such as `httpx`.
75
+ a higher level client library, such as `httpx2`.
76
76
 
77
- The motivation for `httpcore` is:
77
+ The motivation for `httpcore2` is:
78
78
 
79
79
  * To provide a reusable low-level client library, that other packages can then build on top of.
80
80
  * To provide a *really clear interface split* between the networking code and client logic,
@@ -82,17 +82,17 @@ The motivation for `httpcore` is:
82
82
 
83
83
  ## Dependencies
84
84
 
85
- The `httpcore` package has the following dependencies...
85
+ The `httpcore2` package has the following dependencies...
86
86
 
87
87
  * `h11`
88
88
  * `truststore`
89
89
 
90
90
  And the following optional extras...
91
91
 
92
- * `anyio` - Required by `pip install httpcore['asyncio']`.
93
- * `trio` - Required by `pip install httpcore['trio']`.
94
- * `h2` - Required by `pip install httpcore['http2']`.
95
- * `socksio` - Required by `pip install httpcore['socks']`.
92
+ * `anyio` - Required by `pip install 'httpcore2[asyncio]'`.
93
+ * `trio` - Required by `pip install 'httpcore2[trio]'`.
94
+ * `h2` - Required by `pip install 'httpcore2[http2]'`.
95
+ * `socksio` - Required by `pip install 'httpcore2[socks]'`.
96
96
 
97
97
  ## Versioning
98
98
 
@@ -102,6 +102,6 @@ For changes between package versions please see our [project changelog](CHANGELO
102
102
 
103
103
  We recommend pinning your requirements either the most current major version, or a more specific version range:
104
104
 
105
- ```python
106
- pip install 'httpcore==1.*'
105
+ ```shell
106
+ pip install 'httpcore2==2.*'
107
107
  ```
@@ -246,10 +246,11 @@ class AsyncHTTP2Connection(AsyncConnectionInterface):
246
246
  """
247
247
  Send a single chunk of data in one or more data frames.
248
248
  """
249
- while data:
249
+ position = 0
250
+ while position < len(data):
250
251
  max_flow = await self._wait_for_outgoing_flow(request, stream_id)
251
- chunk_size = min(len(data), max_flow)
252
- chunk, data = data[:chunk_size], data[chunk_size:]
252
+ chunk = data[position : position + max_flow]
253
+ position += len(chunk)
253
254
  self._h2_state.send_data(stream_id, chunk)
254
255
  await self._write_outgoing_data(request)
255
256
 
@@ -373,9 +374,10 @@ class AsyncHTTP2Connection(AsyncConnectionInterface):
373
374
  self._max_streams -= 1
374
375
 
375
376
  async def _response_closed(self, stream_id: int) -> None:
376
- await self._max_streams_semaphore.release()
377
377
  async with self._state_lock:
378
- del self._events[stream_id]
378
+ if stream_id in self._events:
379
+ await self._max_streams_semaphore.release()
380
+ del self._events[stream_id]
379
381
  if self._connection_terminated and not self._events:
380
382
  await self.aclose()
381
383
 
@@ -240,7 +240,7 @@ class AsyncSocks5Connection(AsyncConnectionInterface):
240
240
  trace.return_value = stream
241
241
 
242
242
  # Upgrade the stream to SSL
243
- if self._remote_origin.scheme == b"https":
243
+ if self._remote_origin.scheme in (b"https", b"wss"):
244
244
  ssl_context = default_ssl_context() if self._ssl_context is None else self._ssl_context
245
245
  alpn_protocols = ["http/1.1", "h2"] if self._http2 else ["http/1.1"]
246
246
  ssl_context.set_alpn_protocols(alpn_protocols)
@@ -246,10 +246,11 @@ class HTTP2Connection(ConnectionInterface):
246
246
  """
247
247
  Send a single chunk of data in one or more data frames.
248
248
  """
249
- while data:
249
+ position = 0
250
+ while position < len(data):
250
251
  max_flow = self._wait_for_outgoing_flow(request, stream_id)
251
- chunk_size = min(len(data), max_flow)
252
- chunk, data = data[:chunk_size], data[chunk_size:]
252
+ chunk = data[position : position + max_flow]
253
+ position += len(chunk)
253
254
  self._h2_state.send_data(stream_id, chunk)
254
255
  self._write_outgoing_data(request)
255
256
 
@@ -373,9 +374,10 @@ class HTTP2Connection(ConnectionInterface):
373
374
  self._max_streams -= 1
374
375
 
375
376
  def _response_closed(self, stream_id: int) -> None:
376
- self._max_streams_semaphore.release()
377
377
  with self._state_lock:
378
- del self._events[stream_id]
378
+ if stream_id in self._events:
379
+ self._max_streams_semaphore.release()
380
+ del self._events[stream_id]
379
381
  if self._connection_terminated and not self._events:
380
382
  self.close()
381
383
 
@@ -240,7 +240,7 @@ class Socks5Connection(ConnectionInterface):
240
240
  trace.return_value = stream
241
241
 
242
242
  # Upgrade the stream to SSL
243
- if self._remote_origin.scheme == b"https":
243
+ if self._remote_origin.scheme in (b"https", b"wss"):
244
244
  ssl_context = default_ssl_context() if self._ssl_context is None else self._ssl_context
245
245
  alpn_protocols = ["http/1.1", "h2"] if self._http2 else ["http/1.1"]
246
246
  ssl_context.set_alpn_protocols(alpn_protocols)
@@ -2,7 +2,7 @@
2
2
  requires = [
3
3
  "hatchling",
4
4
  "hatch-fancy-pypi-readme",
5
- "uv-dynamic-versioning>=0.8.0",
5
+ "uv-dynamic-versioning>=0.14.0",
6
6
  ]
7
7
  build-backend = "hatchling.build"
8
8
 
@@ -41,6 +41,7 @@ classifiers = [
41
41
  "Programming Language :: Python :: 3.12",
42
42
  "Programming Language :: Python :: 3.13",
43
43
  "Programming Language :: Python :: 3.14",
44
+ "Programming Language :: Python :: 3.15",
44
45
  "Topic :: Internet :: WWW/HTTP",
45
46
  ]
46
47
  dependencies = ["truststore>=0.10", "h11>=0.16"]
@@ -48,7 +49,7 @@ dependencies = ["truststore>=0.10", "h11>=0.16"]
48
49
  [project.optional-dependencies]
49
50
  http2 = ["h2>=3,<5"]
50
51
  socks = ["socksio==1.*"]
51
- trio = ["trio>=0.22.0,<1.0"]
52
+ trio = ["trio>=0.33.0,<1.0"]
52
53
  asyncio = ["anyio>=4.5.0,<5.0"]
53
54
 
54
55
  [project.urls]
File without changes
File without changes
File without changes
File without changes
File without changes