@typespec/http-client-python 0.8.1 → 0.8.3-dev.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 (114) hide show
  1. package/README.md +86 -84
  2. package/dist/emitter/code-model.d.ts +1 -2
  3. package/dist/emitter/code-model.d.ts.map +1 -1
  4. package/dist/emitter/code-model.js +5 -2
  5. package/dist/emitter/code-model.js.map +1 -1
  6. package/dist/emitter/emitter.d.ts +0 -2
  7. package/dist/emitter/emitter.d.ts.map +1 -1
  8. package/dist/emitter/emitter.js +21 -32
  9. package/dist/emitter/emitter.js.map +1 -1
  10. package/dist/emitter/http.d.ts +4 -4
  11. package/dist/emitter/http.d.ts.map +1 -1
  12. package/dist/emitter/http.js.map +1 -1
  13. package/dist/emitter/index.d.ts +1 -1
  14. package/dist/emitter/index.d.ts.map +1 -1
  15. package/dist/emitter/index.js +1 -1
  16. package/dist/emitter/index.js.map +1 -1
  17. package/dist/emitter/lib.d.ts +65 -22
  18. package/dist/emitter/lib.d.ts.map +1 -1
  19. package/dist/emitter/lib.js +51 -26
  20. package/dist/emitter/lib.js.map +1 -1
  21. package/dist/emitter/types.d.ts +3 -3
  22. package/dist/emitter/types.d.ts.map +1 -1
  23. package/dist/emitter/types.js.map +1 -1
  24. package/dist/emitter/utils.d.ts +5 -4
  25. package/dist/emitter/utils.d.ts.map +1 -1
  26. package/dist/emitter/utils.js +31 -16
  27. package/dist/emitter/utils.js.map +1 -1
  28. package/emitter/src/code-model.ts +16 -25
  29. package/emitter/src/emitter.ts +35 -51
  30. package/emitter/src/http.ts +18 -21
  31. package/emitter/src/index.ts +1 -1
  32. package/emitter/src/lib.ts +62 -41
  33. package/emitter/src/types.ts +13 -23
  34. package/emitter/src/utils.ts +36 -25
  35. package/emitter/temp/tsconfig.tsbuildinfo +1 -1
  36. package/eng/scripts/Generate.ps1 +3 -0
  37. package/eng/scripts/ci/pylintrc +1 -1
  38. package/eng/scripts/ci/regenerate.ts +92 -44
  39. package/eng/scripts/setup/__pycache__/venvtools.cpython-38.pyc +0 -0
  40. package/generator/build/lib/pygen/codegen/__init__.py +7 -23
  41. package/generator/build/lib/pygen/codegen/_utils.py +26 -2
  42. package/generator/build/lib/pygen/codegen/models/code_model.py +38 -5
  43. package/generator/build/lib/pygen/codegen/serializers/__init__.py +21 -15
  44. package/generator/build/lib/pygen/codegen/serializers/general_serializer.py +5 -2
  45. package/generator/build/lib/pygen/codegen/serializers/test_serializer.py +1 -1
  46. package/generator/build/lib/pygen/codegen/templates/client_container.py.jinja2 +3 -1
  47. package/generator/build/lib/pygen/codegen/templates/config_container.py.jinja2 +3 -1
  48. package/generator/build/lib/pygen/codegen/templates/conftest.py.jinja2 +3 -1
  49. package/generator/build/lib/pygen/codegen/templates/enum_container.py.jinja2 +3 -1
  50. package/generator/build/lib/pygen/codegen/templates/init.py.jinja2 +3 -1
  51. package/generator/build/lib/pygen/codegen/templates/model_base.py.jinja2 +3 -5
  52. package/generator/build/lib/pygen/codegen/templates/model_container.py.jinja2 +3 -1
  53. package/generator/build/lib/pygen/codegen/templates/model_init.py.jinja2 +3 -1
  54. package/generator/build/lib/pygen/codegen/templates/operation_groups_container.py.jinja2 +3 -1
  55. package/generator/build/lib/pygen/codegen/templates/operations_folder_init.py.jinja2 +3 -1
  56. package/generator/build/lib/pygen/codegen/templates/packaging_templates/LICENSE.jinja2 +1 -21
  57. package/generator/build/lib/pygen/codegen/templates/packaging_templates/MANIFEST.in.jinja2 +6 -2
  58. package/generator/build/lib/pygen/codegen/templates/packaging_templates/README.md.jinja2 +5 -5
  59. package/generator/build/lib/pygen/codegen/templates/packaging_templates/dev_requirements.txt.jinja2 +3 -3
  60. package/generator/build/lib/pygen/codegen/templates/packaging_templates/setup.py.jinja2 +20 -9
  61. package/generator/build/lib/pygen/codegen/templates/patch.py.jinja2 +9 -4
  62. package/generator/build/lib/pygen/codegen/templates/request_builders.py.jinja2 +3 -1
  63. package/generator/build/lib/pygen/codegen/templates/rest_init.py.jinja2 +3 -1
  64. package/generator/build/lib/pygen/codegen/templates/sample.py.jinja2 +3 -1
  65. package/generator/build/lib/pygen/codegen/templates/serialization.py.jinja2 +4 -25
  66. package/generator/build/lib/pygen/codegen/templates/test.py.jinja2 +3 -1
  67. package/generator/build/lib/pygen/codegen/templates/testpreparer.py.jinja2 +3 -1
  68. package/generator/build/lib/pygen/codegen/templates/types.py.jinja2 +3 -1
  69. package/generator/build/lib/pygen/codegen/templates/validation.py.jinja2 +3 -1
  70. package/generator/build/lib/pygen/codegen/templates/vendor.py.jinja2 +3 -1
  71. package/generator/build/lib/pygen/codegen/templates/version.py.jinja2 +3 -1
  72. package/generator/dist/pygen-0.1.0-py3-none-any.whl +0 -0
  73. package/generator/pygen/codegen/__init__.py +7 -23
  74. package/generator/pygen/codegen/_utils.py +26 -2
  75. package/generator/pygen/codegen/models/code_model.py +38 -5
  76. package/generator/pygen/codegen/serializers/__init__.py +21 -15
  77. package/generator/pygen/codegen/serializers/general_serializer.py +5 -2
  78. package/generator/pygen/codegen/serializers/test_serializer.py +1 -1
  79. package/generator/pygen/codegen/templates/client_container.py.jinja2 +3 -1
  80. package/generator/pygen/codegen/templates/config_container.py.jinja2 +3 -1
  81. package/generator/pygen/codegen/templates/conftest.py.jinja2 +3 -1
  82. package/generator/pygen/codegen/templates/enum_container.py.jinja2 +3 -1
  83. package/generator/pygen/codegen/templates/init.py.jinja2 +3 -1
  84. package/generator/pygen/codegen/templates/model_base.py.jinja2 +3 -5
  85. package/generator/pygen/codegen/templates/model_container.py.jinja2 +3 -1
  86. package/generator/pygen/codegen/templates/model_init.py.jinja2 +3 -1
  87. package/generator/pygen/codegen/templates/operation_groups_container.py.jinja2 +3 -1
  88. package/generator/pygen/codegen/templates/operations_folder_init.py.jinja2 +3 -1
  89. package/generator/pygen/codegen/templates/packaging_templates/LICENSE.jinja2 +1 -21
  90. package/generator/pygen/codegen/templates/packaging_templates/MANIFEST.in.jinja2 +6 -2
  91. package/generator/pygen/codegen/templates/packaging_templates/README.md.jinja2 +5 -5
  92. package/generator/pygen/codegen/templates/packaging_templates/dev_requirements.txt.jinja2 +3 -3
  93. package/generator/pygen/codegen/templates/packaging_templates/setup.py.jinja2 +20 -9
  94. package/generator/pygen/codegen/templates/patch.py.jinja2 +9 -4
  95. package/generator/pygen/codegen/templates/request_builders.py.jinja2 +3 -1
  96. package/generator/pygen/codegen/templates/rest_init.py.jinja2 +3 -1
  97. package/generator/pygen/codegen/templates/sample.py.jinja2 +3 -1
  98. package/generator/pygen/codegen/templates/serialization.py.jinja2 +4 -25
  99. package/generator/pygen/codegen/templates/test.py.jinja2 +3 -1
  100. package/generator/pygen/codegen/templates/testpreparer.py.jinja2 +3 -1
  101. package/generator/pygen/codegen/templates/types.py.jinja2 +3 -1
  102. package/generator/pygen/codegen/templates/validation.py.jinja2 +3 -1
  103. package/generator/pygen/codegen/templates/vendor.py.jinja2 +3 -1
  104. package/generator/pygen/codegen/templates/version.py.jinja2 +3 -1
  105. package/generator/pygen.egg-info/PKG-INFO +2 -2
  106. package/generator/pygen.egg-info/requires.txt +2 -2
  107. package/generator/setup.py +2 -2
  108. package/generator/test/azure/mock_api_tests/asynctests/test_azure_core_lro_rpc_async.py +2 -2
  109. package/generator/test/azure/mock_api_tests/test_azure_core_lro_rpc.py +1 -1
  110. package/generator/test/azure/requirements.txt +2 -1
  111. package/generator/test/generic_mock_api_tests/asynctests/test_streaming_jsonl_async.py +27 -0
  112. package/generator/test/generic_mock_api_tests/test_streaming_jsonl.py +25 -0
  113. package/generator/test/unbranded/requirements.txt +1 -0
  114. package/package.json +13 -6
