@typespec/http-client-python 0.19.0 → 0.19.2
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.
- package/dist/emitter/http.js +8 -0
- package/dist/emitter/http.js.map +1 -1
- package/dist/emitter/utils.d.ts.map +1 -1
- package/dist/emitter/utils.js +4 -0
- package/dist/emitter/utils.js.map +1 -1
- package/emitter/src/http.ts +8 -0
- package/emitter/src/utils.ts +4 -0
- package/emitter/temp/tsconfig.tsbuildinfo +1 -1
- package/eng/scripts/ci/conf.py +57 -0
- package/eng/scripts/ci/regenerate.ts +3 -0
- package/eng/scripts/ci/run_sphinx_build.py +117 -0
- package/eng/scripts/setup/__pycache__/package_manager.cpython-311.pyc +0 -0
- package/eng/scripts/setup/__pycache__/venvtools.cpython-311.pyc +0 -0
- package/generator/build/lib/pygen/codegen/models/operation.py +3 -3
- package/generator/build/lib/pygen/codegen/serializers/builder_serializer.py +29 -12
- package/generator/build/lib/pygen/codegen/serializers/parameter_serializer.py +3 -1
- package/generator/build/lib/pygen/codegen/templates/macros.jinja2 +33 -2
- package/generator/build/lib/pygen/codegen/templates/packaging_templates/pyproject.toml.jinja2 +2 -0
- package/generator/component-detection-pip-report.json +6 -6
- package/generator/dist/pygen-0.1.0-py3-none-any.whl +0 -0
- package/generator/pygen/codegen/models/operation.py +3 -3
- package/generator/pygen/codegen/serializers/builder_serializer.py +29 -12
- package/generator/pygen/codegen/serializers/parameter_serializer.py +3 -1
- package/generator/pygen/codegen/templates/macros.jinja2 +33 -2
- package/generator/pygen/codegen/templates/packaging_templates/pyproject.toml.jinja2 +2 -0
- package/generator/test/azure/mock_api_tests/asynctests/test_azure_versioning_previewversion_async.py +53 -0
- package/generator/test/azure/mock_api_tests/test_azure_versioning_previewversion.py +50 -0
- package/generator/test/azure/requirements.txt +1 -0
- package/generator/test/azure/tox.ini +16 -8
- package/generator/test/dev_requirements.txt +4 -0
- package/generator/test/generic_mock_api_tests/asynctests/test_encode_bytes_async.py +1 -2
- package/generator/test/generic_mock_api_tests/asynctests/test_payload_pageable_async.py +1 -1
- package/generator/test/generic_mock_api_tests/asynctests/test_versioning_removed_async.py +16 -5
- package/generator/test/generic_mock_api_tests/test_encode_bytes.py +1 -2
- package/generator/test/generic_mock_api_tests/test_payload_pageable.py +1 -1
- package/generator/test/generic_mock_api_tests/test_typetest_scalar.py +5 -0
- package/generator/test/generic_mock_api_tests/test_versioning_removed.py +16 -5
- package/generator/test/unbranded/tox.ini +16 -8
- package/package.json +32 -32
- package/eng/scripts/setup/__pycache__/package_manager.cpython-39.pyc +0 -0
- package/eng/scripts/setup/__pycache__/venvtools.cpython-39.pyc +0 -0
|
@@ -30,6 +30,7 @@ azure-mgmt-core==1.6.0
|
|
|
30
30
|
-e ./generated/azure-resource-manager-operation-templates
|
|
31
31
|
-e ./generated/azure-resource-manager-resources
|
|
32
32
|
-e ./generated/azure-resource-manager-method-subscription-id
|
|
33
|
+
-e ./generated/azure-versioning-previewversion
|
|
33
34
|
-e ./generated/client-namespace
|
|
34
35
|
-e ./generated/azure-payload-pageable
|
|
35
36
|
-e ./generated/client-naming
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
[tox]
|
|
2
|
-
envlist=base, lint, mypy, pyright, apiview
|
|
2
|
+
envlist=base, lint, mypy, pyright, apiview, sphinx
|
|
3
3
|
skipsdist=True
|
|
4
4
|
|
|
5
5
|
[testenv:ci]
|
|
@@ -7,21 +7,22 @@ deps=
|
|
|
7
7
|
-r requirements.txt
|
|
8
8
|
commands =
|
|
9
9
|
# pytest
|
|
10
|
-
|
|
10
|
+
{[testenv:test]commands}
|
|
11
11
|
|
|
12
12
|
# pylint
|
|
13
|
-
|
|
14
|
-
python ../../../eng/scripts/ci/run_pylint.py -t azure -s "generated" {posargs}
|
|
13
|
+
{[testenv:lint]commands}
|
|
15
14
|
|
|
16
15
|
# mypy
|
|
17
|
-
|
|
16
|
+
{[testenv:mypy]commands}
|
|
18
17
|
|
|
19
18
|
# pyright
|
|
20
|
-
|
|
19
|
+
{[testenv:pyright]commands}
|
|
21
20
|
|
|
22
21
|
# apiview
|
|
23
|
-
|
|
24
|
-
|
|
22
|
+
{[testenv:apiview]commands}
|
|
23
|
+
|
|
24
|
+
# sphinx docstring validation
|
|
25
|
+
{[testenv:sphinx]commands}
|
|
25
26
|
|
|
26
27
|
[testenv:test]
|
|
27
28
|
deps=
|
|
@@ -54,3 +55,10 @@ deps=
|
|
|
54
55
|
commands =
|
|
55
56
|
pip install apiview-stub-generator==0.3.19 --index-url="https://pkgs.dev.azure.com/azure-sdk/public/_packaging/azure-sdk-for-python/pypi/simple/"
|
|
56
57
|
python ../../../eng/scripts/ci/run_apiview.py -t azure -s "generated" {posargs}
|
|
58
|
+
|
|
59
|
+
[testenv:sphinx]
|
|
60
|
+
basepython = python3.10
|
|
61
|
+
deps=
|
|
62
|
+
-r requirements.txt
|
|
63
|
+
commands =
|
|
64
|
+
python ../../../eng/scripts/ci/run_sphinx_build.py -t azure -s "generated" {posargs}
|
|
@@ -124,5 +124,4 @@ async def test_response_body(client: BytesClient, png_data: bytes):
|
|
|
124
124
|
assert expected == await client.response_body.base64()
|
|
125
125
|
assert b"".join([d async for d in (await client.response_body.octet_stream())]) == png_data
|
|
126
126
|
assert b"".join([d async for d in (await client.response_body.custom_content_type())]) == png_data
|
|
127
|
-
|
|
128
|
-
# assert expected == await client.response_body.base64_url()
|
|
127
|
+
assert expected == await client.response_body.base64_url()
|
|
@@ -111,5 +111,5 @@ async def test_request_header_nested_response_body(client: PageableClient):
|
|
|
111
111
|
|
|
112
112
|
@pytest.mark.asyncio
|
|
113
113
|
async def test_list_without_continuation(client: PageableClient):
|
|
114
|
-
result = [p async for p in client.list_without_continuation()]
|
|
114
|
+
result = [p async for p in client.page_size.list_without_continuation()]
|
|
115
115
|
assert_result(result)
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
# --------------------------------------------------------------------------
|
|
6
6
|
import pytest
|
|
7
7
|
from versioning.removed.aio import RemovedClient
|
|
8
|
-
from versioning.removed.models import ModelV2, EnumV2
|
|
8
|
+
from versioning.removed.models import ModelV2, EnumV2, ModelV3, EnumV3
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
@pytest.fixture
|
|
@@ -22,7 +22,18 @@ async def test_v2(client: RemovedClient):
|
|
|
22
22
|
|
|
23
23
|
|
|
24
24
|
@pytest.mark.asyncio
|
|
25
|
-
async def test_model_v3(
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
25
|
+
async def test_model_v3():
|
|
26
|
+
async with RemovedClient(endpoint="http://localhost:3000", version="v1") as client1:
|
|
27
|
+
model1 = ModelV3(id="123", enum_prop=EnumV3.ENUM_MEMBER_V1)
|
|
28
|
+
result = await client1.model_v3(model1)
|
|
29
|
+
assert result == model1
|
|
30
|
+
|
|
31
|
+
async with RemovedClient(endpoint="http://localhost:3000", version="v2preview") as client2:
|
|
32
|
+
model2 = ModelV3(id="123")
|
|
33
|
+
result = await client2.model_v3(model2)
|
|
34
|
+
assert result == model2
|
|
35
|
+
|
|
36
|
+
async with RemovedClient(endpoint="http://localhost:3000", version="v2") as client3:
|
|
37
|
+
model3 = ModelV3(id="123", enum_prop=EnumV3.ENUM_MEMBER_V1)
|
|
38
|
+
result = await client3.model_v3(model3)
|
|
39
|
+
assert result == model3
|
|
@@ -119,5 +119,4 @@ def test_response_body(client: BytesClient, png_data: bytes):
|
|
|
119
119
|
assert expected == client.response_body.base64()
|
|
120
120
|
assert b"".join(client.response_body.octet_stream()) == png_data
|
|
121
121
|
assert b"".join(client.response_body.custom_content_type()) == png_data
|
|
122
|
-
|
|
123
|
-
# assert expected == client.response_body.base64_url()
|
|
122
|
+
assert expected == client.response_body.base64_url()
|
|
@@ -79,5 +79,5 @@ def test_request_header_nested_response_body(client: PageableClient):
|
|
|
79
79
|
|
|
80
80
|
|
|
81
81
|
def test_list_without_continuation(client: PageableClient):
|
|
82
|
-
result = list(client.list_without_continuation())
|
|
82
|
+
result = list(client.page_size.list_without_continuation())
|
|
83
83
|
assert_result(result)
|
|
@@ -51,3 +51,8 @@ def test_decimal128_verify(client: ScalarClient):
|
|
|
51
51
|
def test_decimal_verify(client: ScalarClient):
|
|
52
52
|
prepare = client.decimal_verify.prepare_verify()
|
|
53
53
|
client.decimal_verify.verify(reduce(lambda x, y: x + y, prepare))
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
# open this test case after adopt new version of http-specs for https://github.com/microsoft/typespec/pull/8807
|
|
57
|
+
# def test_constant_query(client: ScalarClient):
|
|
58
|
+
# client.constant_query.post()
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
# --------------------------------------------------------------------------
|
|
6
6
|
import pytest
|
|
7
7
|
from versioning.removed import RemovedClient
|
|
8
|
-
from versioning.removed.models import ModelV2, EnumV2
|
|
8
|
+
from versioning.removed.models import ModelV2, EnumV2, ModelV3, EnumV3
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
@pytest.fixture
|
|
@@ -20,7 +20,18 @@ def test_v2(client: RemovedClient):
|
|
|
20
20
|
)
|
|
21
21
|
|
|
22
22
|
|
|
23
|
-
def test_model_v3(
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
23
|
+
def test_model_v3():
|
|
24
|
+
client1 = RemovedClient(endpoint="http://localhost:3000", version="v1")
|
|
25
|
+
model1 = ModelV3(id="123", enum_prop=EnumV3.ENUM_MEMBER_V1)
|
|
26
|
+
result = client1.model_v3(model1)
|
|
27
|
+
assert result == model1
|
|
28
|
+
|
|
29
|
+
client2 = RemovedClient(endpoint="http://localhost:3000", version="v2preview")
|
|
30
|
+
model2 = ModelV3(id="123")
|
|
31
|
+
result = client2.model_v3(model2)
|
|
32
|
+
assert result == model2
|
|
33
|
+
|
|
34
|
+
client3 = RemovedClient(endpoint="http://localhost:3000", version="v2")
|
|
35
|
+
model3 = ModelV3(id="123", enum_prop=EnumV3.ENUM_MEMBER_V1)
|
|
36
|
+
result = client3.model_v3(model3)
|
|
37
|
+
assert result == model3
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
[tox]
|
|
2
|
-
envlist=base, lint, mypy, pyright, apiview
|
|
2
|
+
envlist=base, lint, mypy, pyright, apiview, sphinx
|
|
3
3
|
skipsdist=True
|
|
4
4
|
|
|
5
5
|
[testenv:ci]
|
|
@@ -7,21 +7,22 @@ deps=
|
|
|
7
7
|
-r requirements.txt
|
|
8
8
|
commands =
|
|
9
9
|
# pytest
|
|
10
|
-
|
|
10
|
+
{[testenv:test]commands}
|
|
11
11
|
|
|
12
12
|
# pylint
|
|
13
|
-
|
|
14
|
-
python ../../../eng/scripts/ci/run_pylint.py -t unbranded -s "generated" {posargs}
|
|
13
|
+
{[testenv:lint]commands}
|
|
15
14
|
|
|
16
15
|
# mypy
|
|
17
|
-
|
|
16
|
+
{[testenv:mypy]commands}
|
|
18
17
|
|
|
19
18
|
# pyright
|
|
20
|
-
|
|
19
|
+
{[testenv:pyright]commands}
|
|
21
20
|
|
|
22
21
|
# apiview
|
|
23
|
-
|
|
24
|
-
|
|
22
|
+
{[testenv:apiview]commands}
|
|
23
|
+
|
|
24
|
+
# sphinx docstring validation
|
|
25
|
+
{[testenv:sphinx]commands}
|
|
25
26
|
|
|
26
27
|
[testenv:test]
|
|
27
28
|
deps=
|
|
@@ -54,3 +55,10 @@ deps=
|
|
|
54
55
|
commands =
|
|
55
56
|
pip install apiview-stub-generator==0.3.19 --index-url="https://pkgs.dev.azure.com/azure-sdk/public/_packaging/azure-sdk-for-python/pypi/simple/"
|
|
56
57
|
python ../../../eng/scripts/ci/run_apiview.py -t unbranded -s "generated" {posargs}
|
|
58
|
+
|
|
59
|
+
[testenv:sphinx]
|
|
60
|
+
basepython = python3.10
|
|
61
|
+
deps=
|
|
62
|
+
-r requirements.txt
|
|
63
|
+
commands =
|
|
64
|
+
python ../../../eng/scripts/ci/run_sphinx_build.py -t unbranded -s "generated" {posargs}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@typespec/http-client-python",
|
|
3
|
-
"version": "0.19.
|
|
3
|
+
"version": "0.19.2",
|
|
4
4
|
"author": "Microsoft Corporation",
|
|
5
5
|
"description": "TypeSpec emitter for Python SDKs",
|
|
6
6
|
"homepage": "https://typespec.io",
|
|
@@ -54,20 +54,20 @@
|
|
|
54
54
|
"emitter"
|
|
55
55
|
],
|
|
56
56
|
"peerDependencies": {
|
|
57
|
-
"@azure-tools/typespec-autorest": ">=0.
|
|
58
|
-
"@azure-tools/typespec-azure-core": ">=0.
|
|
59
|
-
"@azure-tools/typespec-azure-resource-manager": ">=0.
|
|
60
|
-
"@azure-tools/typespec-azure-rulesets": ">=0.
|
|
61
|
-
"@azure-tools/typespec-client-generator-core": ">=0.
|
|
62
|
-
"@typespec/compiler": "^1.
|
|
63
|
-
"@typespec/http": "^1.
|
|
64
|
-
"@typespec/openapi": "^1.
|
|
65
|
-
"@typespec/rest": ">=0.
|
|
66
|
-
"@typespec/versioning": ">=0.
|
|
67
|
-
"@typespec/events": ">=0.
|
|
68
|
-
"@typespec/sse": ">=0.
|
|
69
|
-
"@typespec/streams": ">=0.
|
|
70
|
-
"@typespec/xml": ">=0.
|
|
57
|
+
"@azure-tools/typespec-autorest": ">=0.61.0 <1.0.0",
|
|
58
|
+
"@azure-tools/typespec-azure-core": ">=0.61.0 <1.0.0",
|
|
59
|
+
"@azure-tools/typespec-azure-resource-manager": ">=0.61.0 <1.0.0",
|
|
60
|
+
"@azure-tools/typespec-azure-rulesets": ">=0.61.0 <1.0.0",
|
|
61
|
+
"@azure-tools/typespec-client-generator-core": ">=0.61.0 <1.0.0",
|
|
62
|
+
"@typespec/compiler": "^1.5.0",
|
|
63
|
+
"@typespec/http": "^1.5.0",
|
|
64
|
+
"@typespec/openapi": "^1.5.0",
|
|
65
|
+
"@typespec/rest": ">=0.75.0 <1.0.0",
|
|
66
|
+
"@typespec/versioning": ">=0.75.0 <1.0.0",
|
|
67
|
+
"@typespec/events": ">=0.75.0 <1.0.0",
|
|
68
|
+
"@typespec/sse": ">=0.75.0 <1.0.0",
|
|
69
|
+
"@typespec/streams": ">=0.75.0 <1.0.0",
|
|
70
|
+
"@typespec/xml": ">=0.75.0 <1.0.0"
|
|
71
71
|
},
|
|
72
72
|
"dependencies": {
|
|
73
73
|
"js-yaml": "~4.1.0",
|
|
@@ -77,24 +77,24 @@
|
|
|
77
77
|
"tsx": "~4.19.1"
|
|
78
78
|
},
|
|
79
79
|
"devDependencies": {
|
|
80
|
-
"@azure-tools/typespec-autorest": "~0.
|
|
81
|
-
"@azure-tools/typespec-azure-core": "~0.
|
|
82
|
-
"@azure-tools/typespec-azure-resource-manager": "~0.
|
|
83
|
-
"@azure-tools/typespec-azure-rulesets": "~0.
|
|
84
|
-
"@azure-tools/typespec-client-generator-core": "~0.
|
|
85
|
-
"@azure-tools/azure-http-specs": "0.1.0-alpha.
|
|
86
|
-
"@typespec/compiler": "^1.
|
|
87
|
-
"@typespec/http": "^1.
|
|
88
|
-
"@typespec/openapi": "^1.
|
|
89
|
-
"@typespec/rest": "~0.
|
|
90
|
-
"@typespec/versioning": "~0.
|
|
91
|
-
"@typespec/events": "~0.
|
|
92
|
-
"@typespec/spector": "0.1.0-alpha.
|
|
80
|
+
"@azure-tools/typespec-autorest": "~0.61.0",
|
|
81
|
+
"@azure-tools/typespec-azure-core": "~0.61.0",
|
|
82
|
+
"@azure-tools/typespec-azure-resource-manager": "~0.61.0",
|
|
83
|
+
"@azure-tools/typespec-azure-rulesets": "~0.61.0",
|
|
84
|
+
"@azure-tools/typespec-client-generator-core": "~0.61.0",
|
|
85
|
+
"@azure-tools/azure-http-specs": "0.1.0-alpha.31",
|
|
86
|
+
"@typespec/compiler": "^1.5.0",
|
|
87
|
+
"@typespec/http": "^1.5.0",
|
|
88
|
+
"@typespec/openapi": "^1.5.0",
|
|
89
|
+
"@typespec/rest": "~0.75.0",
|
|
90
|
+
"@typespec/versioning": "~0.75.0",
|
|
91
|
+
"@typespec/events": "~0.75.0",
|
|
92
|
+
"@typespec/spector": "0.1.0-alpha.19",
|
|
93
93
|
"@typespec/spec-api": "0.1.0-alpha.9",
|
|
94
|
-
"@typespec/sse": "~0.
|
|
95
|
-
"@typespec/streams": "~0.
|
|
96
|
-
"@typespec/xml": "~0.
|
|
97
|
-
"@typespec/http-specs": "0.1.0-alpha.
|
|
94
|
+
"@typespec/sse": "~0.75.0",
|
|
95
|
+
"@typespec/streams": "~0.75.0",
|
|
96
|
+
"@typespec/xml": "~0.75.0",
|
|
97
|
+
"@typespec/http-specs": "0.1.0-alpha.27",
|
|
98
98
|
"@types/js-yaml": "~4.0.5",
|
|
99
99
|
"@types/node": "~24.1.0",
|
|
100
100
|
"@types/semver": "7.5.8",
|
|
Binary file
|
|
Binary file
|