reflectapi-runtime 0.18.0__tar.gz → 0.20.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. {reflectapi_runtime-0.18.0 → reflectapi_runtime-0.20.0}/PKG-INFO +23 -12
  2. {reflectapi_runtime-0.18.0 → reflectapi_runtime-0.20.0}/README.md +15 -8
  3. {reflectapi_runtime-0.18.0 → reflectapi_runtime-0.20.0}/pyproject.toml +8 -4
  4. {reflectapi_runtime-0.18.0 → reflectapi_runtime-0.20.0}/src/reflectapi_runtime/__init__.py +12 -3
  5. {reflectapi_runtime-0.18.0 → reflectapi_runtime-0.20.0}/src/reflectapi_runtime/client.py +220 -117
  6. {reflectapi_runtime-0.18.0 → reflectapi_runtime-0.20.0}/src/reflectapi_runtime/exceptions.py +10 -2
  7. {reflectapi_runtime-0.18.0 → reflectapi_runtime-0.20.0}/src/reflectapi_runtime/response.py +96 -3
  8. reflectapi_runtime-0.20.0/src/reflectapi_runtime/serde.py +141 -0
  9. {reflectapi_runtime-0.18.0 → reflectapi_runtime-0.20.0}/tests/test_client.py +136 -1
  10. reflectapi_runtime-0.20.0/tests/test_enum_forward_compatibility.py +129 -0
  11. {reflectapi_runtime-0.18.0 → reflectapi_runtime-0.20.0}/tests/test_sse.py +50 -1
  12. reflectapi_runtime-0.18.0/src/reflectapi_runtime/serde.py +0 -48
  13. {reflectapi_runtime-0.18.0 → reflectapi_runtime-0.20.0}/.gitignore +0 -0
  14. {reflectapi_runtime-0.18.0 → reflectapi_runtime-0.20.0}/src/reflectapi_runtime/auth.py +0 -0
  15. {reflectapi_runtime-0.18.0 → reflectapi_runtime-0.20.0}/src/reflectapi_runtime/batch.py +0 -0
  16. {reflectapi_runtime-0.18.0 → reflectapi_runtime-0.20.0}/src/reflectapi_runtime/duration.py +0 -0
  17. {reflectapi_runtime-0.18.0 → reflectapi_runtime-0.20.0}/src/reflectapi_runtime/hypothesis_strategies.py +0 -0
  18. {reflectapi_runtime-0.18.0 → reflectapi_runtime-0.20.0}/src/reflectapi_runtime/middleware.py +0 -0
  19. {reflectapi_runtime-0.18.0 → reflectapi_runtime-0.20.0}/src/reflectapi_runtime/partial.py +0 -0
  20. {reflectapi_runtime-0.18.0 → reflectapi_runtime-0.20.0}/src/reflectapi_runtime/sse.py +0 -0
  21. {reflectapi_runtime-0.18.0 → reflectapi_runtime-0.20.0}/src/reflectapi_runtime/streaming.py +0 -0
  22. {reflectapi_runtime-0.18.0 → reflectapi_runtime-0.20.0}/src/reflectapi_runtime/testing.py +0 -0
  23. {reflectapi_runtime-0.18.0 → reflectapi_runtime-0.20.0}/src/reflectapi_runtime/transport.py +0 -0
  24. {reflectapi_runtime-0.18.0 → reflectapi_runtime-0.20.0}/src/reflectapi_runtime/types.py +0 -0
  25. {reflectapi_runtime-0.18.0 → reflectapi_runtime-0.20.0}/tests/__init__.py +0 -0
  26. {reflectapi_runtime-0.18.0 → reflectapi_runtime-0.20.0}/tests/test_auth.py +0 -0
  27. {reflectapi_runtime-0.18.0 → reflectapi_runtime-0.20.0}/tests/test_auth_negative_cases.py +0 -0
  28. {reflectapi_runtime-0.18.0 → reflectapi_runtime-0.20.0}/tests/test_batch.py +0 -0
  29. {reflectapi_runtime-0.18.0 → reflectapi_runtime-0.20.0}/tests/test_codegen_regressions.py +0 -0
  30. {reflectapi_runtime-0.18.0 → reflectapi_runtime-0.20.0}/tests/test_edge_cases.py +0 -0
  31. {reflectapi_runtime-0.18.0 → reflectapi_runtime-0.20.0}/tests/test_enhanced_features.py +0 -0
  32. {reflectapi_runtime-0.18.0 → reflectapi_runtime-0.20.0}/tests/test_exceptions.py +0 -0
  33. {reflectapi_runtime-0.18.0 → reflectapi_runtime-0.20.0}/tests/test_middleware.py +0 -0
  34. {reflectapi_runtime-0.18.0 → reflectapi_runtime-0.20.0}/tests/test_partial.py +0 -0
  35. {reflectapi_runtime-0.18.0 → reflectapi_runtime-0.20.0}/tests/test_pydantic_serialization.py +0 -0
  36. {reflectapi_runtime-0.18.0 → reflectapi_runtime-0.20.0}/tests/test_response.py +0 -0
  37. {reflectapi_runtime-0.18.0 → reflectapi_runtime-0.20.0}/tests/test_streaming.py +0 -0
  38. {reflectapi_runtime-0.18.0 → reflectapi_runtime-0.20.0}/tests/test_testing.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: reflectapi-runtime