@@ -1,6 +1,8 @@
1
1
  {% import 'operation_tools.jinja2' as op_tools %}
2
2
  # coding=utf-8
3
- {{ code_model.options['license_header'] }}
3
+ {% if code_model.license_header %}
4
+ {{ code_model.license_header }}
5
+ {% endif %}
4
6
  {% if serializer.global_pylint_disables() %}
5
7
  {{ serializer.global_pylint_disables() }}
6
8
  {% endif %}
@@ -1,6 +1,8 @@
1
1
  {% import 'keywords.jinja2' as keywords %}
2
2
  # coding=utf-8
3
- {{ code_model.options['license_header'] }}
3
+ {% if code_model.license_header %}
4
+ {{ code_model.license_header }}
5
+ {% endif %}
4
6
  {{ keywords.path_type_checking_imports() }}
5
7
  {% if schemas %}
6
8
 
@@ -2,7 +2,9 @@
2
2
  {% set operations_description = "async operations" if async_mode else "operations" %}
3
3
  {% set return_none_type_annotation = " -> None" if async_mode else "" %}
4
4
  # coding=utf-8
5
- {{ code_model.options['license_header'] }}
5
+ {% if code_model.license_header %}
6
+ {{ code_model.license_header }}
7
+ {% endif %}
6
8
  {{ imports }}
