@typespec/http-client-python 0.28.2 → 0.28.3

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 (309) hide show
  1. package/dist/emitter/code-model.d.ts.map +1 -1
  2. package/dist/emitter/code-model.js +6 -6
  3. package/dist/emitter/code-model.js.map +1 -1
  4. package/dist/emitter/emitter.d.ts.map +1 -1
  5. package/dist/emitter/emitter.js +27 -28
  6. package/dist/emitter/emitter.js.map +1 -1
  7. package/dist/emitter/lib.d.ts +4 -1
  8. package/dist/emitter/lib.d.ts.map +1 -1
  9. package/dist/emitter/lib.js.map +1 -1
  10. package/dist/emitter/system-requirements.js +6 -4
  11. package/dist/emitter/system-requirements.js.map +1 -1
  12. package/dist/emitter/types.d.ts +2 -5
  13. package/dist/emitter/types.d.ts.map +1 -1
  14. package/dist/emitter/types.js +55 -58
  15. package/dist/emitter/types.js.map +1 -1
  16. package/dist/emitter/utils.d.ts.map +1 -1
  17. package/dist/emitter/utils.js +16 -17
  18. package/dist/emitter/utils.js.map +1 -1
  19. package/emitter/src/code-model.ts +6 -13
  20. package/emitter/src/emitter.ts +29 -31
  21. package/emitter/src/lib.ts +4 -0
  22. package/emitter/src/system-requirements.ts +4 -4
  23. package/emitter/src/types.ts +67 -57
  24. package/emitter/src/utils.ts +16 -18
  25. package/emitter/temp/tsconfig.tsbuildinfo +1 -1
  26. package/eng/scripts/Build-Packages.ps1 +62 -37
  27. package/eng/scripts/Check-GitChanges.ps1 +30 -3
  28. package/eng/scripts/Functions.ps1 +54 -15
  29. package/eng/scripts/Generate.ps1 +42 -8
  30. package/eng/scripts/Generation.psm1 +44 -15
  31. package/eng/scripts/Initialize-Repository.ps1 +29 -11
  32. package/eng/scripts/Test-Packages.ps1 +47 -31
  33. package/eng/scripts/ci/config/eslint-ci.config.mjs +54 -0
  34. package/eng/scripts/ci/dev_requirements.txt +1 -0
  35. package/eng/scripts/ci/format.ts +232 -2
  36. package/eng/scripts/ci/lint.ts +216 -20
  37. package/eng/scripts/ci/regenerate-common.ts +18 -14
  38. package/eng/scripts/ci/regenerate.ts +305 -68
  39. package/eng/scripts/ci/run-tests.ts +402 -0
  40. package/eng/scripts/ci/run_mypy.py +4 -3
  41. package/eng/scripts/ci/run_pylint.py +4 -3
  42. package/eng/scripts/ci/run_pyright.py +4 -3
  43. package/eng/scripts/ci/typecheck.ts +225 -0
  44. package/eng/scripts/ci/util.py +1 -1
  45. package/eng/scripts/ci/utils.ts +5 -5
  46. package/eng/scripts/setup/__pycache__/package_manager.cpython-311.pyc +0 -0
  47. package/eng/scripts/setup/__pycache__/venvtools.cpython-311.pyc +0 -0
  48. package/eng/scripts/setup/build.ts +1 -1
  49. package/eng/scripts/setup/build_pygen_wheel.py +1 -0
  50. package/eng/scripts/setup/install.py +1 -0
  51. package/eng/scripts/setup/prepare.py +1 -0
  52. package/eng/scripts/setup/prepare.ts +1 -1
  53. package/eng/scripts/setup/run_tsp.py +3 -3
  54. package/eng/scripts/setup/system-requirements.ts +8 -4
  55. package/eng/scripts/setup/venvtools.py +1 -0
  56. package/generator/build/lib/pygen/codegen/templates/model_base.py.jinja2 +157 -64
  57. package/generator/dist/pygen-0.1.0-py3-none-any.whl +0 -0
  58. package/generator/pygen/codegen/templates/model_base.py.jinja2 +157 -64
  59. package/package.json +48 -42
  60. package/eng/scripts/ci/run-ci.ts +0 -89
  61. package/generator/test/azure/mock_api_tests/asynctests/test_azure_arm_commonproperties_async.py +0 -94
  62. package/generator/test/azure/mock_api_tests/asynctests/test_azure_arm_largeheader_async.py +0 -30
  63. package/generator/test/azure/mock_api_tests/asynctests/test_azure_arm_nonresource_async.py +0 -36
  64. package/generator/test/azure/mock_api_tests/asynctests/test_azure_arm_operationtemplates_async.py +0 -205
  65. package/generator/test/azure/mock_api_tests/asynctests/test_azure_arm_resource_async.py +0 -478
  66. package/generator/test/azure/mock_api_tests/asynctests/test_azure_client_generator_core_access_async.py +0 -101
  67. package/generator/test/azure/mock_api_tests/asynctests/test_azure_client_generator_core_api_version_header_async.py +0 -18
  68. package/generator/test/azure/mock_api_tests/asynctests/test_azure_client_generator_core_api_version_path_async.py +0 -18
  69. package/generator/test/azure/mock_api_tests/asynctests/test_azure_client_generator_core_api_version_query_async.py +0 -18
  70. package/generator/test/azure/mock_api_tests/asynctests/test_azure_client_generator_core_client_default_value_async.py +0 -46
  71. package/generator/test/azure/mock_api_tests/asynctests/test_azure_client_generator_core_client_initialization_async.py +0 -58
  72. package/generator/test/azure/mock_api_tests/asynctests/test_azure_client_generator_core_client_location_async.py +0 -82
  73. package/generator/test/azure/mock_api_tests/asynctests/test_azure_client_generator_core_deserialize_empty_string_as_null_async.py +0 -20
  74. package/generator/test/azure/mock_api_tests/asynctests/test_azure_client_generator_core_flatten_async.py +0 -115
  75. package/generator/test/azure/mock_api_tests/asynctests/test_azure_client_generator_core_hierrarchy_building_async.py +0 -53
  76. package/generator/test/azure/mock_api_tests/asynctests/test_azure_client_generator_core_next_link_verb_async.py +0 -28
  77. package/generator/test/azure/mock_api_tests/asynctests/test_azure_client_generator_core_override_async.py +0 -106
  78. package/generator/test/azure/mock_api_tests/asynctests/test_azure_client_generator_core_usage_async.py +0 -38
  79. package/generator/test/azure/mock_api_tests/asynctests/test_azure_core_basic_async.py +0 -76
  80. package/generator/test/azure/mock_api_tests/asynctests/test_azure_core_lro_rpc_async.py +0 -22
  81. package/generator/test/azure/mock_api_tests/asynctests/test_azure_core_lro_standard_async.py +0 -39
  82. package/generator/test/azure/mock_api_tests/asynctests/test_azure_core_model_async.py +0 -33
  83. package/generator/test/azure/mock_api_tests/asynctests/test_azure_core_page_async.py +0 -80
  84. package/generator/test/azure/mock_api_tests/asynctests/test_azure_core_scalar_async.py +0 -41
  85. package/generator/test/azure/mock_api_tests/asynctests/test_azure_core_traits_async.py +0 -87
  86. package/generator/test/azure/mock_api_tests/asynctests/test_azure_encode_duration_async.py +0 -19
  87. package/generator/test/azure/mock_api_tests/asynctests/test_azure_example_basic_async.py +0 -30
  88. package/generator/test/azure/mock_api_tests/asynctests/test_azure_payload_pageable_async.py +0 -19
  89. package/generator/test/azure/mock_api_tests/asynctests/test_azure_resource_manager_method_subscription_id_async.py +0 -248
  90. package/generator/test/azure/mock_api_tests/asynctests/test_azure_resource_manager_multi_service_async.py +0 -110
  91. package/generator/test/azure/mock_api_tests/asynctests/test_azure_resource_manager_multi_service_shared_models_async.py +0 -132
  92. package/generator/test/azure/mock_api_tests/asynctests/test_azure_special_headers_client_request_id_async.py +0 -30
  93. package/generator/test/azure/mock_api_tests/asynctests/test_azure_versioning_previewversion_async.py +0 -53
  94. package/generator/test/azure/mock_api_tests/asynctests/test_client_namespace_async.py +0 -34
  95. package/generator/test/azure/mock_api_tests/asynctests/test_client_naming_async.py +0 -69
  96. package/generator/test/azure/mock_api_tests/asynctests/test_client_naming_enum_conflict_async.py +0 -37
  97. package/generator/test/azure/mock_api_tests/asynctests/test_client_overload_async.py +0 -27
  98. package/generator/test/azure/mock_api_tests/asynctests/test_client_structure_async.py +0 -64
  99. package/generator/test/azure/mock_api_tests/asynctests/test_client_structure_clientoperationgroup_async.py +0 -31
  100. package/generator/test/azure/mock_api_tests/asynctests/test_encode_duration_async.py +0 -63
  101. package/generator/test/azure/mock_api_tests/asynctests/test_encode_numeric_async.py +0 -35
  102. package/generator/test/azure/mock_api_tests/asynctests/test_parameters_basic_async.py +0 -24
  103. package/generator/test/azure/mock_api_tests/asynctests/test_parameters_spread_async.py +0 -76
  104. package/generator/test/azure/mock_api_tests/asynctests/test_payload_content_negotiation_async.py +0 -37
  105. package/generator/test/azure/mock_api_tests/asynctests/test_payload_multipart_async.py +0 -216
  106. package/generator/test/azure/mock_api_tests/asynctests/test_resiliency_srv_driven_async.py +0 -130
  107. package/generator/test/azure/mock_api_tests/asynctests/test_serialization_encoded_name_json_async.py +0 -24
  108. package/generator/test/azure/mock_api_tests/asynctests/test_service_multi_service_async.py +0 -31
  109. package/generator/test/azure/mock_api_tests/asynctests/test_special_words_async.py +0 -71
  110. package/generator/test/azure/mock_api_tests/conftest.py +0 -207
  111. package/generator/test/azure/mock_api_tests/data/image.jpg +0 -0
  112. package/generator/test/azure/mock_api_tests/data/image.png +0 -0
  113. package/generator/test/azure/mock_api_tests/test_azure_arm_commonproperties.py +0 -89
  114. package/generator/test/azure/mock_api_tests/test_azure_arm_largeheader.py +0 -27
  115. package/generator/test/azure/mock_api_tests/test_azure_arm_nonresource.py +0 -34
  116. package/generator/test/azure/mock_api_tests/test_azure_arm_operationtemplates.py +0 -180
  117. package/generator/test/azure/mock_api_tests/test_azure_arm_resource.py +0 -436
  118. package/generator/test/azure/mock_api_tests/test_azure_client_generator_core_access.py +0 -92
  119. package/generator/test/azure/mock_api_tests/test_azure_client_generator_core_api_version_header.py +0 -17
  120. package/generator/test/azure/mock_api_tests/test_azure_client_generator_core_api_version_path.py +0 -17
  121. package/generator/test/azure/mock_api_tests/test_azure_client_generator_core_api_version_query.py +0 -17
  122. package/generator/test/azure/mock_api_tests/test_azure_client_generator_core_client_default_value.py +0 -42
  123. package/generator/test/azure/mock_api_tests/test_azure_client_generator_core_client_initialization.py +0 -51
  124. package/generator/test/azure/mock_api_tests/test_azure_client_generator_core_client_location.py +0 -70
  125. package/generator/test/azure/mock_api_tests/test_azure_client_generator_core_deserialize_empty_string_as_null.py +0 -19
  126. package/generator/test/azure/mock_api_tests/test_azure_client_generator_core_flatten.py +0 -104
  127. package/generator/test/azure/mock_api_tests/test_azure_client_generator_core_hierrarchy_building.py +0 -45
  128. package/generator/test/azure/mock_api_tests/test_azure_client_generator_core_next_link_verb.py +0 -27
  129. package/generator/test/azure/mock_api_tests/test_azure_client_generator_core_override.py +0 -102
  130. package/generator/test/azure/mock_api_tests/test_azure_client_generator_core_usage.py +0 -32
  131. package/generator/test/azure/mock_api_tests/test_azure_core_basic.py +0 -70
  132. package/generator/test/azure/mock_api_tests/test_azure_core_lro_rpc.py +0 -20
  133. package/generator/test/azure/mock_api_tests/test_azure_core_lro_standard.py +0 -32
  134. package/generator/test/azure/mock_api_tests/test_azure_core_model.py +0 -30
  135. package/generator/test/azure/mock_api_tests/test_azure_core_page.py +0 -71
  136. package/generator/test/azure/mock_api_tests/test_azure_core_scalar.py +0 -35
  137. package/generator/test/azure/mock_api_tests/test_azure_core_traits.py +0 -85
  138. package/generator/test/azure/mock_api_tests/test_azure_encode_duration.py +0 -18
  139. package/generator/test/azure/mock_api_tests/test_azure_example_basic.py +0 -29
  140. package/generator/test/azure/mock_api_tests/test_azure_payload_pageable.py +0 -18
  141. package/generator/test/azure/mock_api_tests/test_azure_resource_manager_method_subscription_id.py +0 -235
  142. package/generator/test/azure/mock_api_tests/test_azure_resource_manager_multi_service.py +0 -104
  143. package/generator/test/azure/mock_api_tests/test_azure_resource_manager_multi_service_shared_models.py +0 -128
  144. package/generator/test/azure/mock_api_tests/test_azure_special_headers_client_request_id.py +0 -29
  145. package/generator/test/azure/mock_api_tests/test_azure_versioning_previewversion.py +0 -50
  146. package/generator/test/azure/mock_api_tests/test_clear_output_folder.py +0 -23
  147. package/generator/test/azure/mock_api_tests/test_client_namespace.py +0 -32
  148. package/generator/test/azure/mock_api_tests/test_client_naming.py +0 -57
  149. package/generator/test/azure/mock_api_tests/test_client_naming_enum_conflict.py +0 -35
  150. package/generator/test/azure/mock_api_tests/test_client_overload.py +0 -25
  151. package/generator/test/azure/mock_api_tests/test_client_structure.py +0 -60
  152. package/generator/test/azure/mock_api_tests/test_client_structure_clientoperationgroup.py +0 -29
  153. package/generator/test/azure/mock_api_tests/test_encode_duration.py +0 -60
  154. package/generator/test/azure/mock_api_tests/test_encode_numeric.py +0 -31
  155. package/generator/test/azure/mock_api_tests/test_model_base_flatten_compatibility.py +0 -251
  156. package/generator/test/azure/mock_api_tests/test_parameters_basic.py +0 -22
  157. package/generator/test/azure/mock_api_tests/test_parameters_spread.py +0 -66
  158. package/generator/test/azure/mock_api_tests/test_payload_content_negotiation.py +0 -33
  159. package/generator/test/azure/mock_api_tests/test_payload_multipart.py +0 -198
  160. package/generator/test/azure/mock_api_tests/test_resiliency_srv_driven.py +0 -124
  161. package/generator/test/azure/mock_api_tests/test_serialization_encoded_name_json.py +0 -21
  162. package/generator/test/azure/mock_api_tests/test_service_multi_service.py +0 -29
  163. package/generator/test/azure/mock_api_tests/test_special_words.py +0 -63
  164. package/generator/test/azure/requirements.txt +0 -125
  165. package/generator/test/azure/tox.ini +0 -64
  166. package/generator/test/data/image.jpg +0 -0
  167. package/generator/test/data/image.png +0 -0
  168. package/generator/test/dev_requirements.txt +0 -8
  169. package/generator/test/generic_mock_api_tests/asynctests/test_authentication_async.py +0 -140
  170. package/generator/test/generic_mock_api_tests/asynctests/test_encode_array_async.py +0 -139
  171. package/generator/test/generic_mock_api_tests/asynctests/test_encode_bytes_async.py +0 -132
  172. package/generator/test/generic_mock_api_tests/asynctests/test_encode_datetime_async.py +0 -127
  173. package/generator/test/generic_mock_api_tests/asynctests/test_headasboolean_async.py +0 -35
  174. package/generator/test/generic_mock_api_tests/asynctests/test_parameters_body_optionality_async.py +0 -30
  175. package/generator/test/generic_mock_api_tests/asynctests/test_parameters_collection_format_async.py +0 -38
  176. package/generator/test/generic_mock_api_tests/asynctests/test_parameters_path_async.py +0 -24
  177. package/generator/test/generic_mock_api_tests/asynctests/test_parameters_query_async.py +0 -18
  178. package/generator/test/generic_mock_api_tests/asynctests/test_payload_json_merge_patch_async.py +0 -98
  179. package/generator/test/generic_mock_api_tests/asynctests/test_payload_media_type_async.py +0 -27
  180. package/generator/test/generic_mock_api_tests/asynctests/test_payload_pageable_async.py +0 -134
  181. package/generator/test/generic_mock_api_tests/asynctests/test_payload_xml_async.py +0 -150
  182. package/generator/test/generic_mock_api_tests/asynctests/test_response_status_code_range_async.py +0 -38
  183. package/generator/test/generic_mock_api_tests/asynctests/test_routes_async.py +0 -331
  184. package/generator/test/generic_mock_api_tests/asynctests/test_server_endpoint_not_defined_async.py +0 -18
  185. package/generator/test/generic_mock_api_tests/asynctests/test_server_path_multiple_async.py +0 -25
  186. package/generator/test/generic_mock_api_tests/asynctests/test_server_path_single_async.py +0 -18
  187. package/generator/test/generic_mock_api_tests/asynctests/test_server_versions_not_versioned_async.py +0 -28
  188. package/generator/test/generic_mock_api_tests/asynctests/test_server_versions_versioned_async.py +0 -34
  189. package/generator/test/generic_mock_api_tests/asynctests/test_special_headers_conditional_request_async.py +0 -38
  190. package/generator/test/generic_mock_api_tests/asynctests/test_special_headers_repeatability_async.py +0 -19
  191. package/generator/test/generic_mock_api_tests/asynctests/test_specs_documentation_async.py +0 -59
  192. package/generator/test/generic_mock_api_tests/asynctests/test_streaming_jsonl_async.py +0 -27
  193. package/generator/test/generic_mock_api_tests/asynctests/test_typetest_array_async.py +0 -127
  194. package/generator/test/generic_mock_api_tests/asynctests/test_typetest_dictionary_async.py +0 -98
  195. package/generator/test/generic_mock_api_tests/asynctests/test_typetest_enum_extensible_async.py +0 -25
  196. package/generator/test/generic_mock_api_tests/asynctests/test_typetest_enum_fixed_async.py +0 -27
  197. package/generator/test/generic_mock_api_tests/asynctests/test_typetest_file_async.py +0 -59
  198. package/generator/test/generic_mock_api_tests/asynctests/test_typetest_model_empty_async.py +0 -32
  199. package/generator/test/generic_mock_api_tests/asynctests/test_typetest_model_inheritance_enum_discriminator_async.py +0 -70
  200. package/generator/test/generic_mock_api_tests/asynctests/test_typetest_model_inheritance_nested_discriminator_async.py +0 -85
  201. package/generator/test/generic_mock_api_tests/asynctests/test_typetest_model_inheritance_not_discriminated_async.py +0 -34
  202. package/generator/test/generic_mock_api_tests/asynctests/test_typetest_model_inheritance_recursive_async.py +0 -34
  203. package/generator/test/generic_mock_api_tests/asynctests/test_typetest_model_inheritance_single_discriminator_async.py +0 -67
  204. package/generator/test/generic_mock_api_tests/asynctests/test_typetest_model_usage_async.py +0 -32
  205. package/generator/test/generic_mock_api_tests/asynctests/test_typetest_model_visibility_async.py +0 -47
  206. package/generator/test/generic_mock_api_tests/asynctests/test_typetest_property_additionalproperties_async.py +0 -353
  207. package/generator/test/generic_mock_api_tests/asynctests/test_typetest_property_nullable_async.py +0 -110
  208. package/generator/test/generic_mock_api_tests/asynctests/test_typetest_property_optional_async.py +0 -197
  209. package/generator/test/generic_mock_api_tests/asynctests/test_typetest_property_valuetypes_async.py +0 -315
  210. package/generator/test/generic_mock_api_tests/asynctests/test_typetest_scalar_async.py +0 -60
  211. package/generator/test/generic_mock_api_tests/asynctests/test_typetest_union_async.py +0 -90
  212. package/generator/test/generic_mock_api_tests/asynctests/test_versioning_added_async.py +0 -36
  213. package/generator/test/generic_mock_api_tests/asynctests/test_versioning_made_optional_async.py +0 -21
  214. package/generator/test/generic_mock_api_tests/asynctests/test_versioning_removed_async.py +0 -39
  215. package/generator/test/generic_mock_api_tests/asynctests/test_versioning_renamed_from_async.py +0 -29
  216. package/generator/test/generic_mock_api_tests/asynctests/test_versioning_return_type_changed_from_async.py +0 -18
  217. package/generator/test/generic_mock_api_tests/asynctests/test_versioning_type_changed_from_async.py +0 -22
  218. package/generator/test/generic_mock_api_tests/conftest.py +0 -75
  219. package/generator/test/generic_mock_api_tests/data/image.jpg +0 -0
  220. package/generator/test/generic_mock_api_tests/data/image.png +0 -0
  221. package/generator/test/generic_mock_api_tests/test_authentication.py +0 -130
  222. package/generator/test/generic_mock_api_tests/test_encode_array.py +0 -126
  223. package/generator/test/generic_mock_api_tests/test_encode_bytes.py +0 -128
  224. package/generator/test/generic_mock_api_tests/test_encode_datetime.py +0 -123
  225. package/generator/test/generic_mock_api_tests/test_headasboolean.py +0 -33
  226. package/generator/test/generic_mock_api_tests/test_parameters_body_optionality.py +0 -27
  227. package/generator/test/generic_mock_api_tests/test_parameters_collection_format.py +0 -33
  228. package/generator/test/generic_mock_api_tests/test_parameters_path.py +0 -22
  229. package/generator/test/generic_mock_api_tests/test_parameters_query.py +0 -17
  230. package/generator/test/generic_mock_api_tests/test_payload_json_merge_patch.py +0 -93
  231. package/generator/test/generic_mock_api_tests/test_payload_media_type.py +0 -25
  232. package/generator/test/generic_mock_api_tests/test_payload_pageable.py +0 -99
  233. package/generator/test/generic_mock_api_tests/test_payload_xml.py +0 -135
  234. package/generator/test/generic_mock_api_tests/test_response_status_code_range.py +0 -36
  235. package/generator/test/generic_mock_api_tests/test_routes.py +0 -285
  236. package/generator/test/generic_mock_api_tests/test_server_endpoint_not_defined.py +0 -17
  237. package/generator/test/generic_mock_api_tests/test_server_path_multiple.py +0 -21
  238. package/generator/test/generic_mock_api_tests/test_server_path_single.py +0 -17
  239. package/generator/test/generic_mock_api_tests/test_server_versions_not_versioned.py +0 -25
  240. package/generator/test/generic_mock_api_tests/test_server_versions_versioned.py +0 -30
  241. package/generator/test/generic_mock_api_tests/test_special_headers_conditional_request.py +0 -34
  242. package/generator/test/generic_mock_api_tests/test_special_headers_repeatability.py +0 -18
  243. package/generator/test/generic_mock_api_tests/test_specs_documentation.py +0 -51
  244. package/generator/test/generic_mock_api_tests/test_streaming_jsonl.py +0 -25
  245. package/generator/test/generic_mock_api_tests/test_typetest_array.py +0 -111
  246. package/generator/test/generic_mock_api_tests/test_typetest_dictionary.py +0 -86
  247. package/generator/test/generic_mock_api_tests/test_typetest_enum_extensible.py +0 -23
  248. package/generator/test/generic_mock_api_tests/test_typetest_enum_fixed.py +0 -25
  249. package/generator/test/generic_mock_api_tests/test_typetest_file.py +0 -52
  250. package/generator/test/generic_mock_api_tests/test_typetest_model_empty.py +0 -29
  251. package/generator/test/generic_mock_api_tests/test_typetest_model_inheritance_enum_discriminator.py +0 -58
  252. package/generator/test/generic_mock_api_tests/test_typetest_model_inheritance_nested_discriminator.py +0 -79
  253. package/generator/test/generic_mock_api_tests/test_typetest_model_inheritance_not_discriminated.py +0 -31
  254. package/generator/test/generic_mock_api_tests/test_typetest_model_inheritance_recursive.py +0 -32
  255. package/generator/test/generic_mock_api_tests/test_typetest_model_inheritance_single_discriminator.py +0 -60
  256. package/generator/test/generic_mock_api_tests/test_typetest_model_usage.py +0 -28
  257. package/generator/test/generic_mock_api_tests/test_typetest_model_visibility.py +0 -40
  258. package/generator/test/generic_mock_api_tests/test_typetest_property_additionalproperties.py +0 -314
  259. package/generator/test/generic_mock_api_tests/test_typetest_property_nullable.py +0 -102
  260. package/generator/test/generic_mock_api_tests/test_typetest_property_optional.py +0 -174
  261. package/generator/test/generic_mock_api_tests/test_typetest_property_valuetypes.py +0 -286
  262. package/generator/test/generic_mock_api_tests/test_typetest_scalar.py +0 -53
  263. package/generator/test/generic_mock_api_tests/test_typetest_union.py +0 -80
  264. package/generator/test/generic_mock_api_tests/test_typetest_union_discriminated.py +0 -290
  265. package/generator/test/generic_mock_api_tests/test_versioning_added.py +0 -33
  266. package/generator/test/generic_mock_api_tests/test_versioning_made_optional.py +0 -20
  267. package/generator/test/generic_mock_api_tests/test_versioning_removed.py +0 -37
  268. package/generator/test/generic_mock_api_tests/test_versioning_renamed_from.py +0 -27
  269. package/generator/test/generic_mock_api_tests/test_versioning_return_type_changed_from.py +0 -17
  270. package/generator/test/generic_mock_api_tests/test_versioning_type_changed_from.py +0 -21
  271. package/generator/test/unbranded/mock_api_tests/asynctests/test_auth_flow_async.py +0 -19
  272. package/generator/test/unbranded/mock_api_tests/asynctests/test_encode_duration_async.py +0 -63
  273. package/generator/test/unbranded/mock_api_tests/asynctests/test_encode_numeric_async.py +0 -35
  274. package/generator/test/unbranded/mock_api_tests/asynctests/test_parameters_basic_async.py +0 -24
  275. package/generator/test/unbranded/mock_api_tests/asynctests/test_parameters_spread_async.py +0 -76
  276. package/generator/test/unbranded/mock_api_tests/asynctests/test_payload_content_negotiation_async.py +0 -37
  277. package/generator/test/unbranded/mock_api_tests/asynctests/test_payload_multipart_async.py +0 -218
  278. package/generator/test/unbranded/mock_api_tests/asynctests/test_serialization_encoded_name_json_async.py +0 -24
  279. package/generator/test/unbranded/mock_api_tests/asynctests/test_special_words_async.py +0 -73
  280. package/generator/test/unbranded/mock_api_tests/asynctests/test_unbranded_async.py +0 -24
  281. package/generator/test/unbranded/mock_api_tests/conftest.py +0 -91
  282. package/generator/test/unbranded/mock_api_tests/data/image.jpg +0 -0
  283. package/generator/test/unbranded/mock_api_tests/data/image.png +0 -0
  284. package/generator/test/unbranded/mock_api_tests/test_auth_flow.py +0 -17
  285. package/generator/test/unbranded/mock_api_tests/test_encode_duration.py +0 -60
  286. package/generator/test/unbranded/mock_api_tests/test_encode_numeric.py +0 -32
  287. package/generator/test/unbranded/mock_api_tests/test_parameters_basic.py +0 -22
  288. package/generator/test/unbranded/mock_api_tests/test_parameters_spread.py +0 -66
  289. package/generator/test/unbranded/mock_api_tests/test_payload_content_negotiation.py +0 -33
  290. package/generator/test/unbranded/mock_api_tests/test_payload_multipart.py +0 -200
  291. package/generator/test/unbranded/mock_api_tests/test_serialization_encoded_name_json.py +0 -22
  292. package/generator/test/unbranded/mock_api_tests/test_special_words.py +0 -66
  293. package/generator/test/unbranded/mock_api_tests/test_unbranded.py +0 -65
  294. package/generator/test/unbranded/requirements.txt +0 -69
  295. package/generator/test/unbranded/tox.ini +0 -64
  296. package/generator/test/unittests/conftest.py +0 -15
  297. package/generator/test/unittests/requirements.txt +0 -3
  298. package/generator/test/unittests/test_enums.py +0 -89
  299. package/generator/test/unittests/test_model_base_serialization.py +0 -4906
  300. package/generator/test/unittests/test_model_base_xml_serialization.py +0 -1239
  301. package/generator/test/unittests/test_name_converter.py +0 -35
  302. package/generator/test/unittests/test_optional_return_type.py +0 -268
  303. package/generator/test/unittests/test_parameter_ordering.py +0 -104
  304. package/generator/test/unittests/test_sort_schema.py +0 -93
  305. package/generator/test/unittests/tox.ini +0 -5
  306. /package/eng/scripts/ci/{mypy.ini → config/mypy.ini} +0 -0
  307. /package/eng/scripts/ci/{pylintrc → config/pylintrc} +0 -0
  308. /package/eng/scripts/ci/{pyproject.toml → config/pyproject.toml} +0 -0
  309. /package/eng/scripts/ci/{pyrightconfig.json → config/pyrightconfig.json} +0 -0
