@typespec/http-client-python 0.25.0 → 0.26.1

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 (26) hide show
  1. package/dist/emitter/http.d.ts.map +1 -1
  2. package/dist/emitter/http.js +9 -1
  3. package/dist/emitter/http.js.map +1 -1
  4. package/emitter/src/http.ts +9 -1
  5. package/emitter/temp/tsconfig.tsbuildinfo +1 -1
  6. package/eng/scripts/setup/__pycache__/package_manager.cpython-311.pyc +0 -0
  7. package/eng/scripts/setup/__pycache__/venvtools.cpython-311.pyc +0 -0
  8. package/generator/build/lib/pygen/codegen/models/operation.py +13 -1
  9. package/generator/build/lib/pygen/codegen/models/paging_operation.py +10 -0
  10. package/generator/build/lib/pygen/codegen/serializers/builder_serializer.py +38 -7
  11. package/generator/build/lib/pygen/codegen/serializers/general_serializer.py +5 -3
  12. package/generator/build/lib/pygen/codegen/templates/macros.jinja2 +54 -9
  13. package/generator/build/lib/pygen/codegen/templates/operation_tools.jinja2 +32 -1
  14. package/generator/build/lib/pygen/codegen/templates/packaging_templates/pyproject.toml.jinja2 +7 -3
  15. package/generator/component-detection-pip-report.json +4 -5
  16. package/generator/dist/pygen-0.1.0-py3-none-any.whl +0 -0
  17. package/generator/pygen/codegen/models/operation.py +13 -1
  18. package/generator/pygen/codegen/models/paging_operation.py +10 -0
  19. package/generator/pygen/codegen/serializers/builder_serializer.py +38 -7
  20. package/generator/pygen/codegen/serializers/general_serializer.py +5 -3
  21. package/generator/pygen/codegen/templates/macros.jinja2 +54 -9
  22. package/generator/pygen/codegen/templates/operation_tools.jinja2 +32 -1
  23. package/generator/pygen/codegen/templates/packaging_templates/pyproject.toml.jinja2 +7 -3
  24. package/generator/test/generic_mock_api_tests/asynctests/test_payload_pageable_async.py +7 -0
  25. package/generator/test/generic_mock_api_tests/test_payload_pageable.py +6 -0
  26. package/package.json +7 -7