3
- Version: 0.18.0
3
+ Version: 0.20.0
4
4
  Summary: Runtime library for ReflectAPI Python clients
5
5
  Project-URL: Homepage, https://github.com/thepartly/reflectapi
6
6
  Project-URL: Repository, https://github.com/thepartly/reflectapi
@@ -19,9 +19,13 @@ Classifier: Topic :: Internet :: WWW/HTTP
19
19
  Classifier: Topic :: Software Development :: Libraries :: Python Modules
20
20
  Classifier: Typing :: Typed
21
21
  Requires-Python: >=3.12
22
- Requires-Dist: httpx>=0.25.0
23
- Requires-Dist: pydantic>=2.0.0
24
- Requires-Dist: typing-extensions>=4.4.0
22
+ Requires-Dist: anyio>=4.14.2
23
+ Requires-Dist: httpcore>=1.0.9
24
+ Requires-Dist: httpx>=0.25.2
25
+ Requires-Dist: idna>=3.15
26
+ Requires-Dist: pydantic>=2.10.0; python_version < '3.14'
27
+ Requires-Dist: pydantic>=2.12.0; python_version >= '3.14'
28
+ Requires-Dist: typing-extensions>=4.5.0
25
29
  Provides-Extra: dev
26
30
  Requires-Dist: hypothesis>=6.0.0; extra == 'dev'
27
31
  Requires-Dist: mypy>=1.5.0; extra == 'dev'
@@ -47,8 +51,12 @@ directly.
47
51
  - `ClientBase` / `AsyncClientBase` — base classes used by the generated
48
52
  `Client` / `AsyncClient`. They wrap `httpx` and handle request build-up,
49
53
  Pydantic-based response validation, and middleware.
50
- - `ApiResponse[T, E]` — typed wrapper around the response value, transport
51
- metadata, and the optional typed error.
54
+ - `ApiResponse[T, E, H]` — typed wrapper around the response value, transport
55
+ metadata, the optional typed error, and the API's declared response headers
56
+ (`.headers`).
57
+ - `ApiStream[T, H]` / `AsyncApiStream[T, H]` — iterators returned by streaming
58
+ methods, exposing the response's `metadata` and declared `headers` once
59
+ iteration starts.
52
60
  - `ApplicationError`, `NetworkError`, `TimeoutError`, `ValidationError` —
53
61
  exceptions raised by the generated methods on non-2xx, transport, and
54
62
  validation failures respectively.
@@ -77,12 +85,15 @@ against the declared item model. The wire format is Server-Sent Events
77
85
  do not enter the iterator. Breaking out of the loop or calling
78
86
  `stream.aclose()` releases the underlying HTTP connection.
79
87
 
80
- Validation is strict: an event whose payload doesn't match the item model
81
- (for example, an unknown discriminated-union variant added by a newer
82
- server) raises `ValidationError` mid-stream and the iterator terminates.
83
- Items received before the bad event are still delivered.
88
+ Events are validated against the generated model. Closed response enums reject
89
+ unfamiliar variants; enums declared with `#[reflectapi(open)]` retain them as
90
+ an unknown case with the tag and parsed JSON, and `#[serde(other)]` uses the
91
+ declared fallback. A malformed known variant raises `ValidationError`
92
+ mid-stream and terminates the iterator. Earlier items remain delivered.
84
93
 
85
94
  ## Compatibility
86
95
 
87
- Python 3.12+. The package targets the same `reflectapi` minor version as
88
- the schema you generate from; mismatches will surface at import time.
96
+ Python 3.12+. SDKs generated with ReflectAPI 0.20 require the 0.20 runtime.
97
+ Pydantic 2.10 or newer supports the generated generic models; Python 3.14
98
+ requires Pydantic 2.12 or newer. Installing the runtime resolves these requirements
99
+ and the supported HTTP dependencies automatically.
@@ -10,8 +10,12 @@ directly.
10
10
  - `ClientBase` / `AsyncClientBase` — base classes used by the generated
11
11
  `Client` / `AsyncClient`. They wrap `httpx` and handle request build-up,
