alt-stack-http-client-httpx 1.6.2__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.
- alt_stack_http_client_httpx-1.6.2/LICENSE +21 -0
- alt_stack_http_client_httpx-1.6.2/PKG-INFO +73 -0
- alt_stack_http_client_httpx-1.6.2/README.md +49 -0
- alt_stack_http_client_httpx-1.6.2/pyproject.toml +54 -0
- alt_stack_http_client_httpx-1.6.2/setup.cfg +4 -0
- alt_stack_http_client_httpx-1.6.2/src/alt_stack_http_client_httpx/__init__.py +779 -0
- alt_stack_http_client_httpx-1.6.2/src/alt_stack_http_client_httpx/py.typed +0 -0
- alt_stack_http_client_httpx-1.6.2/src/alt_stack_http_client_httpx.egg-info/PKG-INFO +73 -0
- alt_stack_http_client_httpx-1.6.2/src/alt_stack_http_client_httpx.egg-info/SOURCES.txt +11 -0
- alt_stack_http_client_httpx-1.6.2/src/alt_stack_http_client_httpx.egg-info/dependency_links.txt +1 -0
- alt_stack_http_client_httpx-1.6.2/src/alt_stack_http_client_httpx.egg-info/requires.txt +8 -0
- alt_stack_http_client_httpx-1.6.2/src/alt_stack_http_client_httpx.egg-info/top_level.txt +1 -0
- alt_stack_http_client_httpx-1.6.2/tests/test_client.py +521 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Anthony Altieri
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: alt-stack-http-client-httpx
|
|
3
|
+
Version: 1.6.2
|
|
4
|
+
Summary: Asyncio HTTP client for alt-stack generated Pydantic SDKs, backed by httpx
|
|
5
|
+
License-Expression: MIT
|
|
6
|
+
Project-URL: Homepage, https://github.com/anthonyaltieri/alt-stack
|
|
7
|
+
Project-URL: Repository, https://github.com/anthonyaltieri/alt-stack
|
|
8
|
+
Project-URL: Issues, https://github.com/anthonyaltieri/alt-stack/issues
|
|
9
|
+
Classifier: Programming Language :: Python :: 3
|
|
10
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
12
|
+
Classifier: Typing :: Typed
|
|
13
|
+
Requires-Python: >=3.11
|
|
14
|
+
Description-Content-Type: text/markdown
|
|
15
|
+
License-File: LICENSE
|
|
16
|
+
Requires-Dist: pydantic>=2.7.0
|
|
17
|
+
Requires-Dist: httpx>=0.27.0
|
|
18
|
+
Provides-Extra: dev
|
|
19
|
+
Requires-Dist: pyrefly>=1.0.0; extra == "dev"
|
|
20
|
+
Requires-Dist: pytest>=8.0.0; extra == "dev"
|
|
21
|
+
Requires-Dist: ruff>=0.6.0; extra == "dev"
|
|
22
|
+
Requires-Dist: ty>=0.0.78; extra == "dev"
|
|
23
|
+
Dynamic: license-file
|
|
24
|
+
|
|
25
|
+
# `alt-stack-http-client-httpx`
|
|
26
|
+
|
|
27
|
+
Asyncio HTTP client for Python SDKs generated by `alt-stack-openapi-pydantic`. It is the Python counterpart of `@alt-stack/http-client-core` and `@alt-stack/http-client-fetch`: request inputs are validated and encoded with the SDK's `Request` map, responses are validated with its `Response` map, and results come back as a small discriminated union.
|
|
28
|
+
|
|
29
|
+
## Install
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
python -m pip install alt-stack-http-client-httpx
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
Generated SDK modules import `alt_stack_http_client_httpx` at runtime, so SDK consumers install this package. The generator itself is a development-time dependency.
|
|
36
|
+
|
|
37
|
+
## Use a generated SDK
|
|
38
|
+
|
|
39
|
+
```python
|
|
40
|
+
from alt_stack_http_client_httpx import ApiFailure, ApiSuccess
|
|
41
|
+
|
|
42
|
+
from generated_types import GetUsersIdParams, HttpxApiClient, Request, Response
|
|
43
|
+
|
|
44
|
+
async with HttpxApiClient(
|
|
45
|
+
"https://api.example.com", request_map=Request, response_map=Response
|
|
46
|
+
) as client:
|
|
47
|
+
result = await client.get("/users/{id}", params=GetUsersIdParams(id="u_1"))
|
|
48
|
+
|
|
49
|
+
if isinstance(result, ApiSuccess):
|
|
50
|
+
result.body # User
|
|
51
|
+
elif isinstance(result, ApiFailure):
|
|
52
|
+
result.error # documented error model
|
|
53
|
+
else:
|
|
54
|
+
result.error # UnexpectedApiClientError
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
Importing `HttpxApiClient` from the generated module gives one typed method per route. Importing it from `alt_stack_http_client_httpx` accepts the same arguments and exposes the untyped `request(method, path, ...)` API with runtime validation.
|
|
58
|
+
|
|
59
|
+
## Bring your own transport
|
|
60
|
+
|
|
61
|
+
`BaseApiClient` sends through the `Transport` protocol, a single `async def send(request: HttpRequest) -> HttpResponse`. Implement it over any asyncio HTTP library and pass it to the generated `ApiClient(base_url, transport=..., request_map=Request, response_map=Response)`.
|
|
62
|
+
|
|
63
|
+
## Development
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
uv run --project packages/python-http-client-httpx --extra dev pytest packages/python-http-client-httpx/tests
|
|
67
|
+
uv run --project packages/python-http-client-httpx --extra dev ruff check packages/python-http-client-httpx
|
|
68
|
+
uv run --project packages/python-http-client-httpx --extra dev ty check packages/python-http-client-httpx
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## Documentation
|
|
72
|
+
|
|
73
|
+
- [Python/Pydantic API Documentation](../../apps/docs/docs/codegen/api/pydantic-openapi.md)
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# `alt-stack-http-client-httpx`
|
|
2
|
+
|
|
3
|
+
Asyncio HTTP client for Python SDKs generated by `alt-stack-openapi-pydantic`. It is the Python counterpart of `@alt-stack/http-client-core` and `@alt-stack/http-client-fetch`: request inputs are validated and encoded with the SDK's `Request` map, responses are validated with its `Response` map, and results come back as a small discriminated union.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
python -m pip install alt-stack-http-client-httpx
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Generated SDK modules import `alt_stack_http_client_httpx` at runtime, so SDK consumers install this package. The generator itself is a development-time dependency.
|
|
12
|
+
|
|
13
|
+
## Use a generated SDK
|
|
14
|
+
|
|
15
|
+
```python
|
|
16
|
+
from alt_stack_http_client_httpx import ApiFailure, ApiSuccess
|
|
17
|
+
|
|
18
|
+
from generated_types import GetUsersIdParams, HttpxApiClient, Request, Response
|
|
19
|
+
|
|
20
|
+
async with HttpxApiClient(
|
|
21
|
+
"https://api.example.com", request_map=Request, response_map=Response
|
|
22
|
+
) as client:
|
|
23
|
+
result = await client.get("/users/{id}", params=GetUsersIdParams(id="u_1"))
|
|
24
|
+
|
|
25
|
+
if isinstance(result, ApiSuccess):
|
|
26
|
+
result.body # User
|
|
27
|
+
elif isinstance(result, ApiFailure):
|
|
28
|
+
result.error # documented error model
|
|
29
|
+
else:
|
|
30
|
+
result.error # UnexpectedApiClientError
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
Importing `HttpxApiClient` from the generated module gives one typed method per route. Importing it from `alt_stack_http_client_httpx` accepts the same arguments and exposes the untyped `request(method, path, ...)` API with runtime validation.
|
|
34
|
+
|
|
35
|
+
## Bring your own transport
|
|
36
|
+
|
|
37
|
+
`BaseApiClient` sends through the `Transport` protocol, a single `async def send(request: HttpRequest) -> HttpResponse`. Implement it over any asyncio HTTP library and pass it to the generated `ApiClient(base_url, transport=..., request_map=Request, response_map=Response)`.
|
|
38
|
+
|
|
39
|
+
## Development
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
uv run --project packages/python-http-client-httpx --extra dev pytest packages/python-http-client-httpx/tests
|
|
43
|
+
uv run --project packages/python-http-client-httpx --extra dev ruff check packages/python-http-client-httpx
|
|
44
|
+
uv run --project packages/python-http-client-httpx --extra dev ty check packages/python-http-client-httpx
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## Documentation
|
|
48
|
+
|
|
49
|
+
- [Python/Pydantic API Documentation](../../apps/docs/docs/codegen/api/pydantic-openapi.md)
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "alt-stack-http-client-httpx"
|
|
3
|
+
version = "1.6.2"
|
|
4
|
+
description = "Asyncio HTTP client for alt-stack generated Pydantic SDKs, backed by httpx"
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
requires-python = ">=3.11"
|
|
7
|
+
license = "MIT"
|
|
8
|
+
license-files = ["LICENSE"]
|
|
9
|
+
classifiers = [
|
|
10
|
+
"Programming Language :: Python :: 3",
|
|
11
|
+
"Programming Language :: Python :: 3.11",
|
|
12
|
+
"Programming Language :: Python :: 3.12",
|
|
13
|
+
"Typing :: Typed",
|
|
14
|
+
]
|
|
15
|
+
dependencies = ["pydantic>=2.7.0", "httpx>=0.27.0"]
|
|
16
|
+
|
|
17
|
+
[project.urls]
|
|
18
|
+
Homepage = "https://github.com/anthonyaltieri/alt-stack"
|
|
19
|
+
Repository = "https://github.com/anthonyaltieri/alt-stack"
|
|
20
|
+
Issues = "https://github.com/anthonyaltieri/alt-stack/issues"
|
|
21
|
+
|
|
22
|
+
[project.optional-dependencies]
|
|
23
|
+
dev = [
|
|
24
|
+
"pyrefly>=1.0.0",
|
|
25
|
+
"pytest>=8.0.0",
|
|
26
|
+
"ruff>=0.6.0",
|
|
27
|
+
"ty>=0.0.78",
|
|
28
|
+
]
|
|
29
|
+
|
|
30
|
+
[build-system]
|
|
31
|
+
requires = ["setuptools>=68", "wheel"]
|
|
32
|
+
build-backend = "setuptools.build_meta"
|
|
33
|
+
|
|
34
|
+
[tool.setuptools]
|
|
35
|
+
package-dir = { "" = "src" }
|
|
36
|
+
include-package-data = true
|
|
37
|
+
|
|
38
|
+
[tool.setuptools.packages.find]
|
|
39
|
+
where = ["src"]
|
|
40
|
+
include = ["alt_stack_http_client_httpx*"]
|
|
41
|
+
|
|
42
|
+
[tool.setuptools.package-data]
|
|
43
|
+
"alt_stack_http_client_httpx" = ["py.typed"]
|
|
44
|
+
|
|
45
|
+
[tool.ruff]
|
|
46
|
+
line-length = 100
|
|
47
|
+
target-version = "py311"
|
|
48
|
+
|
|
49
|
+
[tool.ruff.lint]
|
|
50
|
+
select = ["E", "F", "I"]
|
|
51
|
+
|
|
52
|
+
[tool.ruff.format]
|
|
53
|
+
quote-style = "double"
|
|
54
|
+
indent-style = "space"
|