7
9
  {{ unset }}
8
10
  {% if code_model.options["builders_visibility"] == "embedded" and not async_mode %}
@@ -2,7 +2,9 @@
2
2
  {% import 'keywords.jinja2' as keywords %}
3
3
  {# actual template starts here #}
4
4
  # coding=utf-8
5
- {{ code_model.options['license_header'] }}
5
+ {% if code_model.license_header %}
6
+ {{ code_model.license_header }}
7
+ {% endif %}
6
8
  {{ keywords.path_type_checking_imports() }}
7
9
  {{ op_tools.serialize(operation_group_imports()) }}
8
10
  {{ keywords.patch_imports() }}
@@ -1,21 +1 @@
1
- Copyright (c) {{ code_model.options["company_name"] }} Corporation.
2
-
3
- MIT License
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.
1
+ {{ code_model.license_description }}
@@ -1,8 +1,12 @@
1
1
  include *.md
2
2
  include LICENSE
3
+ {% if code_model.is_tsp %}
4
+ include {{ code_model.namespace.replace('.', '/') }}/py.typed
5
+ {% else %}
3
6
  include {{ package_name.replace('-', '/') }}/py.typed
7
+ {% endif %}
4
8
  recursive-include tests *.py
5
9
  recursive-include samples *.py *.md
6
- {%- for init_name in init_names %}
10
+ {% for init_name in init_names %}
7
11
  include {{ init_name }}
8
- {%- endfor %}
12
+ {% endfor %}
@@ -1,5 +1,5 @@
1
1
  {% if code_model.is_azure_flavor %}
2
- {% if package_mode == "mgmtplane" -%}
2
+ {% if package_mode == "mgmtplane" %}
3
3
  # Microsoft Azure SDK for Python
4
4
 
5
5
  This is the Microsoft {{package_pprint_name}} Client Library.
@@ -40,7 +40,7 @@ python -m pip install {{ package_name }}
40
40
  - You need an [Azure subscription][azure_sub] to use this package.
41
41
  - An existing {{ package_pprint_name }} instance.
42
42
 
43
- {%- if token_credential %}
43
+ {% if token_credential %}
44
44
  #### Create with an Azure Active Directory Credential
45
45
  To use an [Azure Active Directory (AAD) token credential][authenticate_with_token],
46
46
  provide an instance of the desired credential type obtained from the
@@ -57,7 +57,7 @@ Set the values of the client ID, tenant ID, and client secret of the AAD applica
57
57
  Use the returned token credential to authenticate the client:
58
58
 
59
59
  ```python
60
- >>> from {{ namespace }} import {{ client_name }}
60
+ >>> from {{ code_model.namespace }} import {{ client_name }}
61
61
  >>> from azure.identity import DefaultAzureCredential
62
62
  >>> client = {{ client_name }}(endpoint='<endpoint>', credential=DefaultAzureCredential())
63
63
  ```
@@ -65,7 +65,7 @@ Use the returned token credential to authenticate the client:
65
65
  ## Examples
66
66
 
67
67
  ```python
68
- >>> from {{ namespace }} import {{ client_name }}
68
+ >>> from {{ code_model.namespace }} import {{ client_name }}
69
69
  >>> from azure.identity import DefaultAzureCredential
70
70
  >>> from {{ code_model.core_library }}.exceptions import HttpResponseError
71
71
 
@@ -76,7 +76,7 @@ Use the returned token credential to authenticate the client:
76
76
  print('service responds error: {}'.format(e.response.json()))
77
77
 
78
78
  ```
79
- {%- endif %}
79
+ {% endif %}
80
80
 
81
81
  ## Contributing
82
82
 
@@ -1,9 +1,9 @@
1
1
  -e ../../../tools/azure-sdk-tools
2
2
  ../../core/azure-core
3
- {% if token_credential -%}
3
+ {% if token_credential %}
4
4
  ../../identity/azure-identity
5
5
  {% endif -%}
6
- {% if azure_arm -%}
6
+ {% if azure_arm %}
7
7
  ../../core/azure-mgmt-core
8
- {% endif -%}
8
+ {% endif %}
9
9
  aiohttp
@@ -1,20 +1,30 @@
1
1
  # coding=utf-8
2
- {{ license_header }}
3
- # coding: utf-8
2
+ {% if code_model.license_header %}
3
+ {{ code_model.license_header }}
4
+ {% endif %}
5
+
4
6
  {% if package_mode %}
7
+
5
8
  import os
6
9
  import re
7
- {% endif -%}
10
+ {% endif %}
8
11
  from setuptools import setup, find_packages
9
12
 
10
13
  {% set package_name = package_name or code_model.clients[0].name %}
11
14
 
12
15
  PACKAGE_NAME = "{{ package_name|lower }}"
13
- {% if package_mode -%}
16
+ {% if package_mode %}
14
17
  PACKAGE_PPRINT_NAME = "{{ package_pprint_name }}"
18
+ {% if code_model.is_tsp %}
19
+ PACKAGE_NAMESPACE = "{{ code_model.namespace|lower }}"
20
+
21
+ # a.b.c => a/b/c
22
+ package_folder_path = PACKAGE_NAMESPACE.replace(".", "/")
23
+ {% else %}
15
24
 
16
25
  # a-b-c => a/b/c
17
26
  package_folder_path = PACKAGE_NAME.replace("-", "/")
27
+ {% endif %}
18
28
 
19
29
  # Version extraction inspired from 'requests'
20
30
  with open(os.path.join(package_folder_path, "_version.py"), "r") as fd:
@@ -24,7 +34,7 @@ with open(os.path.join(package_folder_path, "_version.py"), "r") as fd:
24
34
 
25
35
  if not version:
26
36
  raise RuntimeError("Cannot find version information")
27
- {% set description = "\"" + code_model.options["company_name"] + " {} Client Library for Python\".format(PACKAGE_PPRINT_NAME)" %}
37
+ {% set description = "\"" + code_model.company_name + " {} Client Library for Python\".format(PACKAGE_PPRINT_NAME)" %}
28
38
  {% set author_email = "azpysdkhelp@microsoft.com" %}
29
39
  {% set url = "https://github.com/Azure/azure-sdk-for-python/tree/main/sdk" %}
30
40
  {% else %}
@@ -33,7 +43,8 @@ version = "{{ package_version }}"
33
43
  {% set long_description = code_model.description %}
34
44
  {% set author_email = "" %}
35
45
  {% set url = "" %}
36
- {% endif -%}
46
+ {% endif %}
47
+
37
48
 
38
49
  setup(
39
50
  name=PACKAGE_NAME,
@@ -43,7 +54,7 @@ setup(
43
54
  long_description=open("README.md", "r").read(),
44
55
  long_description_content_type="text/markdown",
45
56
  license="MIT License",
46
- author="{{ code_model.options["company_name"] }} Corporation",
57
+ author="{{ code_model.company_name }}",
47
58
  {% endif %}
48
59
  {% if code_model.is_azure_flavor %}
49
60
  author_email="{{ author_email }}",
@@ -70,9 +81,9 @@ setup(
70
81
  {% if pkgutil_names %}
71
82
  # Exclude packages that will be covered by PEP420 or nspkg
72
83
  {% endif %}
73
- {%- for pkgutil_name in pkgutil_names %}
84
+ {% for pkgutil_name in pkgutil_names %}
74
85
  "{{ pkgutil_name }}",
75
- {%- endfor %}
86
+ {% endfor %}
76
87
  ]
77
88
  ),
78
89
  include_package_data=True,
@@ -1,7 +1,12 @@
1
- # ------------------------------------
2
- # Copyright (c) {{ code_model.options["company_name"] }} Corporation.
3
- # Licensed under the MIT License.
4
- # ------------------------------------
1
+ # coding=utf-8
2
+ {% if not code_model.is_azure_flavor %}
3
+ {{ code_model.license_header }}
4
+ {% else %}
5
+ # --------------------------------------------------------------------------
6
+ # Copyright (c) Microsoft Corporation. All rights reserved.
7
+ # Licensed under the MIT License. See License.txt in the project root for license information.
8
+ # --------------------------------------------------------------------------
9
+ {% endif %}
5
10
  """Customize generated code here.
6
11
 
7
12
  Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize
@@ -1,6 +1,8 @@
1
1
  {% import 'operation_tools.jinja2' as op_tools %}
2
2
  # coding=utf-8
3
- {{ code_model.options['license_header'] }}
3
+ {% if code_model.license_header %}
4
+ {{ code_model.license_header }}
5
+ {% endif %}
4
6
  {{ imports }}
5
7
 
6
8
  {{ op_tools.declare_serializer(code_model) }}
@@ -1,5 +1,7 @@
1
1
  # coding=utf-8
2
- {{ code_model.options['license_header'] }}
2
+ {% if code_model.license_header %}
3
+ {{ code_model.license_header }}
4
+ {% endif %}
3
5
 
4
6
  {% for request_builder in request_builders %}
5
7
  from ._request_builders import {{ request_builder.name }}
@@ -1,7 +1,9 @@
1
1
  # coding=utf-8
2
2
  {% set aad_token = "DefaultAzureCredential" %}
3
3
  {% set azure_key = "AzureKeyCredential" %}
4
- {{ code_model.options['license_header'] }}
4
+ {% if code_model.license_header %}
5
+ {{ code_model.license_header }}
6
+ {% endif %}
5
7
 
6
8
  {{ imports }}
7
9
  """
@@ -1,28 +1,7 @@
1
- # --------------------------------------------------------------------------
2
- #
3
- # Copyright (c) {{ code_model.options["company_name"] }} Corporation. All rights reserved.
4
- #
5
- # The MIT License (MIT)
6
- #
7
- # Permission is hereby granted, free of charge, to any person obtaining a copy
8
- # of this software and associated documentation files (the ""Software""), to
9
- # deal in the Software without restriction, including without limitation the
10
- # rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
11
- # sell copies of the Software, and to permit persons to whom the Software is
12
- # furnished to do so, subject to the following conditions:
13
- #
14
- # The above copyright notice and this permission notice shall be included in
15
- # all copies or substantial portions of the Software.
16
- #
17
- # THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22
- # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
23
- # IN THE SOFTWARE.
24
- #
25
- # --------------------------------------------------------------------------
1
+ # coding=utf-8
2
+ {% if code_model.license_header %}
3
+ {{ code_model.license_header }}
4
+ {% endif %}
26
5
 
27
6
  # pyright: reportUnnecessaryTypeIgnoreComment=false
28
7
 
@@ -3,7 +3,9 @@
3
3
  {% set async = "async " if test.async_mode else "" %}
4
4
  {% set async_suffix = "_async" if test.async_mode else "" %}
5
5
  # coding=utf-8
6
- {{ code_model.options['license_header'] }}
6
+ {% if code_model.license_header %}
7
+ {{ code_model.license_header }}
8
+ {% endif %}
7
9
  import pytest
8
10
  {{ imports }}
9
11
 
@@ -1,5 +1,7 @@
1
1
  # coding=utf-8
2
- {{ code_model.options['license_header'] }}
2
+ {% if code_model.license_header %}
3
+ {{ code_model.license_header }}
4
+ {% endif %}
3
5
  {{ imports }}
4
6
 
5
7
  {% for test_name in test_names %}
@@ -1,5 +1,7 @@
1
1
  # coding=utf-8
2
- {{ code_model.options['license_header'] }}
2
+ {% if code_model.license_header %}
3
+ {{ code_model.license_header }}
4
+ {% endif %}
3
5
 
4
6
  {{ imports }}
5
7
  {% for nu in code_model.named_unions %}
@@ -1,4 +1,6 @@
1
- {{ code_model.options['license_header'] }}
1
+ {% if code_model.license_header %}
2
+ {{ code_model.license_header }}
3
+ {% endif %}
2
4
  import functools
3
5
 
4
6
  def api_version_validation(**kwargs):
@@ -1,5 +1,7 @@
1
1
  {% import 'keywords.jinja2' as keywords with context %}
2
- {{ code_model.options['license_header'] }}
2
+ {% if code_model.license_header %}
3
+ {{ code_model.license_header }}
4
+ {% endif %}
3
5
 
4
6
  {{ imports }}
5
7
 
@@ -1,4 +1,6 @@
1
1
  # coding=utf-8
2
- {{ code_model.options['license_header'] }}
2
+ {% if code_model.license_header %}
3
+ {{ code_model.license_header }}
4
+ {% endif %}
3
5
 
4
6
  VERSION = "{{ code_model.options['package_version'] }}"
@@ -19,9 +19,9 @@ Description-Content-Type: text/markdown
19
19
  License-File: LICENSE
20
20
  Requires-Dist: black==24.8.0
21
21
  Requires-Dist: docutils>=0.20.1
22
- Requires-Dist: Jinja2==3.1.3
22
+ Requires-Dist: Jinja2==3.1.6
23
23
  Requires-Dist: PyYAML==6.0.1
24
24
  Requires-Dist: tomli==2.0.1
25
- Requires-Dist: setuptools==69.5.1
25
+ Requires-Dist: setuptools==70.0.0
26
26
 
27
27
  # Core Library for Python Generation
@@ -1,6 +1,6 @@
1
1
  black==24.8.0
2
2
  docutils>=0.20.1
3
- Jinja2==3.1.3
3
+ Jinja2==3.1.6
4
4
  PyYAML==6.0.1
5
5
  tomli==2.0.1
6
- setuptools==69.5.1
6
+ setuptools==70.0.0
@@ -50,9 +50,9 @@ setup(
50
50
  install_requires=[
51
51
  "black==24.8.0",
52
52
  "docutils>=0.20.1",
53
- "Jinja2==3.1.3",
53
+ "Jinja2==3.1.6",
54
54
  "PyYAML==6.0.1",
55
55
  "tomli==2.0.1",
56
- "setuptools==69.5.1",
56
+ "setuptools==70.0.0",
57
57
  ],
58
58
  )
@@ -4,8 +4,8 @@
4
4
  # license information.
5
5
  # --------------------------------------------------------------------------
6
6
  import pytest
7
- from azurecore.lro.rpc.aio import RpcClient
8
- from azurecore.lro.rpc import models
7
+ from specs.azure.core.lro.rpc.aio import RpcClient
8
+ from specs.azure.core.lro.rpc import models
9
9
 
10
10
 
11
11
  @pytest.fixture
@@ -4,7 +4,7 @@
4
4
  # license information.
5
5
  # --------------------------------------------------------------------------
6
6
  import pytest
7
- from azurecore.lro.rpc import RpcClient, models
7
+ from specs.azure.core.lro.rpc import RpcClient, models
8
8
 
9
9
 
10
10
  @pytest.fixture
@@ -9,7 +9,7 @@ azure-mgmt-core==1.3.2
9
9
  -e ./generated/azure-client-generator-core-flatten-property
10
10
  -e ./generated/azure-core-basic
11
11
  -e ./generated/azure-core-scalar
12
- -e ./generated/azurecore-lro-rpc
12
+ -e ./generated/azure-core-lro-rpc
13
13
  -e ./generated/azure-core-lro-standard
14
14
  -e ./generated/azure-core-model
15
15
  -e ./generated/azure-core-traits
@@ -46,6 +46,7 @@ azure-mgmt-core==1.3.2
46
46
  -e ./generated/server-versions-versioned
47
47
  -e ./generated/server-versions-not-versioned
48
48
  -e ./generated/special-words
49
+ -e ./generated/streaming-jsonl
49
50
  -e ./generated/typetest-array
50
51
  -e ./generated/typetest-dictionary
51
52
  -e ./generated/typetest-enum-extensible
@@ -0,0 +1,27 @@
1
+ # -------------------------------------------------------------------------
2
+ # Copyright (c) Microsoft Corporation. All rights reserved.
3
+ # Licensed under the MIT License. See License.txt in the project root for
4
+ # license information.
5
+ # --------------------------------------------------------------------------
6
+ import pytest
7
+
8
+ from streaming.jsonl.aio import JsonlClient
9
+
10
+
11
+ @pytest.fixture
12
+ async def client():
13
+ async with JsonlClient(endpoint="http://localhost:3000") as client:
14
+ yield client
15
+
16
+
17
+ JSONL = b'{"desc": "one"}\n{"desc": "two"}\n{"desc": "three"}'
18
+
19
+
20
+ @pytest.mark.asyncio
21
+ async def test_basic_send(client: JsonlClient):
22
+ await client.basic.send(JSONL)
23
+
24
+
25
+ @pytest.mark.asyncio
26
+ async def test_basic_recv(client: JsonlClient):
27
+ assert b"".join([d async for d in (await client.basic.receive())]) == JSONL
@@ -0,0 +1,25 @@
1
+ # -------------------------------------------------------------------------
2
+ # Copyright (c) Microsoft Corporation. All rights reserved.
3
+ # Licensed under the MIT License. See License.txt in the project root for
4
+ # license information.
5
+ # --------------------------------------------------------------------------
6
+ import pytest
7
+
8
+ from streaming.jsonl import JsonlClient
9
+
10
+
11
+ @pytest.fixture
12
+ def client():
13
+ with JsonlClient(endpoint="http://localhost:3000") as client:
14
+ yield client
15
+
16
+
17
+ JSONL = b'{"desc": "one"}\n{"desc": "two"}\n{"desc": "three"}'
18
+
19
+
20
+ def test_basic_send(client: JsonlClient):
21
+ client.basic.send(JSONL)
22
+
23
+
24
+ def test_basic_recv(client: JsonlClient):
25
+ assert b"".join(client.basic.receive()) == JSONL
@@ -18,6 +18,7 @@
18
18
  -e ./generated/server-versions-versioned
19
19
  -e ./generated/server-versions-not-versioned
20
20
  -e ./generated/special-words
21
+ -e ./generated/streaming-jsonl
21
22
  -e ./generated/typetest-array
22
23
  -e ./generated/typetest-dictionary
23
24
  -e ./generated/typetest-enum-extensible
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@typespec/http-client-python",
3
- "version": "0.8.1",
3
+ "version": "0.8.3-dev.1",
4
4
  "author": "Microsoft Corporation",
5
5
  "description": "TypeSpec emitter for Python SDKs",
6
6
  "homepage": "https://typespec.io",
@@ -26,7 +26,7 @@
26
26
  }
27
27
  },