@@ -1,4 +1,35 @@
1
- {% macro wrap_string(string, wrapstring, width=95) %}{{ string | replace("\\", "\\\\") | wordwrap(width=width, break_long_words=False, break_on_hyphens=False, wrapstring=wrapstring)}}{% endmacro %}
1
+ {% macro wrap_string(string, wrapstring, width=95) %}
2
+ {%- set normalized_string = string -%}
3
+ {# Normalize multi-line descriptions by collapsing internal newlines to spaces, but preserve special blocks #}
4
+ {# Skip normalization for pre-formatted content (strings starting with whitespace like code examples) #}
5
+ {%- if '\n* ' not in string and string == string.lstrip() -%}
6
+ {%- if '.. code-block::' in string -%}
7
+ {# Split at code block and only normalize the prose before it #}
8
+ {%- set parts = string.split('.. code-block::') -%}
9
+ {%- set prose = parts[0].rstrip() -%}
10
+ {%- set code_block = '.. code-block::' + parts[1:] | join('.. code-block::') -%}
11
+ {%- if '\n\n' not in prose -%}
12
+ {%- set normalized_lines = [] -%}
13
+ {%- for line in prose.split('\n') -%}
14
+ {%- set stripped = line.strip() -%}
15
+ {%- if stripped -%}
16
+ {%- set _ = normalized_lines.append(stripped) -%}
17
+ {%- endif -%}
18
+ {%- endfor -%}
19
+ {%- set normalized_string = normalized_lines | join(' ') + '\n\n' + code_block -%}
20
+ {%- endif -%}
21
+ {%- elif '\n\n' not in string -%}
22
+ {%- set normalized_lines = [] -%}
23
+ {%- for line in string.split('\n') -%}
24
+ {%- set stripped = line.strip() -%}
25
+ {%- if stripped -%}
26
+ {%- set _ = normalized_lines.append(stripped) -%}
27
+ {%- endif -%}
28
+ {%- endfor -%}
29
+ {%- set normalized_string = normalized_lines | join(' ') -%}
30
+ {%- endif -%}
31
+ {%- endif -%}
32
+ {{ normalized_string | replace("\\", "\\\\") | wordwrap(width=width, break_long_words=False, break_on_hyphens=False, wrapstring=wrapstring)}}{% endmacro %}
2
33
 
3
34
  {% macro description(builder, serializer) %}
4
35
  {% set example_template = serializer.example_template(builder) %}
@@ -109,13 +109,17 @@ exclude = [
109
109
  [tool.setuptools.package-data]
110
110
  pytyped = ["py.typed"]
111
111
  {% endif %}
112
- {% if KEEP_FIELDS and KEEP_FIELDS.get('tool.azure-sdk-build') %}
112
+ {% if KEEP_FIELDS %}
113
+ {% for field_key, field_val in KEEP_FIELDS.items() %}
114
+ {% if field_key.startswith('tool.azure-sdk') %}
113
115
 
114
- [tool.azure-sdk-build]
115
- {% for key, val in KEEP_FIELDS.get('tool.azure-sdk-build').items() %}
116
+ [{{ field_key }}]
117
+ {% for key, val in field_val.items() %}
116
118
  {{ key }} = {{ val|tojson }}
117
119
  {% endfor %}
118
120
  {% endif %}
121
+ {% endfor %}
122
+ {% endif %}
119
123
  {% if KEEP_FIELDS and KEEP_FIELDS.get('packaging') %}
120
124
 
121
125
  [packaging]
@@ -113,3 +113,10 @@ async def test_request_header_nested_response_body(client: PageableClient):
113
113
  async def test_list_without_continuation(client: PageableClient):
114
114
  result = [p async for p in client.page_size.list_without_continuation()]
115
115
  assert_result(result)
116
+
117
+
118
+ # after https://github.com/microsoft/typespec/pull/9455 released, we could enable this test again
119
+ # @pytest.mark.asyncio
120
+ # async def test_xml_pagination_list_with_next_link(client: PageableClient):
121
+ # result = [p async for p in client.xml_pagination.list_with_next_link()]
122
+ # assert_result(result)
@@ -81,3 +81,9 @@ def test_request_header_nested_response_body(client: PageableClient):
81
81
  def test_list_without_continuation(client: PageableClient):
82
82
  result = list(client.page_size.list_without_continuation())
83
83
  assert_result(result)
84
+
85
+
86
+ # # after https://github.com/microsoft/typespec/pull/9455 released, we could enable this test again
87
+ # def test_xml_pagination_list_with_next_link(client: PageableClient):
88
+ # result = list(client.xml_pagination.list_with_next_link())
89
+ # assert_result(result)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@typespec/http-client-python",
3
- "version": "0.25.0",
3
+ "version": "0.26.1",
4
4
  "author": "Microsoft Corporation",
5
5
  "description": "TypeSpec emitter for Python SDKs",
6
6
  "homepage": "https://typespec.io",
@@ -54,11 +54,11 @@
54
54
  "emitter"
55
55
  ],
56
56
  "peerDependencies": {
57
- "@azure-tools/typespec-autorest": ">=0.64.0 <1.0.0",
57
+ "@azure-tools/typespec-autorest": ">=0.64.1 <1.0.0",
58
58
  "@azure-tools/typespec-azure-core": ">=0.64.0 <1.0.0",
59
- "@azure-tools/typespec-azure-resource-manager": ">=0.64.0 <1.0.0",
59
+ "@azure-tools/typespec-azure-resource-manager": ">=0.64.1 <1.0.0",
60
60
  "@azure-tools/typespec-azure-rulesets": ">=0.64.0 <1.0.0",
61
- "@azure-tools/typespec-client-generator-core": ">=0.64.2 <1.0.0",
61
+ "@azure-tools/typespec-client-generator-core": ">=0.64.5 <1.0.0",
62
62
  "@typespec/compiler": "^1.8.0",
63
63
  "@typespec/http": "^1.8.0",
64
64
  "@typespec/openapi": "^1.8.0",
@@ -77,11 +77,11 @@
77
77
  "tsx": "~4.19.1"
78
78
  },
79
79
  "devDependencies": {
80
- "@azure-tools/typespec-autorest": "~0.64.0",
80
+ "@azure-tools/typespec-autorest": "~0.64.1",
81
81
  "@azure-tools/typespec-azure-core": "~0.64.0",
82
- "@azure-tools/typespec-azure-resource-manager": "~0.64.0",
82
+ "@azure-tools/typespec-azure-resource-manager": "~0.64.1",
83
83
  "@azure-tools/typespec-azure-rulesets": "~0.64.0",
84
- "@azure-tools/typespec-client-generator-core": "~0.64.2",
84
+ "@azure-tools/typespec-client-generator-core": "~0.64.5",
85
85
  "@azure-tools/azure-http-specs": "0.1.0-alpha.36",
86
86
  "@typespec/compiler": "^1.8.0",
87
87
  "@typespec/http": "^1.8.0",