@typespec/http-client-python 0.28.2 → 0.29.0
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/code-model.d.ts.map +1 -1
- package/dist/emitter/code-model.js +7 -6
- package/dist/emitter/code-model.js.map +1 -1
- package/dist/emitter/constants.d.ts +6 -0
- package/dist/emitter/constants.d.ts.map +1 -0
- package/dist/emitter/constants.js +27 -0
- package/dist/emitter/constants.js.map +1 -0
- package/dist/emitter/emitter.d.ts.map +1 -1
- package/dist/emitter/emitter.js +193 -119
- package/dist/emitter/emitter.js.map +1 -1
- package/dist/emitter/http.d.ts.map +1 -1
- package/dist/emitter/http.js +33 -1
- package/dist/emitter/http.js.map +1 -1
- package/dist/emitter/lib.d.ts +37 -3
- package/dist/emitter/lib.d.ts.map +1 -1
- package/dist/emitter/lib.js +17 -0
- package/dist/emitter/lib.js.map +1 -1
- package/dist/emitter/run-python3.js +1 -1
- package/dist/emitter/run-python3.js.map +1 -1
- package/dist/emitter/system-requirements.js +6 -4
- package/dist/emitter/system-requirements.js.map +1 -1
- package/dist/emitter/types.d.ts +2 -5
- package/dist/emitter/types.d.ts.map +1 -1
- package/dist/emitter/types.js +86 -63
- package/dist/emitter/types.js.map +1 -1
- package/dist/emitter/utils.d.ts.map +1 -1
- package/dist/emitter/utils.js +16 -17
- package/dist/emitter/utils.js.map +1 -1
- package/emitter/src/code-model.ts +7 -13
- package/emitter/src/constants.ts +27 -0
- package/emitter/src/emitter.ts +241 -123
- package/emitter/src/http.ts +29 -1
- package/emitter/src/lib.ts +24 -0
- package/emitter/src/run-python3.ts +1 -1
- package/emitter/src/system-requirements.ts +4 -4
- package/emitter/src/types.ts +102 -62
- package/emitter/src/utils.ts +16 -18
- package/emitter/temp/tsconfig.tsbuildinfo +1 -1
- package/emitter/test/utils.test.ts +3 -0
- package/emitter/tsconfig.build.json +2 -1
- package/emitter/tsconfig.json +2 -1
- package/eng/scripts/Build-Packages.ps1 +62 -37
- package/eng/scripts/Check-GitChanges.ps1 +30 -3
- package/eng/scripts/Functions.ps1 +54 -15
- package/eng/scripts/Generate.ps1 +42 -8
- package/eng/scripts/Generation.psm1 +44 -15
- package/eng/scripts/Initialize-Repository.ps1 +29 -11
- package/eng/scripts/Test-Packages.ps1 +47 -31
- package/eng/scripts/ci/config/eslint-ci.config.mjs +64 -0
- package/eng/scripts/ci/{mypy.ini → config/mypy.ini} +1 -1
- package/eng/scripts/ci/{pylintrc → config/pylintrc} +1 -1
- package/eng/scripts/ci/{pyrightconfig.json → config/pyrightconfig.json} +1 -1
- package/eng/scripts/ci/dev_requirements.txt +2 -1
- package/eng/scripts/ci/format.ts +232 -2
- package/eng/scripts/ci/lint.ts +223 -20
- package/eng/scripts/ci/regenerate-common.ts +411 -136
- package/eng/scripts/ci/regenerate.ts +247 -101
- package/eng/scripts/ci/run-tests.ts +507 -0
- package/eng/scripts/ci/run_apiview.py +22 -16
- package/eng/scripts/ci/run_mypy.py +34 -23
- package/eng/scripts/ci/run_pylint.py +27 -19
- package/eng/scripts/ci/run_pyright.py +9 -5
- package/eng/scripts/ci/run_sphinx_build.py +24 -9
- package/eng/scripts/ci/typecheck.ts +225 -0
- package/eng/scripts/ci/util.py +61 -25
- package/eng/scripts/ci/utils.ts +5 -5
- package/eng/scripts/setup/__pycache__/package_manager.cpython-311.pyc +0 -0
- package/eng/scripts/setup/__pycache__/venvtools.cpython-311.pyc +0 -0
- package/eng/scripts/setup/build.ts +1 -1
- package/eng/scripts/setup/build_pygen_wheel.py +4 -3
- package/eng/scripts/setup/install.py +4 -3
- package/eng/scripts/setup/install.ts +1 -1
- package/eng/scripts/setup/prepare.py +3 -2
- package/eng/scripts/setup/prepare.ts +1 -1
- package/eng/scripts/setup/run-python3.ts +1 -1
- package/eng/scripts/setup/run_batch.py +197 -0
- package/eng/scripts/setup/run_tsp.py +3 -3
- package/eng/scripts/setup/system-requirements.ts +8 -4
- package/eng/scripts/setup/venvtools.py +1 -1
- package/generator/build/lib/pygen/__init__.py +1 -3
- package/generator/build/lib/pygen/codegen/__init__.py +0 -1
- package/generator/build/lib/pygen/codegen/models/base.py +0 -1
- package/generator/build/lib/pygen/codegen/models/client.py +2 -1
- package/generator/build/lib/pygen/codegen/models/code_model.py +1 -0
- package/generator/build/lib/pygen/codegen/models/enum_type.py +0 -1
- package/generator/build/lib/pygen/codegen/models/model_type.py +1 -7
- package/generator/build/lib/pygen/codegen/models/parameter.py +16 -14
- package/generator/build/lib/pygen/codegen/serializers/__init__.py +27 -12
- package/generator/build/lib/pygen/codegen/serializers/builder_serializer.py +12 -3
- package/generator/build/lib/pygen/codegen/serializers/general_serializer.py +6 -2
- package/generator/build/lib/pygen/codegen/serializers/import_serializer.py +17 -4
- package/generator/build/lib/pygen/codegen/serializers/parameter_serializer.py +17 -11
- package/generator/build/lib/pygen/codegen/templates/model_base.py.jinja2 +176 -71
- package/generator/build/lib/pygen/codegen/templates/packaging_templates/README.md.jinja2 +11 -3
- package/generator/build/lib/pygen/codegen/templates/packaging_templates/pyproject.toml.jinja2 +1 -1
- package/generator/build/lib/pygen/codegen/templates/serialization.py.jinja2 +5 -1
- package/generator/build/lib/pygen/preprocess/__init__.py +37 -30
- package/generator/component-detection-pip-report.json +7 -7
- package/generator/dist/pygen-0.1.0-py3-none-any.whl +0 -0
- package/generator/pygen/__init__.py +1 -3
- package/generator/pygen/codegen/__init__.py +0 -1
- package/generator/pygen/codegen/models/base.py +0 -1
- package/generator/pygen/codegen/models/client.py +2 -1
- package/generator/pygen/codegen/models/code_model.py +1 -0
- package/generator/pygen/codegen/models/enum_type.py +0 -1
- package/generator/pygen/codegen/models/model_type.py +1 -7
- package/generator/pygen/codegen/models/parameter.py +16 -14
- package/generator/pygen/codegen/serializers/__init__.py +27 -12
- package/generator/pygen/codegen/serializers/builder_serializer.py +12 -3
- package/generator/pygen/codegen/serializers/general_serializer.py +6 -2
- package/generator/pygen/codegen/serializers/import_serializer.py +17 -4
- package/generator/pygen/codegen/serializers/parameter_serializer.py +17 -11
- package/generator/pygen/codegen/templates/model_base.py.jinja2 +176 -71
- package/generator/pygen/codegen/templates/packaging_templates/README.md.jinja2 +11 -3
- package/generator/pygen/codegen/templates/packaging_templates/pyproject.toml.jinja2 +1 -1
- package/generator/pygen/codegen/templates/serialization.py.jinja2 +5 -1
- package/generator/pygen/preprocess/__init__.py +37 -30
- package/generator/pygen.egg-info/PKG-INFO +1 -2
- package/generator/pygen.egg-info/requires.txt +1 -1
- package/generator/setup.py +1 -2
- package/package.json +63 -42
- package/eng/scripts/ci/run-ci.ts +0 -89
- package/generator/test/azure/mock_api_tests/asynctests/test_azure_arm_commonproperties_async.py +0 -94
- package/generator/test/azure/mock_api_tests/asynctests/test_azure_arm_largeheader_async.py +0 -30
- package/generator/test/azure/mock_api_tests/asynctests/test_azure_arm_nonresource_async.py +0 -36
- package/generator/test/azure/mock_api_tests/asynctests/test_azure_arm_operationtemplates_async.py +0 -205
- package/generator/test/azure/mock_api_tests/asynctests/test_azure_arm_resource_async.py +0 -478
- package/generator/test/azure/mock_api_tests/asynctests/test_azure_client_generator_core_access_async.py +0 -101
- package/generator/test/azure/mock_api_tests/asynctests/test_azure_client_generator_core_api_version_header_async.py +0 -18
- package/generator/test/azure/mock_api_tests/asynctests/test_azure_client_generator_core_api_version_path_async.py +0 -18
- package/generator/test/azure/mock_api_tests/asynctests/test_azure_client_generator_core_api_version_query_async.py +0 -18
- package/generator/test/azure/mock_api_tests/asynctests/test_azure_client_generator_core_client_default_value_async.py +0 -46
- package/generator/test/azure/mock_api_tests/asynctests/test_azure_client_generator_core_client_initialization_async.py +0 -58
- package/generator/test/azure/mock_api_tests/asynctests/test_azure_client_generator_core_client_location_async.py +0 -82
- package/generator/test/azure/mock_api_tests/asynctests/test_azure_client_generator_core_deserialize_empty_string_as_null_async.py +0 -20
- package/generator/test/azure/mock_api_tests/asynctests/test_azure_client_generator_core_flatten_async.py +0 -115
- package/generator/test/azure/mock_api_tests/asynctests/test_azure_client_generator_core_hierrarchy_building_async.py +0 -53
- package/generator/test/azure/mock_api_tests/asynctests/test_azure_client_generator_core_next_link_verb_async.py +0 -28
- package/generator/test/azure/mock_api_tests/asynctests/test_azure_client_generator_core_override_async.py +0 -106
- package/generator/test/azure/mock_api_tests/asynctests/test_azure_client_generator_core_usage_async.py +0 -38
- package/generator/test/azure/mock_api_tests/asynctests/test_azure_core_basic_async.py +0 -76
- package/generator/test/azure/mock_api_tests/asynctests/test_azure_core_lro_rpc_async.py +0 -22
- package/generator/test/azure/mock_api_tests/asynctests/test_azure_core_lro_standard_async.py +0 -39
- package/generator/test/azure/mock_api_tests/asynctests/test_azure_core_model_async.py +0 -33
- package/generator/test/azure/mock_api_tests/asynctests/test_azure_core_page_async.py +0 -80
- package/generator/test/azure/mock_api_tests/asynctests/test_azure_core_scalar_async.py +0 -41
- package/generator/test/azure/mock_api_tests/asynctests/test_azure_core_traits_async.py +0 -87
- package/generator/test/azure/mock_api_tests/asynctests/test_azure_encode_duration_async.py +0 -19
- package/generator/test/azure/mock_api_tests/asynctests/test_azure_example_basic_async.py +0 -30
- package/generator/test/azure/mock_api_tests/asynctests/test_azure_payload_pageable_async.py +0 -19
- package/generator/test/azure/mock_api_tests/asynctests/test_azure_resource_manager_method_subscription_id_async.py +0 -248
- package/generator/test/azure/mock_api_tests/asynctests/test_azure_resource_manager_multi_service_async.py +0 -110
- package/generator/test/azure/mock_api_tests/asynctests/test_azure_resource_manager_multi_service_shared_models_async.py +0 -132
- package/generator/test/azure/mock_api_tests/asynctests/test_azure_special_headers_client_request_id_async.py +0 -30
- package/generator/test/azure/mock_api_tests/asynctests/test_azure_versioning_previewversion_async.py +0 -53
- package/generator/test/azure/mock_api_tests/asynctests/test_client_namespace_async.py +0 -34
- package/generator/test/azure/mock_api_tests/asynctests/test_client_naming_async.py +0 -69
- package/generator/test/azure/mock_api_tests/asynctests/test_client_naming_enum_conflict_async.py +0 -37
- package/generator/test/azure/mock_api_tests/asynctests/test_client_overload_async.py +0 -27
- package/generator/test/azure/mock_api_tests/asynctests/test_client_structure_async.py +0 -64
- package/generator/test/azure/mock_api_tests/asynctests/test_client_structure_clientoperationgroup_async.py +0 -31
- package/generator/test/azure/mock_api_tests/asynctests/test_encode_duration_async.py +0 -63
- package/generator/test/azure/mock_api_tests/asynctests/test_encode_numeric_async.py +0 -35
- package/generator/test/azure/mock_api_tests/asynctests/test_parameters_basic_async.py +0 -24
- package/generator/test/azure/mock_api_tests/asynctests/test_parameters_spread_async.py +0 -76
- package/generator/test/azure/mock_api_tests/asynctests/test_payload_content_negotiation_async.py +0 -37
- package/generator/test/azure/mock_api_tests/asynctests/test_payload_multipart_async.py +0 -216
- package/generator/test/azure/mock_api_tests/asynctests/test_resiliency_srv_driven_async.py +0 -130
- package/generator/test/azure/mock_api_tests/asynctests/test_serialization_encoded_name_json_async.py +0 -24
- package/generator/test/azure/mock_api_tests/asynctests/test_service_multi_service_async.py +0 -31
- package/generator/test/azure/mock_api_tests/asynctests/test_special_words_async.py +0 -71
- package/generator/test/azure/mock_api_tests/conftest.py +0 -207
- package/generator/test/azure/mock_api_tests/data/image.jpg +0 -0
- package/generator/test/azure/mock_api_tests/data/image.png +0 -0
- package/generator/test/azure/mock_api_tests/test_azure_arm_commonproperties.py +0 -89
- package/generator/test/azure/mock_api_tests/test_azure_arm_largeheader.py +0 -27
- package/generator/test/azure/mock_api_tests/test_azure_arm_nonresource.py +0 -34
- package/generator/test/azure/mock_api_tests/test_azure_arm_operationtemplates.py +0 -180
- package/generator/test/azure/mock_api_tests/test_azure_arm_resource.py +0 -436
- package/generator/test/azure/mock_api_tests/test_azure_client_generator_core_access.py +0 -92
- package/generator/test/azure/mock_api_tests/test_azure_client_generator_core_api_version_header.py +0 -17
- package/generator/test/azure/mock_api_tests/test_azure_client_generator_core_api_version_path.py +0 -17
- package/generator/test/azure/mock_api_tests/test_azure_client_generator_core_api_version_query.py +0 -17
- package/generator/test/azure/mock_api_tests/test_azure_client_generator_core_client_default_value.py +0 -42
- package/generator/test/azure/mock_api_tests/test_azure_client_generator_core_client_initialization.py +0 -51
- package/generator/test/azure/mock_api_tests/test_azure_client_generator_core_client_location.py +0 -70
- package/generator/test/azure/mock_api_tests/test_azure_client_generator_core_deserialize_empty_string_as_null.py +0 -19
- package/generator/test/azure/mock_api_tests/test_azure_client_generator_core_flatten.py +0 -104
- package/generator/test/azure/mock_api_tests/test_azure_client_generator_core_hierrarchy_building.py +0 -45
- package/generator/test/azure/mock_api_tests/test_azure_client_generator_core_next_link_verb.py +0 -27
- package/generator/test/azure/mock_api_tests/test_azure_client_generator_core_override.py +0 -102
- package/generator/test/azure/mock_api_tests/test_azure_client_generator_core_usage.py +0 -32
- package/generator/test/azure/mock_api_tests/test_azure_core_basic.py +0 -70
- package/generator/test/azure/mock_api_tests/test_azure_core_lro_rpc.py +0 -20
- package/generator/test/azure/mock_api_tests/test_azure_core_lro_standard.py +0 -32
- package/generator/test/azure/mock_api_tests/test_azure_core_model.py +0 -30
- package/generator/test/azure/mock_api_tests/test_azure_core_page.py +0 -71
- package/generator/test/azure/mock_api_tests/test_azure_core_scalar.py +0 -35
- package/generator/test/azure/mock_api_tests/test_azure_core_traits.py +0 -85
- package/generator/test/azure/mock_api_tests/test_azure_encode_duration.py +0 -18
- package/generator/test/azure/mock_api_tests/test_azure_example_basic.py +0 -29
- package/generator/test/azure/mock_api_tests/test_azure_payload_pageable.py +0 -18
- package/generator/test/azure/mock_api_tests/test_azure_resource_manager_method_subscription_id.py +0 -235
- package/generator/test/azure/mock_api_tests/test_azure_resource_manager_multi_service.py +0 -104
- package/generator/test/azure/mock_api_tests/test_azure_resource_manager_multi_service_shared_models.py +0 -128
- package/generator/test/azure/mock_api_tests/test_azure_special_headers_client_request_id.py +0 -29
- package/generator/test/azure/mock_api_tests/test_azure_versioning_previewversion.py +0 -50
- package/generator/test/azure/mock_api_tests/test_clear_output_folder.py +0 -23
- package/generator/test/azure/mock_api_tests/test_client_namespace.py +0 -32
- package/generator/test/azure/mock_api_tests/test_client_naming.py +0 -57
- package/generator/test/azure/mock_api_tests/test_client_naming_enum_conflict.py +0 -35
- package/generator/test/azure/mock_api_tests/test_client_overload.py +0 -25
- package/generator/test/azure/mock_api_tests/test_client_structure.py +0 -60
- package/generator/test/azure/mock_api_tests/test_client_structure_clientoperationgroup.py +0 -29
- package/generator/test/azure/mock_api_tests/test_encode_duration.py +0 -60
- package/generator/test/azure/mock_api_tests/test_encode_numeric.py +0 -31
- package/generator/test/azure/mock_api_tests/test_model_base_flatten_compatibility.py +0 -251
- package/generator/test/azure/mock_api_tests/test_parameters_basic.py +0 -22
- package/generator/test/azure/mock_api_tests/test_parameters_spread.py +0 -66
- package/generator/test/azure/mock_api_tests/test_payload_content_negotiation.py +0 -33
- package/generator/test/azure/mock_api_tests/test_payload_multipart.py +0 -198
- package/generator/test/azure/mock_api_tests/test_resiliency_srv_driven.py +0 -124
- package/generator/test/azure/mock_api_tests/test_serialization_encoded_name_json.py +0 -21
- package/generator/test/azure/mock_api_tests/test_service_multi_service.py +0 -29
- package/generator/test/azure/mock_api_tests/test_special_words.py +0 -63
- package/generator/test/azure/requirements.txt +0 -125
- package/generator/test/azure/tox.ini +0 -64
- package/generator/test/data/image.jpg +0 -0
- package/generator/test/data/image.png +0 -0
- package/generator/test/dev_requirements.txt +0 -8
- package/generator/test/generic_mock_api_tests/asynctests/test_authentication_async.py +0 -140
- package/generator/test/generic_mock_api_tests/asynctests/test_encode_array_async.py +0 -139
- package/generator/test/generic_mock_api_tests/asynctests/test_encode_bytes_async.py +0 -132
- package/generator/test/generic_mock_api_tests/asynctests/test_encode_datetime_async.py +0 -127
- package/generator/test/generic_mock_api_tests/asynctests/test_headasboolean_async.py +0 -35
- package/generator/test/generic_mock_api_tests/asynctests/test_parameters_body_optionality_async.py +0 -30
- package/generator/test/generic_mock_api_tests/asynctests/test_parameters_collection_format_async.py +0 -38
- package/generator/test/generic_mock_api_tests/asynctests/test_parameters_path_async.py +0 -24
- package/generator/test/generic_mock_api_tests/asynctests/test_parameters_query_async.py +0 -18
- package/generator/test/generic_mock_api_tests/asynctests/test_payload_json_merge_patch_async.py +0 -98
- package/generator/test/generic_mock_api_tests/asynctests/test_payload_media_type_async.py +0 -27
- package/generator/test/generic_mock_api_tests/asynctests/test_payload_pageable_async.py +0 -134
- package/generator/test/generic_mock_api_tests/asynctests/test_payload_xml_async.py +0 -150
- package/generator/test/generic_mock_api_tests/asynctests/test_response_status_code_range_async.py +0 -38
- package/generator/test/generic_mock_api_tests/asynctests/test_routes_async.py +0 -331
- package/generator/test/generic_mock_api_tests/asynctests/test_server_endpoint_not_defined_async.py +0 -18
- package/generator/test/generic_mock_api_tests/asynctests/test_server_path_multiple_async.py +0 -25
- package/generator/test/generic_mock_api_tests/asynctests/test_server_path_single_async.py +0 -18
- package/generator/test/generic_mock_api_tests/asynctests/test_server_versions_not_versioned_async.py +0 -28
- package/generator/test/generic_mock_api_tests/asynctests/test_server_versions_versioned_async.py +0 -34
- package/generator/test/generic_mock_api_tests/asynctests/test_special_headers_conditional_request_async.py +0 -38
- package/generator/test/generic_mock_api_tests/asynctests/test_special_headers_repeatability_async.py +0 -19
- package/generator/test/generic_mock_api_tests/asynctests/test_specs_documentation_async.py +0 -59
- package/generator/test/generic_mock_api_tests/asynctests/test_streaming_jsonl_async.py +0 -27
- package/generator/test/generic_mock_api_tests/asynctests/test_typetest_array_async.py +0 -127
- package/generator/test/generic_mock_api_tests/asynctests/test_typetest_dictionary_async.py +0 -98
- package/generator/test/generic_mock_api_tests/asynctests/test_typetest_enum_extensible_async.py +0 -25
- package/generator/test/generic_mock_api_tests/asynctests/test_typetest_enum_fixed_async.py +0 -27
- package/generator/test/generic_mock_api_tests/asynctests/test_typetest_file_async.py +0 -59
- package/generator/test/generic_mock_api_tests/asynctests/test_typetest_model_empty_async.py +0 -32
- package/generator/test/generic_mock_api_tests/asynctests/test_typetest_model_inheritance_enum_discriminator_async.py +0 -70
- package/generator/test/generic_mock_api_tests/asynctests/test_typetest_model_inheritance_nested_discriminator_async.py +0 -85
- package/generator/test/generic_mock_api_tests/asynctests/test_typetest_model_inheritance_not_discriminated_async.py +0 -34
- package/generator/test/generic_mock_api_tests/asynctests/test_typetest_model_inheritance_recursive_async.py +0 -34
- package/generator/test/generic_mock_api_tests/asynctests/test_typetest_model_inheritance_single_discriminator_async.py +0 -67
- package/generator/test/generic_mock_api_tests/asynctests/test_typetest_model_usage_async.py +0 -32
- package/generator/test/generic_mock_api_tests/asynctests/test_typetest_model_visibility_async.py +0 -47
- package/generator/test/generic_mock_api_tests/asynctests/test_typetest_property_additionalproperties_async.py +0 -353
- package/generator/test/generic_mock_api_tests/asynctests/test_typetest_property_nullable_async.py +0 -110
- package/generator/test/generic_mock_api_tests/asynctests/test_typetest_property_optional_async.py +0 -197
- package/generator/test/generic_mock_api_tests/asynctests/test_typetest_property_valuetypes_async.py +0 -315
- package/generator/test/generic_mock_api_tests/asynctests/test_typetest_scalar_async.py +0 -60
- package/generator/test/generic_mock_api_tests/asynctests/test_typetest_union_async.py +0 -90
- package/generator/test/generic_mock_api_tests/asynctests/test_versioning_added_async.py +0 -36
- package/generator/test/generic_mock_api_tests/asynctests/test_versioning_made_optional_async.py +0 -21
- package/generator/test/generic_mock_api_tests/asynctests/test_versioning_removed_async.py +0 -39
- package/generator/test/generic_mock_api_tests/asynctests/test_versioning_renamed_from_async.py +0 -29
- package/generator/test/generic_mock_api_tests/asynctests/test_versioning_return_type_changed_from_async.py +0 -18
- package/generator/test/generic_mock_api_tests/asynctests/test_versioning_type_changed_from_async.py +0 -22
- package/generator/test/generic_mock_api_tests/conftest.py +0 -75
- package/generator/test/generic_mock_api_tests/data/image.jpg +0 -0
- package/generator/test/generic_mock_api_tests/data/image.png +0 -0
- package/generator/test/generic_mock_api_tests/test_authentication.py +0 -130
- package/generator/test/generic_mock_api_tests/test_encode_array.py +0 -126
- package/generator/test/generic_mock_api_tests/test_encode_bytes.py +0 -128
- package/generator/test/generic_mock_api_tests/test_encode_datetime.py +0 -123
- package/generator/test/generic_mock_api_tests/test_headasboolean.py +0 -33
- package/generator/test/generic_mock_api_tests/test_parameters_body_optionality.py +0 -27
- package/generator/test/generic_mock_api_tests/test_parameters_collection_format.py +0 -33
- package/generator/test/generic_mock_api_tests/test_parameters_path.py +0 -22
- package/generator/test/generic_mock_api_tests/test_parameters_query.py +0 -17
- package/generator/test/generic_mock_api_tests/test_payload_json_merge_patch.py +0 -93
- package/generator/test/generic_mock_api_tests/test_payload_media_type.py +0 -25
- package/generator/test/generic_mock_api_tests/test_payload_pageable.py +0 -99
- package/generator/test/generic_mock_api_tests/test_payload_xml.py +0 -135
- package/generator/test/generic_mock_api_tests/test_response_status_code_range.py +0 -36
- package/generator/test/generic_mock_api_tests/test_routes.py +0 -285
- package/generator/test/generic_mock_api_tests/test_server_endpoint_not_defined.py +0 -17
- package/generator/test/generic_mock_api_tests/test_server_path_multiple.py +0 -21
- package/generator/test/generic_mock_api_tests/test_server_path_single.py +0 -17
- package/generator/test/generic_mock_api_tests/test_server_versions_not_versioned.py +0 -25
- package/generator/test/generic_mock_api_tests/test_server_versions_versioned.py +0 -30
- package/generator/test/generic_mock_api_tests/test_special_headers_conditional_request.py +0 -34
- package/generator/test/generic_mock_api_tests/test_special_headers_repeatability.py +0 -18
- package/generator/test/generic_mock_api_tests/test_specs_documentation.py +0 -51
- package/generator/test/generic_mock_api_tests/test_streaming_jsonl.py +0 -25
- package/generator/test/generic_mock_api_tests/test_typetest_array.py +0 -111
- package/generator/test/generic_mock_api_tests/test_typetest_dictionary.py +0 -86
- package/generator/test/generic_mock_api_tests/test_typetest_enum_extensible.py +0 -23
- package/generator/test/generic_mock_api_tests/test_typetest_enum_fixed.py +0 -25
- package/generator/test/generic_mock_api_tests/test_typetest_file.py +0 -52
- package/generator/test/generic_mock_api_tests/test_typetest_model_empty.py +0 -29
- package/generator/test/generic_mock_api_tests/test_typetest_model_inheritance_enum_discriminator.py +0 -58
- package/generator/test/generic_mock_api_tests/test_typetest_model_inheritance_nested_discriminator.py +0 -79
- package/generator/test/generic_mock_api_tests/test_typetest_model_inheritance_not_discriminated.py +0 -31
- package/generator/test/generic_mock_api_tests/test_typetest_model_inheritance_recursive.py +0 -32
- package/generator/test/generic_mock_api_tests/test_typetest_model_inheritance_single_discriminator.py +0 -60
- package/generator/test/generic_mock_api_tests/test_typetest_model_usage.py +0 -28
- package/generator/test/generic_mock_api_tests/test_typetest_model_visibility.py +0 -40
- package/generator/test/generic_mock_api_tests/test_typetest_property_additionalproperties.py +0 -314
- package/generator/test/generic_mock_api_tests/test_typetest_property_nullable.py +0 -102
- package/generator/test/generic_mock_api_tests/test_typetest_property_optional.py +0 -174
- package/generator/test/generic_mock_api_tests/test_typetest_property_valuetypes.py +0 -286
- package/generator/test/generic_mock_api_tests/test_typetest_scalar.py +0 -53
- package/generator/test/generic_mock_api_tests/test_typetest_union.py +0 -80
- package/generator/test/generic_mock_api_tests/test_typetest_union_discriminated.py +0 -290
- package/generator/test/generic_mock_api_tests/test_versioning_added.py +0 -33
- package/generator/test/generic_mock_api_tests/test_versioning_made_optional.py +0 -20
- package/generator/test/generic_mock_api_tests/test_versioning_removed.py +0 -37
- package/generator/test/generic_mock_api_tests/test_versioning_renamed_from.py +0 -27
- package/generator/test/generic_mock_api_tests/test_versioning_return_type_changed_from.py +0 -17
- package/generator/test/generic_mock_api_tests/test_versioning_type_changed_from.py +0 -21
- package/generator/test/unbranded/mock_api_tests/asynctests/test_auth_flow_async.py +0 -19
- package/generator/test/unbranded/mock_api_tests/asynctests/test_encode_duration_async.py +0 -63
- package/generator/test/unbranded/mock_api_tests/asynctests/test_encode_numeric_async.py +0 -35
- package/generator/test/unbranded/mock_api_tests/asynctests/test_parameters_basic_async.py +0 -24
- package/generator/test/unbranded/mock_api_tests/asynctests/test_parameters_spread_async.py +0 -76
- package/generator/test/unbranded/mock_api_tests/asynctests/test_payload_content_negotiation_async.py +0 -37
- package/generator/test/unbranded/mock_api_tests/asynctests/test_payload_multipart_async.py +0 -218
- package/generator/test/unbranded/mock_api_tests/asynctests/test_serialization_encoded_name_json_async.py +0 -24
- package/generator/test/unbranded/mock_api_tests/asynctests/test_special_words_async.py +0 -73
- package/generator/test/unbranded/mock_api_tests/asynctests/test_unbranded_async.py +0 -24
- package/generator/test/unbranded/mock_api_tests/conftest.py +0 -91
- package/generator/test/unbranded/mock_api_tests/data/image.jpg +0 -0
- package/generator/test/unbranded/mock_api_tests/data/image.png +0 -0
- package/generator/test/unbranded/mock_api_tests/test_auth_flow.py +0 -17
- package/generator/test/unbranded/mock_api_tests/test_encode_duration.py +0 -60
- package/generator/test/unbranded/mock_api_tests/test_encode_numeric.py +0 -32
- package/generator/test/unbranded/mock_api_tests/test_parameters_basic.py +0 -22
- package/generator/test/unbranded/mock_api_tests/test_parameters_spread.py +0 -66
- package/generator/test/unbranded/mock_api_tests/test_payload_content_negotiation.py +0 -33
- package/generator/test/unbranded/mock_api_tests/test_payload_multipart.py +0 -200
- package/generator/test/unbranded/mock_api_tests/test_serialization_encoded_name_json.py +0 -22
- package/generator/test/unbranded/mock_api_tests/test_special_words.py +0 -66
- package/generator/test/unbranded/mock_api_tests/test_unbranded.py +0 -65
- package/generator/test/unbranded/requirements.txt +0 -69
- package/generator/test/unbranded/tox.ini +0 -64
- package/generator/test/unittests/conftest.py +0 -15
- package/generator/test/unittests/requirements.txt +0 -3
- package/generator/test/unittests/test_enums.py +0 -89
- package/generator/test/unittests/test_model_base_serialization.py +0 -4906
- package/generator/test/unittests/test_model_base_xml_serialization.py +0 -1239
- package/generator/test/unittests/test_name_converter.py +0 -35
- package/generator/test/unittests/test_optional_return_type.py +0 -268
- package/generator/test/unittests/test_parameter_ordering.py +0 -104
- package/generator/test/unittests/test_sort_schema.py +0 -93
- package/generator/test/unittests/tox.ini +0 -5
- /package/eng/scripts/ci/{pyproject.toml → config/pyproject.toml} +0 -0
|
@@ -13,21 +13,25 @@ from subprocess import check_output, CalledProcessError
|
|
|
13
13
|
import logging
|
|
14
14
|
import sys
|
|
15
15
|
import time
|
|
16
|
-
from util import run_check
|
|
16
|
+
from util import run_check, get_package_namespace_dir
|
|
17
17
|
|
|
18
18
|
logging.getLogger().setLevel(logging.INFO)
|
|
19
19
|
|
|
20
20
|
|
|
21
21
|
def get_pyright_config_file_location():
|
|
22
|
-
|
|
22
|
+
# When running from tests/ directory via tox
|
|
23
|
+
pyright_config = os.path.join(os.getcwd(), "../eng/scripts/ci/config/pyrightconfig.json")
|
|
23
24
|
if os.path.exists(pyright_config):
|
|
24
25
|
return pyright_config
|
|
25
|
-
|
|
26
|
-
|
|
26
|
+
# Fallback for running from different directories
|
|
27
|
+
return os.path.join(os.path.dirname(__file__), "config/pyrightconfig.json")
|
|
27
28
|
|
|
28
29
|
|
|
29
30
|
def _single_dir_pyright(mod):
|
|
30
|
-
inner_class =
|
|
31
|
+
inner_class = get_package_namespace_dir(mod)
|
|
32
|
+
if not inner_class:
|
|
33
|
+
logging.info(f"No package directory found in {mod}, skipping")
|
|
34
|
+
return True
|
|
31
35
|
retries = 3
|
|
32
36
|
while retries:
|
|
33
37
|
try:
|
|
@@ -8,18 +8,21 @@
|
|
|
8
8
|
# This script is used to execute sphinx documentation build within a tox environment.
|
|
9
9
|
# It uses a central sphinx configuration and validates docstrings by running sphinx-build.
|
|
10
10
|
|
|
11
|
-
from subprocess import
|
|
11
|
+
from subprocess import run, TimeoutExpired
|
|
12
12
|
import os
|
|
13
13
|
import logging
|
|
14
14
|
import sys
|
|
15
15
|
from pathlib import Path
|
|
16
|
-
from util import run_check
|
|
16
|
+
from util import run_check, SKIP_PACKAGE_DIRS
|
|
17
17
|
|
|
18
18
|
logging.getLogger().setLevel(logging.INFO)
|
|
19
19
|
|
|
20
20
|
# Get the central Sphinx config directory
|
|
21
21
|
SPHINX_CONF_DIR = os.path.abspath(os.path.dirname(__file__))
|
|
22
22
|
|
|
23
|
+
# Timeout for each sphinx build (seconds)
|
|
24
|
+
SPHINX_TIMEOUT = 120
|
|
25
|
+
|
|
23
26
|
|
|
24
27
|
def _create_minimal_index_rst(docs_dir, package_name, module_names):
|
|
25
28
|
"""Create a minimal index.rst file for sphinx to process."""
|
|
@@ -50,7 +53,12 @@ def _single_dir_sphinx(mod):
|
|
|
50
53
|
|
|
51
54
|
# Find the actual Python package directories
|
|
52
55
|
package_dirs = [
|
|
53
|
-
d
|
|
56
|
+
d
|
|
57
|
+
for d in mod.iterdir()
|
|
58
|
+
if d.is_dir()
|
|
59
|
+
and not d.name.startswith("_")
|
|
60
|
+
and d.name not in SKIP_PACKAGE_DIRS
|
|
61
|
+
and (d / "__init__.py").exists()
|
|
54
62
|
]
|
|
55
63
|
|
|
56
64
|
if not package_dirs:
|
|
@@ -85,7 +93,7 @@ def _single_dir_sphinx(mod):
|
|
|
85
93
|
sys.path.insert(0, str(mod.absolute()))
|
|
86
94
|
|
|
87
95
|
try:
|
|
88
|
-
result =
|
|
96
|
+
result = run(
|
|
89
97
|
[
|
|
90
98
|
sys.executable,
|
|
91
99
|
"-m",
|
|
@@ -100,12 +108,19 @@ def _single_dir_sphinx(mod):
|
|
|
100
108
|
"-q", # Quiet mode (only show warnings/errors)
|
|
101
109
|
str(docs_dir.absolute()), # Source directory
|
|
102
110
|
str(output_dir.absolute()), # Output directory
|
|
103
|
-
]
|
|
111
|
+
],
|
|
112
|
+
capture_output=True,
|
|
113
|
+
timeout=SPHINX_TIMEOUT,
|
|
104
114
|
)
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
115
|
+
if result.returncode == 0:
|
|
116
|
+
return True
|
|
117
|
+
logging.error(f"{mod.stem} sphinx error: {result.stderr.decode()[:500]}")
|
|
118
|
+
return False
|
|
119
|
+
except TimeoutExpired:
|
|
120
|
+
logging.error(f"{mod.stem} timed out after {SPHINX_TIMEOUT}s")
|
|
121
|
+
return False
|
|
122
|
+
except Exception as e:
|
|
123
|
+
logging.error(f"{mod.stem} sphinx error: {e}")
|
|
109
124
|
return False
|
|
110
125
|
finally:
|
|
111
126
|
# Remove from sys.path
|
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
/* eslint-disable no-console */
|
|
2
|
+
import { spawn } from "child_process";
|
|
3
|
+
import fs from "fs";
|
|
4
|
+
import { dirname, join } from "path";
|
|
5
|
+
import pc from "picocolors";
|
|
6
|
+
import { fileURLToPath } from "url";
|
|
7
|
+
import { parseArgs } from "util";
|
|
8
|
+
|
|
9
|
+
const root = join(dirname(fileURLToPath(import.meta.url)), "../../../");
|
|
10
|
+
const testsDir = join(root, "tests");
|
|
11
|
+
|
|
12
|
+
// Get Python venv path
|
|
13
|
+
function getVenvPython(): string {
|
|
14
|
+
const venvPath = join(root, "venv");
|
|
15
|
+
if (fs.existsSync(join(venvPath, "bin"))) {
|
|
16
|
+
return join(venvPath, "bin", "python");
|
|
17
|
+
} else if (fs.existsSync(join(venvPath, "Scripts"))) {
|
|
18
|
+
return join(venvPath, "Scripts", "python.exe");
|
|
19
|
+
}
|
|
20
|
+
throw new Error("Virtual environment not found. Run 'npm run install' first.");
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const argv = parseArgs({
|
|
24
|
+
args: process.argv.slice(2),
|
|
25
|
+
options: {
|
|
26
|
+
generated: { type: "boolean" },
|
|
27
|
+
flavor: { type: "string", short: "f" },
|
|
28
|
+
mypy: { type: "boolean" },
|
|
29
|
+
pyright: { type: "boolean" },
|
|
30
|
+
help: { type: "boolean", short: "h" },
|
|
31
|
+
},
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
if (argv.values.help) {
|
|
35
|
+
console.log(`
|
|
36
|
+
${pc.bold("Usage:")} tsx typecheck.ts [options]
|
|
37
|
+
|
|
38
|
+
${pc.bold("Description:")}
|
|
39
|
+
Run type checking (mypy + pyright) on Python code.
|
|
40
|
+
|
|
41
|
+
${pc.bold("Options:")}
|
|
42
|
+
${pc.cyan("--generated")}
|
|
43
|
+
Run type checking on generated SDK packages (via tox).
|
|
44
|
+
Use with --flavor to specify azure or unbranded.
|
|
45
|
+
|
|
46
|
+
${pc.cyan("-f, --flavor <azure|unbranded>")}
|
|
47
|
+
SDK flavor to check (only applies to --generated).
|
|
48
|
+
If not specified, checks both flavors.
|
|
49
|
+
|
|
50
|
+
${pc.cyan("--mypy")}
|
|
51
|
+
Run only mypy (skip pyright).
|
|
52
|
+
|
|
53
|
+
${pc.cyan("--pyright")}
|
|
54
|
+
Run only pyright (skip mypy).
|
|
55
|
+
|
|
56
|
+
${pc.cyan("-h, --help")}
|
|
57
|
+
Show this help message.
|
|
58
|
+
|
|
59
|
+
${pc.bold("Examples:")}
|
|
60
|
+
${pc.dim("# Type check pygen source (default - runs both mypy and pyright)")}
|
|
61
|
+
tsx typecheck.ts
|
|
62
|
+
|
|
63
|
+
${pc.dim("# Run only mypy on pygen source")}
|
|
64
|
+
tsx typecheck.ts --mypy
|
|
65
|
+
|
|
66
|
+
${pc.dim("# Run only pyright on pygen source")}
|
|
67
|
+
tsx typecheck.ts --pyright
|
|
68
|
+
|
|
69
|
+
${pc.dim("# Type check generated SDK packages")}
|
|
70
|
+
tsx typecheck.ts --generated
|
|
71
|
+
|
|
72
|
+
${pc.dim("# Type check generated SDK packages for azure only")}
|
|
73
|
+
tsx typecheck.ts --generated --flavor=azure
|
|
74
|
+
`);
|
|
75
|
+
process.exit(0);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
function runCommand(command: string, args: string[], cwd?: string): Promise<boolean> {
|
|
79
|
+
return new Promise((resolve) => {
|
|
80
|
+
console.log(`${pc.cyan("[RUN]")} ${command} ${args.join(" ")}`);
|
|
81
|
+
const proc = spawn(command, args, {
|
|
82
|
+
cwd: cwd || root,
|
|
83
|
+
stdio: "inherit",
|
|
84
|
+
shell: true,
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
proc.on("close", (code) => {
|
|
88
|
+
if (code === 0) {
|
|
89
|
+
console.log(`${pc.green("[PASS]")} ${command} completed successfully`);
|
|
90
|
+
resolve(true);
|
|
91
|
+
} else {
|
|
92
|
+
console.log(`${pc.red("[FAIL]")} ${command} failed with code ${code}`);
|
|
93
|
+
resolve(false);
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
proc.on("error", (err) => {
|
|
98
|
+
console.log(`${pc.red("[ERROR]")} ${command}: ${err.message}`);
|
|
99
|
+
resolve(false);
|
|
100
|
+
});
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
async function runMypyOnPygen(): Promise<boolean> {
|
|
105
|
+
console.log(`\n${pc.bold("=== Running mypy on pygen ===")}\n`);
|
|
106
|
+
|
|
107
|
+
let pythonPath: string;
|
|
108
|
+
try {
|
|
109
|
+
pythonPath = getVenvPython();
|
|
110
|
+
} catch (error) {
|
|
111
|
+
console.error(pc.red((error as Error).message));
|
|
112
|
+
return false;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
return runCommand(pythonPath, [
|
|
116
|
+
"-m",
|
|
117
|
+
"mypy",
|
|
118
|
+
"generator/pygen",
|
|
119
|
+
"--config-file=eng/scripts/ci/config/mypy.ini",
|
|
120
|
+
"--ignore-missing",
|
|
121
|
+
]);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
async function runPyrightOnPygen(): Promise<boolean> {
|
|
125
|
+
console.log(`\n${pc.bold("=== Running pyright on pygen ===")}\n`);
|
|
126
|
+
|
|
127
|
+
let pythonPath: string;
|
|
128
|
+
try {
|
|
129
|
+
pythonPath = getVenvPython();
|
|
130
|
+
} catch (error) {
|
|
131
|
+
console.error(pc.red((error as Error).message));
|
|
132
|
+
return false;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
return runCommand(pythonPath, [
|
|
136
|
+
"-m",
|
|
137
|
+
"pyright",
|
|
138
|
+
"-p",
|
|
139
|
+
"eng/scripts/ci/config/pyrightconfig.json",
|
|
140
|
+
"generator/pygen",
|
|
141
|
+
]);
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
async function runTypecheckOnGenerated(
|
|
145
|
+
flavor?: string,
|
|
146
|
+
mypyOnly?: boolean,
|
|
147
|
+
pyrightOnly?: boolean,
|
|
148
|
+
): Promise<boolean> {
|
|
149
|
+
const flavors = flavor ? [flavor] : ["azure", "unbranded"];
|
|
150
|
+
console.log(
|
|
151
|
+
`\n${pc.bold(`=== Type Checking Generated SDK Packages (${flavors.join(", ")}) ===`)}\n`,
|
|
152
|
+
);
|
|
153
|
+
|
|
154
|
+
let pythonPath: string;
|
|
155
|
+
try {
|
|
156
|
+
pythonPath = getVenvPython();
|
|
157
|
+
} catch (error) {
|
|
158
|
+
console.error(pc.red((error as Error).message));
|
|
159
|
+
return false;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
let success = true;
|
|
163
|
+
|
|
164
|
+
for (const f of flavors) {
|
|
165
|
+
if (!pyrightOnly) {
|
|
166
|
+
const mypyEnv = `mypy-${f}`;
|
|
167
|
+
const result = await runCommand(
|
|
168
|
+
pythonPath,
|
|
169
|
+
["-m", "tox", "-c", "tox.ini", "-e", mypyEnv],
|
|
170
|
+
testsDir,
|
|
171
|
+
);
|
|
172
|
+
if (!result) success = false;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
if (!mypyOnly) {
|
|
176
|
+
const pyrightEnv = `pyright-${f}`;
|
|
177
|
+
const result = await runCommand(
|
|
178
|
+
pythonPath,
|
|
179
|
+
["-m", "tox", "-c", "tox.ini", "-e", pyrightEnv],
|
|
180
|
+
testsDir,
|
|
181
|
+
);
|
|
182
|
+
if (!result) success = false;
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
return success;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
async function main(): Promise<void> {
|
|
190
|
+
const runGenerated = argv.values.generated;
|
|
191
|
+
const mypyOnly = argv.values.mypy && !argv.values.pyright;
|
|
192
|
+
const pyrightOnly = argv.values.pyright && !argv.values.mypy;
|
|
193
|
+
|
|
194
|
+
// If --generated is specified, type check generated packages
|
|
195
|
+
if (runGenerated) {
|
|
196
|
+
const result = await runTypecheckOnGenerated(argv.values.flavor, mypyOnly, pyrightOnly);
|
|
197
|
+
if (!result) process.exit(1);
|
|
198
|
+
console.log(`\n${pc.green(pc.bold("Generated SDK type checking complete!"))}\n`);
|
|
199
|
+
return;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
// Default: type check pygen source
|
|
203
|
+
let success = true;
|
|
204
|
+
|
|
205
|
+
if (!pyrightOnly) {
|
|
206
|
+
const mypyResult = await runMypyOnPygen();
|
|
207
|
+
if (!mypyResult) success = false;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
if (!mypyOnly) {
|
|
211
|
+
const pyrightResult = await runPyrightOnPygen();
|
|
212
|
+
if (!pyrightResult) success = false;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
if (!success) {
|
|
216
|
+
process.exit(1);
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
console.log(`\n${pc.green(pc.bold("All type checks passed!"))}\n`);
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
main().catch((error) => {
|
|
223
|
+
console.error(`${pc.red("Unexpected error:")}`, error);
|
|
224
|
+
process.exit(1);
|
|
225
|
+
});
|
package/eng/scripts/ci/util.py
CHANGED
|
@@ -8,14 +8,32 @@ import os
|
|
|
8
8
|
import logging
|
|
9
9
|
from pathlib import Path
|
|
10
10
|
import argparse
|
|
11
|
-
from
|
|
11
|
+
from concurrent.futures import ProcessPoolExecutor, as_completed
|
|
12
12
|
|
|
13
13
|
logging.getLogger().setLevel(logging.INFO)
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
# Root is the tests directory (4 levels up from this file: ci -> scripts -> eng -> package_root, then into tests)
|
|
16
|
+
ROOT_FOLDER = os.path.abspath(os.path.join(os.path.abspath(__file__), "..", "..", "..", "..", "tests"))
|
|
16
17
|
|
|
17
18
|
IGNORE_FOLDER = []
|
|
18
19
|
|
|
20
|
+
# Directories inside each generated package that should be skipped by all CI checks.
|
|
21
|
+
# These are auto-generated test/sample scaffolding, not the actual SDK code.
|
|
22
|
+
SKIP_PACKAGE_DIRS = {"generated_tests", "generated_samples", "build", "__pycache__", ".pytest_cache"}
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
def get_package_namespace_dir(mod):
|
|
26
|
+
"""Find the actual namespace directory inside a generated package, skipping non-SDK dirs."""
|
|
27
|
+
for d in mod.iterdir():
|
|
28
|
+
if (
|
|
29
|
+
d.is_dir()
|
|
30
|
+
and not d.name.startswith("_")
|
|
31
|
+
and not d.name.endswith("egg-info")
|
|
32
|
+
and d.name not in SKIP_PACKAGE_DIRS
|
|
33
|
+
):
|
|
34
|
+
return d
|
|
35
|
+
return None
|
|
36
|
+
|
|
19
37
|
|
|
20
38
|
def run_check(name, call_back, log_info):
|
|
21
39
|
parser = argparse.ArgumentParser(
|
|
@@ -25,16 +43,9 @@ def run_check(name, call_back, log_info):
|
|
|
25
43
|
"-t",
|
|
26
44
|
"--test-folder",
|
|
27
45
|
dest="test_folder",
|
|
28
|
-
help="The test folder we're in. Can be 'azure' or '
|
|
46
|
+
help="The test folder we're in. Can be 'azure' or 'unbranded'",
|
|
29
47
|
required=True,
|
|
30
48
|
)
|
|
31
|
-
parser.add_argument(
|
|
32
|
-
"-g",
|
|
33
|
-
"--generator",
|
|
34
|
-
dest="generator",
|
|
35
|
-
help="The generator we're using. Can be 'legacy', 'version-tolerant'.",
|
|
36
|
-
required=False,
|
|
37
|
-
)
|
|
38
49
|
parser.add_argument(
|
|
39
50
|
"-f",
|
|
40
51
|
"--file-name",
|
|
@@ -46,27 +57,52 @@ def run_check(name, call_back, log_info):
|
|
|
46
57
|
"-s",
|
|
47
58
|
"--subfolder",
|
|
48
59
|
dest="subfolder",
|
|
49
|
-
help="The
|
|
60
|
+
help="The subfolder containing generated code, default to 'generated'.",
|
|
50
61
|
required=False,
|
|
51
|
-
default="
|
|
62
|
+
default="generated",
|
|
63
|
+
)
|
|
64
|
+
parser.add_argument(
|
|
65
|
+
"-j",
|
|
66
|
+
"--jobs",
|
|
67
|
+
dest="jobs",
|
|
68
|
+
help="Number of parallel jobs (default: CPU count)",
|
|
69
|
+
type=int,
|
|
70
|
+
required=False,
|
|
71
|
+
default=max(1, os.cpu_count()),
|
|
52
72
|
)
|
|
53
73
|
|
|
54
74
|
args = parser.parse_args()
|
|
55
75
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
pkg_dir /= Path(args.generator)
|
|
59
|
-
if args.subfolder:
|
|
60
|
-
pkg_dir /= Path(args.subfolder)
|
|
76
|
+
# Path structure: tests/generated/{test_folder}/
|
|
77
|
+
pkg_dir = Path(ROOT_FOLDER) / Path(args.subfolder) / Path(args.test_folder)
|
|
61
78
|
dirs = [d for d in pkg_dir.iterdir() if d.is_dir() and not d.stem.startswith("_") and d.stem not in IGNORE_FOLDER]
|
|
62
79
|
if args.file_name:
|
|
63
80
|
dirs = [d for d in dirs if args.file_name.lower() in d.stem.lower()]
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
81
|
+
|
|
82
|
+
if not dirs:
|
|
83
|
+
logging.info("No directories to process")
|
|
84
|
+
return
|
|
85
|
+
|
|
86
|
+
logging.info(f"Processing {len(dirs)} packages with {args.jobs} parallel jobs...")
|
|
87
|
+
|
|
88
|
+
failed = []
|
|
89
|
+
succeeded = 0
|
|
90
|
+
|
|
91
|
+
with ProcessPoolExecutor(max_workers=args.jobs) as executor:
|
|
92
|
+
futures = {executor.submit(call_back, d): d for d in dirs}
|
|
93
|
+
for future in as_completed(futures):
|
|
94
|
+
pkg = futures[future]
|
|
95
|
+
try:
|
|
96
|
+
if future.result():
|
|
97
|
+
succeeded += 1
|
|
98
|
+
else:
|
|
99
|
+
failed.append(pkg.stem)
|
|
100
|
+
except Exception as e:
|
|
101
|
+
logging.error(f"{pkg.stem} raised exception: {e}")
|
|
102
|
+
failed.append(pkg.stem)
|
|
103
|
+
|
|
104
|
+
logging.info(f"{log_info}: {succeeded} succeeded, {len(failed)} failed")
|
|
105
|
+
|
|
106
|
+
if failed:
|
|
107
|
+
logging.error(f"{log_info} failed for: {', '.join(failed)}")
|
|
72
108
|
exit(1)
|
package/eng/scripts/ci/utils.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/* eslint-disable no-console */
|
|
2
|
-
import chalk from "chalk";
|
|
3
2
|
import { execFile } from "child_process";
|
|
4
3
|
import { existsSync } from "fs";
|
|
5
4
|
import { dirname, join, resolve } from "path";
|
|
5
|
+
import pc from "picocolors";
|
|
6
6
|
import process from "process";
|
|
7
7
|
import { fileURLToPath } from "url";
|
|
8
8
|
import { parseArgs, promisify } from "util";
|
|
@@ -21,11 +21,11 @@ export async function executeCommand(command: string, args: string[]) {
|
|
|
21
21
|
const execFileAsync = promisify(execFile);
|
|
22
22
|
try {
|
|
23
23
|
await execFileAsync(command, args, { shell: true });
|
|
24
|
-
console.log(
|
|
24
|
+
console.log(pc.green(`${command} passed`));
|
|
25
25
|
} catch (err: any) {
|
|
26
|
-
console.error(
|
|
27
|
-
if (err.stdout) console.error(
|
|
28
|
-
if (err.stderr) console.error(
|
|
26
|
+
console.error(pc.red(`Error executing ${command}`));
|
|
27
|
+
if (err.stdout) console.error(pc.yellow("STDOUT:"), err.stdout);
|
|
28
|
+
if (err.stderr) console.error(pc.yellow("STDERR:"), err.stderr);
|
|
29
29
|
process.exit(1);
|
|
30
30
|
}
|
|
31
31
|
}
|
|
Binary file
|
|
Binary file
|
|
@@ -4,7 +4,7 @@ import { runPython3 } from "./run-python3.js";
|
|
|
4
4
|
async function main() {
|
|
5
5
|
await runPython3("./eng/scripts/setup/build_pygen_wheel.py");
|
|
6
6
|
// remove the venv_build_wheel directory
|
|
7
|
-
exec("rimraf ./venv_build_wheel", (error, stdout,
|
|
7
|
+
exec("rimraf ./venv_build_wheel", (error, stdout, _stderr) => {
|
|
8
8
|
if (error) {
|
|
9
9
|
console.error(`Error executing command: ${error.message}`); // eslint-disable-line no-console
|
|
10
10
|
return;
|
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
# --------------------------------------------------------------------------
|
|
8
8
|
import sys
|
|
9
9
|
|
|
10
|
-
if not sys.version_info >= (3,
|
|
11
|
-
raise Exception("Autorest for Python extension requires Python 3.
|
|
10
|
+
if not sys.version_info >= (3, 10, 0):
|
|
11
|
+
raise Exception("Autorest for Python extension requires Python 3.10 at least")
|
|
12
12
|
|
|
13
13
|
try:
|
|
14
14
|
from package_manager import detect_package_manager, PackageManagerNotFoundError
|
|
@@ -18,13 +18,14 @@ except (ImportError, ModuleNotFoundError, PackageManagerNotFoundError):
|
|
|
18
18
|
raise Exception("Your Python installation doesn't have a suitable package manager (pip or uv) available")
|
|
19
19
|
|
|
20
20
|
|
|
21
|
-
# Now we have a package manager (pip or uv) and Py >= 3.
|
|
21
|
+
# Now we have a package manager (pip or uv) and Py >= 3.10, go to work
|
|
22
22
|
|
|
23
23
|
from pathlib import Path
|
|
24
24
|
|
|
25
25
|
from venvtools import python_run
|
|
26
26
|
from package_manager import install_packages, create_venv_with_package_manager
|
|
27
27
|
|
|
28
|
+
# eng/scripts/setup/build_pygen_wheel.py -> need to go up 4 levels to get to package root
|
|
28
29
|
_ROOT_DIR = Path(__file__).parent.parent.parent.parent
|
|
29
30
|
|
|
30
31
|
|
|
@@ -7,9 +7,9 @@
|
|
|
7
7
|
# --------------------------------------------------------------------------
|
|
8
8
|
import sys
|
|
9
9
|
|
|
10
|
-
if not sys.version_info >= (3,
|
|
10
|
+
if not sys.version_info >= (3, 10, 0):
|
|
11
11
|
print(
|
|
12
|
-
"Warning: Autorest for Python extension requires Python 3.
|
|
12
|
+
"Warning: Autorest for Python extension requires Python 3.10 at least. We will run your code with Pyodide since your Python version isn't adequate."
|
|
13
13
|
)
|
|
14
14
|
sys.exit(2) # Exit code 2 for inadequate environment
|
|
15
15
|
|
|
@@ -32,12 +32,13 @@ except (ImportError, ModuleNotFoundError):
|
|
|
32
32
|
sys.exit(2) # Exit code 2 for inadequate environment
|
|
33
33
|
|
|
34
34
|
|
|
35
|
-
# Now we have a package manager (uv or pip) and Py >= 3.
|
|
35
|
+
# Now we have a package manager (uv or pip) and Py >= 3.10, go to work
|
|
36
36
|
# At this point, both Python and package manager are confirmed to be available
|
|
37
37
|
# Any failures from here should fail the npm install, not fallback to Pyodide
|
|
38
38
|
|
|
39
39
|
from pathlib import Path
|
|
40
40
|
|
|
41
|
+
# eng/scripts/setup/install.py -> need to go up 4 levels to get to package root
|
|
41
42
|
_ROOT_DIR = Path(__file__).parent.parent.parent.parent
|
|
42
43
|
|
|
43
44
|
|
|
@@ -7,7 +7,7 @@ async function main() {
|
|
|
7
7
|
try {
|
|
8
8
|
// First try to resolve Python path
|
|
9
9
|
pythonCommand = await patchPythonPath(["python", "./eng/scripts/setup/install.py"], {
|
|
10
|
-
version: ">=3.
|
|
10
|
+
version: ">=3.10",
|
|
11
11
|
environmentVariable: "AUTOREST_PYTHON_EXE",
|
|
12
12
|
});
|
|
13
13
|
} catch (error) {
|
|
@@ -7,14 +7,15 @@
|
|
|
7
7
|
# --------------------------------------------------------------------------
|
|
8
8
|
import sys
|
|
9
9
|
|
|
10
|
-
if not sys.version_info >= (3,
|
|
10
|
+
if not sys.version_info >= (3, 10, 0):
|
|
11
11
|
raise Warning(
|
|
12
|
-
"Autorest for Python extension requires Python 3.
|
|
12
|
+
"Autorest for Python extension requires Python 3.10 at least. We will run your code with Pyodide since your Python version isn't adequate."
|
|
13
13
|
)
|
|
14
14
|
|
|
15
15
|
from pathlib import Path
|
|
16
16
|
from package_manager import create_venv_with_package_manager, install_packages
|
|
17
17
|
|
|
18
|
+
# eng/scripts/setup/prepare.py -> need to go up 4 levels to get to package root
|
|
18
19
|
_ROOT_DIR = Path(__file__).parent.parent.parent.parent
|
|
19
20
|
|
|
20
21
|
|
|
@@ -3,7 +3,7 @@ import { runPython3 } from "./run-python3.js";
|
|
|
3
3
|
async function main() {
|
|
4
4
|
try {
|
|
5
5
|
await runPython3("./eng/scripts/setup/prepare.py");
|
|
6
|
-
} catch
|
|
6
|
+
} catch {
|
|
7
7
|
console.log("No Python found on your local environment. We will use Pyodide instead."); // eslint-disable-line no-console
|
|
8
8
|
}
|
|
9
9
|
}
|
|
@@ -11,7 +11,7 @@ import { patchPythonPath } from "./system-requirements.js";
|
|
|
11
11
|
|
|
12
12
|
export async function runPython3(...args: string[]) {
|
|
13
13
|
const command = await patchPythonPath(["python", ...args], {
|
|
14
|
-
version: ">=3.
|
|
14
|
+
version: ">=3.10",
|
|
15
15
|
environmentVariable: "AUTOREST_PYTHON_EXE",
|
|
16
16
|
});
|
|
17
17
|
cp.execSync(command.join(" "), {
|