28
28
  "engines": {
29
- "node": ">=18.0.0"
29
+ "node": ">=20.0.0"
30
30
  },
31
31
  "scripts": {
32
32
  "clean": "rimraf ./dist ./temp ./emitter/temp ./generator/test/azure/generated ./generator/test/unbranded/generated ./venv",
@@ -43,7 +43,8 @@
43
43
  "test:generator": "tsx ./eng/scripts/ci/run-ci.ts --command=test",
44
44
  "test:emitter": "vitest run -c ./emitter/vitest.config.ts",
45
45
  "change:version": "pnpm chronus version --ignore-policies --only @typespec/http-client-python",
46
- "change:add": "pnpm chronus add"
46
+ "change:add": "pnpm chronus add",
47
+ "regen-docs": "node ../../packages/tspd/cmd/tspd.js doc . --enable-experimental --output-dir ../../website/src/content/docs/docs/emitters/clients/http-client-python/reference --skip-js"
47
48
  },
48
49
  "files": [
49
50
  "dist/**",
@@ -57,12 +58,15 @@
57
58
  "@azure-tools/typespec-azure-core": ">=0.53.0 <1.0.0",
58
59
  "@azure-tools/typespec-azure-resource-manager": ">=0.53.0 <1.0.0",
59
60
  "@azure-tools/typespec-azure-rulesets": ">=0.53.0 <3.0.0",
60
- "@azure-tools/typespec-client-generator-core": ">=0.53.0 <1.0.0",
61
+ "@azure-tools/typespec-client-generator-core": ">=0.53.1 <1.0.0",
61
62
  "@typespec/compiler": ">=0.67.0 <1.0.0",
62
63
  "@typespec/http": ">=0.67.0 <1.0.0",
63
64
  "@typespec/openapi": ">=0.67.0 <1.0.0",
64
65
  "@typespec/rest": ">=0.67.0 <1.0.0",
65
- "@typespec/versioning": ">=0.67.0 <1.0.0"
66
+ "@typespec/versioning": ">=0.67.0 <1.0.0",
67
+ "@typespec/events": ">=0.67.0 <1.0.0",
68
+ "@typespec/sse": ">=0.67.0 <1.0.0",
69
+ "@typespec/streams": ">=0.67.0 <1.0.0"
66
70
  },
67
71
  "dependencies": {
68
72
  "js-yaml": "~4.1.0",
@@ -77,7 +81,7 @@
77
81
  "@azure-tools/typespec-azure-core": "~0.53.0",
78
82
  "@azure-tools/typespec-azure-resource-manager": "~0.53.0",
79
83
  "@azure-tools/typespec-azure-rulesets": "~0.53.0",
80
- "@azure-tools/typespec-client-generator-core": "~0.53.0",
84
+ "@azure-tools/typespec-client-generator-core": "~0.53.1",
81
85
  "@types/js-yaml": "~4.0.5",
82
86
  "@types/node": "~22.5.4",
83
87
  "@types/semver": "7.5.8",
@@ -87,6 +91,9 @@
87
91
  "@typespec/openapi": "~0.67.0",
88
92
  "@typespec/rest": "~0.67.0",
89
93
  "@typespec/versioning": "~0.67.0",
94
+ "@typespec/events": "~0.67.0",
95
+ "@typespec/sse": "~0.67.0",
96
+ "@typespec/streams": "~0.67.0",
90
97
  "c8": "^10.1.3",
91
98
  "chalk": "5.3.0",
92
99
  "rimraf": "~6.0.1",