@@ -1,4 +1,30 @@
1
1
  #Requires -Version 7.0
2
+ <#
3
+ .SYNOPSIS
4
+ Builds and packages the TypeSpec Python emitter for publishing.
5
+
6
+ .DESCRIPTION
7
+ This script is called by the CI pipeline to create publishable packages.
8
+ It runs:
9
+ 1. npm run build - Compile TypeScript emitter and build Python wheel
10
+ 2. npm run lint - Run linting (Linux only)
11
+ 3. npm pack - Create npm tarball for publishing
12
+
13
+ .PARAMETER BuildNumber
14
+ The build number for versioning.
15
+
16
+ .PARAMETER Output
17
+ Output directory for built packages. Defaults to ./ci-build.
18
+
19
+ .PARAMETER Prerelease
20
+ Flag indicating if this is a prerelease build.
21
+
22
+ .PARAMETER PublishType
23
+ Type of publish: "internal" for dev feed, otherwise public.
24
+
25
+ .EXAMPLE
26
+ ./Build-Packages.ps1 -Output ./dist
27
+ #>
2
28
 
3
29
  param(
4
30
  [string] $BuildNumber,
@@ -7,6 +33,15 @@ param(
7
33
  [string] $PublishType
8
34
  )
9
35
 
36
+ $ErrorActionPreference = 'Stop'
37
+ Set-StrictMode -Version 3.0
38
+
39
+ # Setup paths and helpers
40
+ $packageRoot = (Resolve-Path "$PSScriptRoot/../..").Path.Replace('\', '/')
41
+ . "$packageRoot/../../eng/emitters/scripts/CommandInvocation-Helpers.ps1"
42
+ Set-ConsoleEncoding
43
+
44
+ # Helper function to write package info for downstream publishing
10
45
  function Write-PackageInfo {
11
46
  param(
12
47
  [string] $packageName,
@@ -15,81 +50,71 @@ function Write-PackageInfo {
15
50
  )
16
51
 
17
52
  $packageInfoPath = "$outputPath/PackageInfo"
18
-
19
53
  if (!(Test-Path $packageInfoPath)) {
20
54
  New-Item -ItemType Directory -Force -Path $packageInfoPath | Out-Null
21
55
  }
22
56
 
23
57
  @{
24
- Name = $packageName
25
- Version = $version
58
+ Name = $packageName
59
+ Version = $version
26
60
  DirectoryPath = $directoryPath
27
- SdkType = "client"
28
- IsNewSdk = $true
61
+ SdkType = "client"
62
+ IsNewSdk = $true
29
63
  ReleaseStatus = "Unreleased"
30
64
  } | ConvertTo-Json | Set-Content -Path "$packageInfoPath/$packageName.json"
31
65
  }
32
66
 
33
- $ErrorActionPreference = 'Stop'
34
- Set-StrictMode -Version 3.0
35
- $packageRoot = (Resolve-Path "$PSScriptRoot/../..").Path.Replace('\', '/')
36
- . "$packageRoot/../../eng/emitters/scripts/CommandInvocation-Helpers.ps1"
37
- Set-ConsoleEncoding
38
-
39
67
  Write-Host "Building packages for BuildNumber: '$BuildNumber', Output: '$Output', Prerelease: '$Prerelease', PublishType: '$PublishType'"
40
68
 
69
+ # Setup output directory
41
70
  $outputPath = $Output ? $Output : "$packageRoot/ci-build"
42
-
43
- # create the output folders
44
71
  $outputPath = New-Item -ItemType Directory -Force -Path $outputPath | Select-Object -ExpandProperty FullName
45
72
  New-Item -ItemType Directory -Force -Path "$outputPath/packages" | Out-Null
46
73
 
47
- Write-Host "Getting existing version"
74
+ # Get package version
48
75
  $emitterVersion = node -p -e "require('$packageRoot/package.json').version"
76
+ Write-Host "Package version: $emitterVersion"
49
77
 
50
- # build the generator
51
- Push-Location "$packageRoot/generator"
52
-
53
- # build and pack the emitter with the generator
54
78
  Push-Location "$packageRoot"
55
79
  try {
56
- Write-Host "Working in $PWD"
57
-
80
+ # Step 1: Build the emitter and generator
81
+ Write-Host "`n=== Building emitter and generator ===" -ForegroundColor Cyan
58
82
  Invoke-LoggedCommand "npm run build" -GroupOutput
59
83
 
60
- # Only run lint:py on Linux OS
84
+ # Step 2: Run linting (Linux only, as CI runs on Linux)
61
85
  if ($IsLinux) {
62
- Write-Host "run lint check for pygen"
63
- Invoke-LoggedCommand "npm run lint:py" -GroupOutput
86
+ Write-Host "`n=== Running lint checks ===" -ForegroundColor Cyan
87
+ Invoke-LoggedCommand "npm run lint" -GroupOutput
64
88
  }
65
89
 
66
- # pack the emitter
90
+ # Step 3: Create npm package
91
+ Write-Host "`n=== Creating npm package ===" -ForegroundColor Cyan
67
92
  Invoke-LoggedCommand "npm pack"
68
93
  Copy-Item "typespec-http-client-python-$emitterVersion.tgz" -Destination "$outputPath/packages"
69
94
 
70
- # install packed emitter to check dependencies
95
+ # Step 4: Verify package can be installed
96
+ Write-Host "`n=== Verifying package installation ===" -ForegroundColor Cyan
71
97
  Invoke-LoggedCommand "npm install typespec-http-client-python-$emitterVersion.tgz" -GroupOutput
72
98
 
73
- Write-PackageInfo -packageName "typespec-http-client-python" -directoryPath "packages/http-client-python/emitter/src" -version $emitterVersion
99
+ # Write package info for publishing pipeline
100
+ Write-PackageInfo -packageName "typespec-http-client-python" `
101
+ -directoryPath "packages/http-client-python/emitter/src" `
102
+ -version $emitterVersion
74
103
  }
75
104
  finally {
76
105
  Pop-Location
77
106
  }
78
107
 
108
+ # Generate override URLs for internal publishing
109
+ $overrides = @{}
79
110
  if ($PublishType -eq "internal") {
80
111
  $feedUrl = "https://pkgs.dev.azure.com/azure-sdk/public/_packaging/azure-sdk-for-js/npm/registry"
81
-
82
- $overrides = @{
83
- "@typespec/http-client-python" = "$feedUrl/@typespec/http-client-python/-/http-client-python-$emitterVersion.tgz"
84
- }
85
- } else {
86
- $overrides = @{}
112
+ $overrides["@typespec/http-client-python"] = "$feedUrl/@typespec/http-client-python/-/http-client-python-$emitterVersion.tgz"
87
113
  }
88
-
89
114
  $overrides | ConvertTo-Json | Set-Content "$outputPath/overrides.json"
90
115
 
91
- $packageMatrix = [ordered]@{
92
- "emitter" = $emitterVersion
93
- }
116
+ # Write package version matrix
117
+ @{ "emitter" = $emitterVersion } | ConvertTo-Json | Set-Content "$outputPath/package-versions.json"
94
118
 
95
- $packageMatrix | ConvertTo-Json | Set-Content "$outputPath/package-versions.json"
119
+ Write-Host "`n=== Build complete ===" -ForegroundColor Green
120
+ Write-Host "Output: $outputPath"
@@ -1,4 +1,21 @@
1
1
  #Requires -Version 7.0
2
+ <#
3
+ .SYNOPSIS
4
+ Checks for uncommitted git changes.
5
+
6
+ .DESCRIPTION
7
+ This script verifies that there are no uncommitted changes in the repository.
8
+ It excludes package.json and package-lock.json from the check since those
9
+ may be modified during npm operations.
10
+
11
+ Used by CI to ensure regeneration produces consistent output.
12
+
13
+ .PARAMETER Exceptions
14
+ Additional paths to exclude from the check (not currently used).
15
+
16
+ .EXAMPLE
17
+ ./Check-GitChanges.ps1
18
+ #>
2
19
 
3
20
  param(
4
21
  [string] $Exceptions
@@ -6,17 +23,27 @@ param(
6
23
 
7
24
  $ErrorActionPreference = 'Stop'
8
25
  Set-StrictMode -Version 3.0
26
+
27
+ # Setup paths and helpers
9
28
  $packageRoot = (Resolve-Path "$PSScriptRoot/../..").Path.Replace('\', '/')
10
29
  . "$packageRoot/../../eng/emitters/scripts/CommandInvocation-Helpers.ps1"
11
30
  Set-ConsoleEncoding
12
31
 
13
- $diffExcludes = @(
32
+ # Files to exclude from diff check (these may change during npm operations)
33
+ $excludedFiles = @(
14
34
  "$packageRoot/package.json"
15
35
  "$packageRoot/package-lock.json"
16
- ) | ForEach-Object { "`":(exclude)$_`"" } | Join-String -Separator ' '
36
+ )
17
37
 
38
+ $diffExcludes = $excludedFiles | ForEach-Object { "`":(exclude)$_`"" } | Join-String -Separator ' '
39
+
40
+ # Check for changes, ignoring whitespace differences at end of lines
18
41
  Invoke-LoggedCommand "git -c core.safecrlf=false diff --ignore-space-at-eol --exit-code -- $diffExcludes" -IgnoreExitCode
19
42
 
20
- if($LastExitCode -ne 0) {
43
+ if ($LastExitCode -ne 0) {
44
+ Write-Host "`nUncommitted changes detected!" -ForegroundColor Red
45
+ Write-Host "Run 'npm run regenerate' locally and commit the changes."
21
46
  throw "Changes detected"
22
47
  }
48
+
49
+ Write-Host "No changes detected." -ForegroundColor Green
@@ -1,26 +1,65 @@
1
- # Return list of nupkg artifacts
2
- function Get-Package-Artifacts ($location, $filter)
3
- {
4
- $filterToUse = $filter.StartsWith("typespec-") ? $filter.SubString(0, $filter.Length - 1) + ".api.json" : $filter
1
+ <#
2
+ .SYNOPSIS
3
+ Helper functions for finding package artifacts.
4
+
5
+ .DESCRIPTION
6
+ These functions are used by the publishing pipeline to locate
7
+ built package artifacts for API review and publishing.
8
+ #>
9
+
10
+ <#
11
+ .SYNOPSIS
12
+ Gets package artifacts from a directory.
13
+
14
+ .PARAMETER location
15
+ The directory containing the packages folder.
16
+
17
+ .PARAMETER filter
18
+ Filter pattern for matching package files.
19
+ #>
20
+ function Get-Package-Artifacts {
21
+ param(
22
+ [string] $location,
23
+ [string] $filter
24
+ )
25
+
26
+ # Convert typespec package filter to API json filter
27
+ $filterToUse = if ($filter.StartsWith("typespec-")) {
28
+ $filter.SubString(0, $filter.Length - 1) + ".api.json"
29
+ } else {
30
+ $filter
31
+ }
5
32
 
6
33
  $packages = Get-ChildItem -Path "$location/packages" -Filter $filterToUse -Recurse
7
- if (!$packages)
8
- {
9
- Write-Host "$($location)/packages does not have any packages matching filter $($filterToUse)"
34
+ if (!$packages) {
35
+ Write-Host "$location/packages does not have any packages matching filter $filterToUse"
10
36
  return $null
11
37
  }
38
+
12
39
  return $packages[0]
13
40
  }
14
41
 
15
- function Find-Artifacts-For-Apireview($artifactDir, $packageName)
16
- {
17
- # Find all nupkg files in given artifact directory
42
+ <#
43
+ .SYNOPSIS
44
+ Finds artifacts for API review.
45
+
46
+ .PARAMETER artifactDir
47
+ Directory containing build artifacts.
48
+
49
+ .PARAMETER packageName
50
+ Name of the package to find.
51
+ #>
52
+ function Find-Artifacts-For-Apireview {
53
+ param(
54
+ [string] $artifactDir,
55
+ [string] $packageName
56
+ )
57
+
18
58
  $package = Get-Package-Artifacts $artifactDir "$packageName*"
19
- if (!$package)
20
- {
21
- Write-Host "Package is not available in artifact path $($artifactDir)/packages"
59
+ if (!$package) {
60
+ Write-Host "Package is not available in artifact path $artifactDir/packages"
22
61
  return $null
23
62
  }
24
- $packages = @{ $package.Name = $package.FullName }
25
- return $packages
63
+
64
+ return @{ $package.Name = $package.FullName }
26
65
  }
@@ -1,14 +1,48 @@
1
1
  #Requires -Version 7.0
2
+ <#
3
+ .SYNOPSIS
4
+ Regenerates all test fixtures and documentation.
2
5
 
3
- Import-Module "$PSScriptRoot\Generation.psm1" -DisableNameChecking -Force;
6
+ .DESCRIPTION
7
+ This script is called by the CI pipeline to regenerate test outputs.
8
+ It runs:
9
+ 1. npm run build - Compile TypeScript emitter and build Python wheel
10
+ 2. npm run regenerate - Regenerate all test fixtures from TypeSpec files
11
+ 3. npm run regen-docs - Regenerate API documentation
4
12
 
5
- $repoRoot = Resolve-Path (Join-Path $PSScriptRoot '..' '..')
13
+ .EXAMPLE
14
+ ./Generate.ps1
15
+ #>
6
16
 
7
- Write-Host "Building project ..."
8
- & npm run build
17
+ $ErrorActionPreference = 'Stop'
18
+ Set-StrictMode -Version 3.0
9
19
 
10
- Write-Host "Regenerating project ..."
11
- & npm run regenerate
20
+ # Setup paths
21
+ $packageRoot = (Resolve-Path "$PSScriptRoot/../..").Path.Replace('\', '/')
12
22
 
13
- Write-Host "Regenerating docs ..."
14
- & npm run regen-docs
23
+ Push-Location "$packageRoot"
24
+ try {
25
+ Write-Host "=== Building project ===" -ForegroundColor Cyan
26
+ & npm run build
27
+ if ($LASTEXITCODE -ne 0) { throw "Build failed" }
28
+
29
+ Write-Host "`n=== Regenerating test fixtures ===" -ForegroundColor Cyan
30
+ & npm run regenerate
31
+ if ($LASTEXITCODE -ne 0) { throw "Regeneration failed" }
32
+
33
+ Write-Host "`n=== Regenerating documentation ===" -ForegroundColor Cyan
34
+ # Check if tspd is available (requires full monorepo build)
35
+ $tspdCli = Join-Path $packageRoot "../../packages/tspd/dist/src/cli.js"
36
+ if (Test-Path $tspdCli) {
37
+ & npm run regen-docs
38
+ if ($LASTEXITCODE -ne 0) { throw "Documentation regeneration failed" }
39
+ } else {
40
+ Write-Host "Skipping documentation regeneration (tspd not built)" -ForegroundColor Yellow
41
+ Write-Host "Run from monorepo root with full build to regenerate docs" -ForegroundColor Yellow
42
+ }
43
+
44
+ Write-Host "`n=== Generation complete ===" -ForegroundColor Green
45
+ }
46
+ finally {
47
+ Pop-Location
48
+ }
@@ -1,22 +1,51 @@
1
+ <#
2
+ .SYNOPSIS
3
+ PowerShell module with helper functions for generation scripts.
4
+
5
+ .DESCRIPTION
6
+ This module provides the Invoke function for running shell commands
7
+ cross-platform (Windows, Linux, macOS).
8
+ #>
9
+
1
10
  $repoRoot = Resolve-Path (Join-Path $PSScriptRoot '..')
2
11
 
3
- function Invoke($command, $executePath=$repoRoot)
4
- {
5
- Write-Host "> $command"
12
+ <#
13
+ .SYNOPSIS
14
+ Invokes a shell command cross-platform.
15
+
16
+ .PARAMETER command
17
+ The command to execute.
18
+
19
+ .PARAMETER executePath
20
+ The directory to execute the command in. Defaults to repo root.
21
+
22
+ .EXAMPLE
23
+ Invoke "npm run build"
24
+ #>
25
+ function Invoke {
26
+ param(
27
+ [string] $command,
28
+ [string] $executePath = $repoRoot
29
+ )
30
+
31
+ Write-Host "> $command" -ForegroundColor Cyan
32
+
6
33
  Push-Location $executePath
7
- if ($IsLinux -or $IsMacOs)
8
- {
9
- sh -c "$command 2>&1"
10
- }
11
- else
12
- {
13
- cmd /c "$command 2>&1"
14
- }
15
- Pop-Location
34
+ try {
35
+ if ($IsLinux -or $IsMacOs) {
36
+ sh -c "$command 2>&1"
37
+ }
38
+ else {
39
+ cmd /c "$command 2>&1"
40
+ }
16
41
 
17
- if($LastExitCode -ne 0)
18
- {
19
- Write-Error "Command failed to execute: $command"
42
+ if ($LastExitCode -ne 0) {
43
+ throw "Command failed: $command"
44
+ }
45
+ }
46
+ finally {
47
+ Pop-Location
20
48
  }
21
49
  }
50
+
22
51
  Export-ModuleMember -Function "Invoke"
@@ -1,4 +1,21 @@
1
1
  #Requires -Version 7.0
2
+ <#
3
+ .SYNOPSIS
4
+ Initializes the repository by installing npm dependencies.
5
+
6
+ .DESCRIPTION
7
+ This script is called by the CI pipeline to set up the repository.
8
+ It runs `npm ci` to install dependencies from package-lock.json.
9
+
10
+ .PARAMETER BuildArtifactsPath
11
+ Optional path to build artifacts (used in CI for caching lock files).
12
+
13
+ .PARAMETER UseTypeSpecNext
14
+ Optional switch for using TypeSpec next version (not currently used).
15
+
16
+ .EXAMPLE
17
+ ./Initialize-Repository.ps1
18
+ #>
2
19
 
3
20
  param(
4
21
  [string] $BuildArtifactsPath,
@@ -7,32 +24,33 @@ param(
7
24
 
8
25
  $ErrorActionPreference = 'Stop'
9
26
  Set-StrictMode -Version 3.0
27
+
28
+ # Setup paths and helpers
10
29
  $packageRoot = (Resolve-Path "$PSScriptRoot/../..").Path.Replace('\', '/')
11
30
  . "$packageRoot/../../eng/emitters/scripts/CommandInvocation-Helpers.ps1"
12
31
  Set-ConsoleEncoding
13
32
 
14
33
  Push-Location "$packageRoot"
15
34
  try {
35
+ # Clean install of npm dependencies
16
36
  if (Test-Path "./node_modules") {
37
+ Write-Host "Removing existing node_modules..."
17
38
  Remove-Item -Recurse -Force "./node_modules"
18
39
  }
19
40
 
20
- # install and list npm packages
21
-
41
+ Write-Host "Installing npm dependencies..."
22
42
  Invoke-LoggedCommand "npm ci"
23
-
24
43
  Invoke-LoggedCommand "npm ls -a" -GroupOutput
25
44
 
26
- Write-Host "artifactStagingDirectory: $env:BUILD_ARTIFACTSTAGINGDIRECTORY"
27
- Write-Host "BuildArtifactsPath: $BuildArtifactsPath"
45
+ # Copy lock files to artifacts for CI caching (if running in Azure DevOps)
28
46
  $artifactStagingDirectory = $env:BUILD_ARTIFACTSTAGINGDIRECTORY
29
47
  if ($artifactStagingDirectory -and !$BuildArtifactsPath) {
30
- $lockFilesPath = "$artifactStagingDirectory/lock-files"
31
- New-Item -ItemType Directory -Path "$lockFilesPath/emitter" | Out-Null
32
-
33
- Write-Host "Copying emitter/package.json and emitter/package-lock.json to $lockFilesPath"
34
- Copy-Item './package.json' "$lockFilesPath/emitter/package.json" -Force
35
- Copy-Item './package-lock.json' "$lockFilesPath/emitter/package-lock.json" -Force
48
+ $lockFilesPath = "$artifactStagingDirectory/lock-files/emitter"
49
+ New-Item -ItemType Directory -Path $lockFilesPath -Force | Out-Null
50
+
51
+ Write-Host "Copying lock files to $lockFilesPath"
52
+ Copy-Item './package.json' "$lockFilesPath/package.json" -Force
53
+ Copy-Item './package-lock.json' "$lockFilesPath/package-lock.json" -Force
36
54
  }
37
55
  }
38
56
  finally {
@@ -1,4 +1,32 @@
1
1
  #Requires -Version 7.0
2
+ <#
3
+ .SYNOPSIS
4
+ Runs tests for the TypeSpec Python emitter.
5
+
6
+ .DESCRIPTION
7
+ This script is called by the CI pipeline to run tests.
8
+
9
+ With -UnitTests:
10
+ - Runs npm run build (compile emitter)
11
+
12
+ With -GenerationChecks:
13
+ - Runs npm run build (compile emitter)
14
+ - Runs Generate.ps1 (regenerate test fixtures)
15
+ - Runs Check-GitChanges.ps1 (verify no uncommitted changes)
16
+ - Runs npm run ci (full test suite: pytest, lint, mypy, pyright)
17
+
18
+ .PARAMETER UnitTests
19
+ Run unit tests only (just builds the project).
20
+
21
+ .PARAMETER GenerationChecks
22
+ Run full generation checks and test suite.
23
+
24
+ .PARAMETER Filter
25
+ Optional filter pattern for tests (not currently used).
26
+
27
+ .EXAMPLE
28
+ ./Test-Packages.ps1 -GenerationChecks
29
+ #>
2
30
 
3
31
  param(
4
32
  [switch] $UnitTests,
@@ -7,57 +35,45 @@ param(
7
35
  )
8
36
 
9
37
  $ErrorActionPreference = 'Stop'
10
-
11
38
  Set-StrictMode -Version 3.0
39
+
40
+ # Setup paths and helpers
12
41
  $packageRoot = (Resolve-Path "$PSScriptRoot/../..").Path.Replace('\', '/')
13
42
  . "$packageRoot/../../eng/emitters/scripts/CommandInvocation-Helpers.ps1"
14
43
  Set-ConsoleEncoding
15
44
 
45
+ Write-Host "Python version:"
16
46
  Invoke-LoggedCommand "python --version"
17
47
 
18
48
  Push-Location $packageRoot
19
49
  try {
20
50
  if ($UnitTests) {
21
- Push-Location "$packageRoot"
22
- try {
23
-
24
- Write-Host "Updated PATH: $env:PATH"
25
- # test the emitter
26
- Invoke-LoggedCommand "npm run build" -GroupOutput
27
-
28
- }
29
- finally {
30
- Pop-Location
31
- }
51
+ Write-Host "`n=== Running unit tests ===" -ForegroundColor Cyan
52
+ Invoke-LoggedCommand "npm run build" -GroupOutput
32
53
  }
54
+
33
55
  if ($GenerationChecks) {
34
- Set-StrictMode -Version 1
35
-
36
- # run E2E Test for TypeSpec emitter
37
- Write-Host "Generating test projects ..."
56
+ # Step 1: Regenerate all test fixtures
57
+ Write-Host "`n=== Regenerating test fixtures ===" -ForegroundColor Cyan
38
58
  & "$packageRoot/eng/scripts/Generate.ps1"
39
- Write-Host 'Code generation is completed.'
40
59
 
60
+ # Step 2: Check for uncommitted changes (regeneration should be clean)
61
+ Write-Host "`n=== Checking for uncommitted changes ===" -ForegroundColor Cyan
41
62
  try {
42
- Write-Host 'Checking for differences in generated code...'
43
63
  & "$packageRoot/eng/scripts/Check-GitChanges.ps1"
44
- Write-Host 'Done. No code generation differences detected.'
64
+ Write-Host "No uncommitted changes detected." -ForegroundColor Green
45
65
  }
46
66
  catch {
47
- Write-Error 'Generated code is not up to date. Please run: eng/Generate.ps1'
67
+ Write-Error "Generated code is not up to date. Please run: npm run regenerate"
48
68
  }
49
69
 
50
- try {
51
- Write-Host "Pip List"
52
- & pip list
53
- # Run tox
54
- Write-Host 'Running tests'
55
- & npm run ci
56
- Write-Host 'tox tests passed'
57
- }
58
- catch {
59
- Write-Error "Spector tests failed: $_"
60
- }
70
+ # Step 3: Run full test suite
71
+ Write-Host "`n=== Running full test suite ===" -ForegroundColor Cyan
72
+ Write-Host "Installed packages:"
73
+ & pip list
74
+
75
+ Invoke-LoggedCommand "npm run ci"
76
+ Write-Host "All tests passed." -ForegroundColor Green
61
77
  }
62
78
  }
63
79
  finally {
@@ -0,0 +1,54 @@
1
+ // @ts-check
2
+ // Standalone eslint config for http-client-python package
3
+ // This config is used in CI where monorepo dependencies may not be available
4
+ import eslint from "@eslint/js";
5
+ import tsEslint from "typescript-eslint";
6
+
7
+ export default [
8
+ {
9
+ ignores: ["**/dist/**/*", "**/node_modules/**/*"],
10
+ },
11
+ eslint.configs.recommended,
12
+ ...tsEslint.configs.recommended,
13
+ {
14
+ rules: {
15
+ // TypeScript plugin overrides
16
+ "@typescript-eslint/no-non-null-assertion": "off",
17
+ "@typescript-eslint/no-explicit-any": "off",
18
+ "@typescript-eslint/no-inferrable-types": "off",
19
+ "@typescript-eslint/no-empty-function": "off",
20
+ "@typescript-eslint/no-empty-interface": "off",
21
+ "@typescript-eslint/no-empty-object-type": "off",
22
+ "@typescript-eslint/no-unused-vars": [
23
+ "warn",
24
+ {
25
+ varsIgnorePattern: "^_",
26
+ argsIgnorePattern: ".*",
27
+ ignoreRestSiblings: true,
28
+ caughtErrorsIgnorePattern: ".*",
29
+ },
30
+ ],
31
+ "@typescript-eslint/no-unused-expressions": [
32
+ "warn",
33
+ { allowShortCircuit: true, allowTernary: true },
34
+ ],
35
+
36
+ // Core rules
37
+ "no-inner-declarations": "off",
38
+ "no-empty": "off",
39
+ "no-constant-condition": "off",
40
+ "no-case-declarations": "off",
41
+ "no-ex-assign": "off",
42
+ "no-undef": "off",
43
+ "prefer-const": [
44
+ "warn",
45
+ {
46
+ destructuring: "all",
47
+ },
48
+ ],
49
+ eqeqeq: ["warn", "always", { null: "ignore" }],
50
+ "no-console": "warn",
51
+ "symbol-description": "warn",
52
+ },
53
+ },
54
+ ];
@@ -1,6 +1,7 @@
1
1
  pyright==1.1.407
2
2
  pylint==4.0.4
3
3
  tox==4.16.0
4
+ tox-uv
4
5
  mypy==1.19.1
5
6
  colorama==0.4.6
6
7
  debugpy==1.8.2