12
12
  Pydantic-based response validation, and middleware.
13
- - `ApiResponse[T, E]` — typed wrapper around the response value, transport
14
- metadata, and the optional typed error.
13
+ - `ApiResponse[T, E, H]` — typed wrapper around the response value, transport
14
+ metadata, the optional typed error, and the API's declared response headers
15
+ (`.headers`).
16
+ - `ApiStream[T, H]` / `AsyncApiStream[T, H]` — iterators returned by streaming
17
+ methods, exposing the response's `metadata` and declared `headers` once
18
+ iteration starts.
15
19
  - `ApplicationError`, `NetworkError`, `TimeoutError`, `ValidationError` —
16
20
  exceptions raised by the generated methods on non-2xx, transport, and
17
21
  validation failures respectively.
@@ -40,12 +44,15 @@ against the declared item model. The wire format is Server-Sent Events
40
44
  do not enter the iterator. Breaking out of the loop or calling
41
45
  `stream.aclose()` releases the underlying HTTP connection.
42
46
 
43
- Validation is strict: an event whose payload doesn't match the item model
44
- (for example, an unknown discriminated-union variant added by a newer
45
- server) raises `ValidationError` mid-stream and the iterator terminates.
46
- Items received before the bad event are still delivered.
47
+ Events are validated against the generated model. Closed response enums reject
48
+ unfamiliar variants; enums declared with `#[reflectapi(open)]` retain them as
49
+ an unknown case with the tag and parsed JSON, and `#[serde(other)]` uses the
50
+ declared fallback. A malformed known variant raises `ValidationError`
51
+ mid-stream and terminates the iterator. Earlier items remain delivered.
47
52
 
48
53
  ## Compatibility
49
54
 
50
- Python 3.12+. The package targets the same `reflectapi` minor version as
51
- the schema you generate from; mismatches will surface at import time.
55
+ Python 3.12+. SDKs generated with ReflectAPI 0.20 require the 0.20 runtime.
56
+ Pydantic 2.10 or newer supports the generated generic models; Python 3.14
57
+ requires Pydantic 2.12 or newer. Installing the runtime resolves these requirements
58
+ and the supported HTTP dependencies automatically.
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "reflectapi-runtime"
7
- version = "0.18.0"
7
+ version = "0.20.0"
8
8
  description = "Runtime library for ReflectAPI Python clients"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.12"
@@ -26,9 +26,13 @@ classifiers = [
26
26
  "Typing :: Typed",
27
27
  ]
28
28
  dependencies = [
29
- "pydantic>=2.0.0",
30
- "httpx>=0.25.0",
31
- "typing-extensions>=4.4.0",
29
+ "pydantic>=2.10.0; python_version < '3.14'",
30
+ "pydantic>=2.12.0; python_version >= '3.14'",
31
+ "httpx>=0.25.2",
32
+ "httpcore>=1.0.9",
33
+ "anyio>=4.14.2",
34
+ "idna>=3.15",
35
+ "typing-extensions>=4.5.0",
32
36
  ]
33
37
 
34
38
  [project.optional-dependencies]
@@ -38,8 +38,13 @@ from .hypothesis_strategies import (
38
38
  )
39
39
  from .middleware import AsyncMiddleware
40
40
  from .partial import ReflectapiPartialModel
41
- from .response import ApiResponse, TransportMetadata
42
- from .serde import parse_externally_tagged, serialize_externally_tagged
41
+ from .response import ApiResponse, ApiStream, AsyncApiStream, TransportMetadata
42
+ from .serde import (
43
+ UnknownEnumValue,
44
+ classify_tagged_enum,
45
+ parse_externally_tagged,
46
+ serialize_externally_tagged,
47
+ )
43
48
  from .streaming import AsyncStreamingClient, StreamingResponse
44
49
  from .testing import (
45
50
  AsyncCassetteMiddleware,
@@ -50,7 +55,7 @@ from .testing import (
50
55
  )
51
56
  from .types import BatchResult, ReflectapiEmpty, ReflectapiInfallible
52
57
 
53
- __version__ = "0.18.0"
58
+ __version__ = "0.20.0"
54
59
 
55
60
  __all__ = [
56
61
  # Authentication
@@ -93,7 +98,11 @@ __all__ = [
93
98
  "ReflectapiPartialModel",
94
99
  "parse_externally_tagged",
95
100
  "serialize_externally_tagged",
101
+ "UnknownEnumValue",
102
+ "classify_tagged_enum",
96
103
  "StreamingResponse",
104
+ "ApiStream",
105
+ "AsyncApiStream",
97
106
  "TestClientMixin",
98
107
  "TimeoutError",
99
108
  "TransportMetadata",