@autorest/python 5.12.5 → 5.14.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/ChangeLog.md +185 -118
- package/autorest/black/__init__.py +3 -0
- package/autorest/codegen/__init__.py +34 -2
- package/autorest/codegen/models/__init__.py +2 -1
- package/autorest/codegen/models/client.py +6 -5
- package/autorest/codegen/models/code_model.py +3 -0
- package/autorest/codegen/models/constant_schema.py +0 -4
- package/autorest/codegen/models/lro_operation.py +6 -2
- package/autorest/codegen/models/operation.py +20 -11
- package/autorest/codegen/models/operation_group.py +0 -9
- package/autorest/codegen/models/paging_operation.py +3 -3
- package/autorest/codegen/models/parameter.py +35 -9
- package/autorest/codegen/models/parameter_list.py +11 -4
- package/autorest/codegen/models/request_builder.py +3 -2
- package/autorest/codegen/models/request_builder_parameter.py +5 -0
- package/autorest/codegen/models/request_builder_parameter_list.py +1 -0
- package/autorest/codegen/serializers/__init__.py +147 -74
- package/autorest/codegen/serializers/builder_serializer.py +68 -37
- package/autorest/codegen/serializers/client_serializer.py +14 -3
- package/autorest/codegen/serializers/general_serializer.py +4 -1
- package/autorest/codegen/serializers/utils.py +5 -1
- package/autorest/codegen/templates/CHANGELOG.md.jinja2 +6 -0
- package/autorest/codegen/templates/LICENSE.jinja2 +21 -0
- package/autorest/codegen/templates/MANIFEST.in.jinja2 +7 -0
- package/autorest/codegen/templates/README.md.jinja2 +105 -0
- package/autorest/codegen/templates/config.py.jinja2 +2 -7
- package/autorest/codegen/templates/dev_requirements.txt.jinja2 +10 -0
- package/autorest/codegen/templates/lro_operation.py.jinja2 +3 -1
- package/autorest/codegen/templates/lro_paging_operation.py.jinja2 +2 -0
- package/autorest/codegen/templates/operation.py.jinja2 +6 -2
- package/autorest/codegen/templates/operation_group.py.jinja2 +15 -18
- package/autorest/codegen/templates/operation_groups_container.py.jinja2 +1 -0
- package/autorest/codegen/templates/operation_tools.jinja2 +3 -2
- package/autorest/codegen/templates/paging_operation.py.jinja2 +2 -2
- package/autorest/codegen/templates/request_builder.py.jinja2 +2 -7
- package/autorest/codegen/templates/service_client.py.jinja2 +1 -1
- package/autorest/codegen/templates/setup.py.jinja2 +79 -20
- package/autorest/namer/name_converter.py +1 -1
- package/package.json +2 -2
- package/run-python3.js +1 -7
- package/venvtools.py +2 -2
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
{{ imports }}
|
|
8
8
|
|
|
9
9
|
{{ serializer.class_definition(async_mode) }}
|
|
10
|
-
"""{{ code_model.description }}
|
|
10
|
+
"""{{ op_tools.wrap_string(code_model.description, "\n") | indent }}
|
|
11
11
|
|
|
12
12
|
{{ op_tools.serialize_with_wrap(serializer.property_descriptions(async_mode), "\n ") | indent }}
|
|
13
13
|
{{ serializer.init_signature_and_response_type_annotation(async_mode) | indent }}
|
|
@@ -1,34 +1,93 @@
|
|
|
1
|
-
{% set name = code_model.options["package_name"] or code_model.class_name %}
|
|
2
|
-
{% set azure_mgmt_core_import = ', "azure-mgmt-core<2.0.0,>=1.2.1"' if code_model.options["azure_arm"] else "" %}
|
|
3
1
|
# coding=utf-8
|
|
4
|
-
{{
|
|
2
|
+
{{ license_header }}
|
|
5
3
|
# coding: utf-8
|
|
6
|
-
|
|
4
|
+
{% if package_mode %}
|
|
5
|
+
import os
|
|
6
|
+
import re
|
|
7
|
+
{% endif -%}
|
|
7
8
|
from setuptools import setup, find_packages
|
|
8
9
|
|
|
9
|
-
|
|
10
|
-
|
|
10
|
+
{% set package_name_render = package_name or code_model.class_name %}
|
|
11
|
+
|
|
12
|
+
PACKAGE_NAME = "{{ package_name_render|lower }}"
|
|
13
|
+
{% if package_mode -%}
|
|
14
|
+
PACKAGE_PPRINT_NAME = "{{ package_pprint_name }}"
|
|
15
|
+
|
|
16
|
+
# a-b-c => a/b/c
|
|
17
|
+
package_folder_path = PACKAGE_NAME.replace("-", "/")
|
|
11
18
|
|
|
12
|
-
#
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
# http://pypi.python.org/pypi/setuptools
|
|
19
|
+
# Version extraction inspired from 'requests'
|
|
20
|
+
with open(os.path.join(package_folder_path, "_version.py"), "r") as fd:
|
|
21
|
+
version = re.search(
|
|
22
|
+
r'^VERSION\s*=\s*[\'"]([^\'"]*)[\'"]', fd.read(), re.MULTILINE
|
|
23
|
+
).group(1)
|
|
18
24
|
|
|
19
|
-
|
|
25
|
+
if not version:
|
|
26
|
+
raise RuntimeError("Cannot find version information")
|
|
27
|
+
{% set description = "Microsoft %s Client Library for Python"|format(package_pprint_name) %}
|
|
28
|
+
{% set author_email = "azpysdkhelp@microsoft.com" %}
|
|
29
|
+
{% set url = "https://github.com/Azure/azure-sdk-for-python/tree/main/sdk" %}
|
|
30
|
+
{% else %}
|
|
31
|
+
version = "{{ code_model.options['package_version'] }}"
|
|
32
|
+
{% set description = "%s"|format(package_name_render) %}
|
|
33
|
+
{% set long_description = code_model.description %}
|
|
34
|
+
{% set author_email = "" %}
|
|
35
|
+
{% set url = "" %}
|
|
36
|
+
{% endif -%}
|
|
20
37
|
|
|
21
38
|
setup(
|
|
22
|
-
name=
|
|
23
|
-
version=
|
|
24
|
-
description="{{
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
39
|
+
name=PACKAGE_NAME,
|
|
40
|
+
version=version,
|
|
41
|
+
description="{{ description }}",
|
|
42
|
+
{% if package_mode %}
|
|
43
|
+
long_description=open("README.md", "r").read(),
|
|
44
|
+
long_description_content_type="text/markdown",
|
|
45
|
+
license="MIT License",
|
|
46
|
+
author="Microsoft Corporation",
|
|
47
|
+
{% endif %}
|
|
48
|
+
author_email="{{ author_email }}",
|
|
49
|
+
url="{{ url }}",
|
|
50
|
+
keywords="azure, azure sdk",
|
|
51
|
+
{% if package_mode %}
|
|
52
|
+
classifiers=[
|
|
53
|
+
"Development Status :: {{ dev_status }}",
|
|
54
|
+
"Programming Language :: Python",
|
|
55
|
+
"Programming Language :: Python :: 3 :: Only",
|
|
56
|
+
"Programming Language :: Python :: 3",
|
|
57
|
+
"Programming Language :: Python :: 3.6",
|
|
58
|
+
"Programming Language :: Python :: 3.7",
|
|
59
|
+
"Programming Language :: Python :: 3.8",
|
|
60
|
+
"Programming Language :: Python :: 3.9",
|
|
61
|
+
"Programming Language :: Python :: 3.10",
|
|
62
|
+
"License :: OSI Approved :: MIT License",
|
|
63
|
+
],
|
|
64
|
+
zip_safe=False,
|
|
65
|
+
packages=find_packages(
|
|
66
|
+
exclude=[
|
|
67
|
+
"tests",
|
|
68
|
+
# Exclude packages that will be covered by PEP420 or nspkg
|
|
69
|
+
{%- for pkgutil_name in pkgutil_names %}
|
|
70
|
+
"{{ pkgutil_name }}",
|
|
71
|
+
{%- endfor %}
|
|
72
|
+
]
|
|
73
|
+
),
|
|
74
|
+
{% else %}
|
|
29
75
|
packages=find_packages(),
|
|
30
76
|
include_package_data=True,
|
|
77
|
+
{% endif %}
|
|
78
|
+
install_requires=[
|
|
79
|
+
"{{ dependency_msrest }}",
|
|
80
|
+
{% if azure_arm %}
|
|
81
|
+
"{{ dependency_azure_mgmt_core }}",
|
|
82
|
+
{% else %}
|
|
83
|
+
"{{ dependency_azure_core }}",
|
|
84
|
+
{% endif %}
|
|
85
|
+
],
|
|
86
|
+
{% if package_mode %}
|
|
87
|
+
python_requires=">=3.6",
|
|
88
|
+
{% else %}
|
|
31
89
|
long_description="""\
|
|
32
90
|
{{ code_model.description }}
|
|
33
91
|
"""
|
|
92
|
+
{% endif %}
|
|
34
93
|
)
|
|
@@ -373,7 +373,7 @@ class NameConverter:
|
|
|
373
373
|
# check to see if name is reserved for the type of name we are converting
|
|
374
374
|
pad_string = cast(PadType, pad_string)
|
|
375
375
|
# there are some private variables, such as grouped parameters
|
|
376
|
-
# that are private. We still want to escape them for
|
|
376
|
+
# that are private. We still want to escape them for DPG
|
|
377
377
|
name_prefix = ""
|
|
378
378
|
if name[0] == "_":
|
|
379
379
|
# i am private
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@autorest/python",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.14.0",
|
|
4
4
|
"description": "The Python extension for generators in AutoRest.",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"prepare": "node run-python3.js prepare.py",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"@azure-tools/extension": "~3.2.1"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
|
-
"@microsoft.azure/autorest.testserver": "^3.
|
|
30
|
+
"@microsoft.azure/autorest.testserver": "^3.3.20"
|
|
31
31
|
},
|
|
32
32
|
"files": [
|
|
33
33
|
"autorest/**/*.py",
|
package/run-python3.js
CHANGED
|
@@ -18,12 +18,6 @@ async function runPython3(scriptName, debug = "") {
|
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
runPython3(...process.argv.slice(2)).catch(err => {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
// Python script errors are already written out via stderr so don't
|
|
24
|
-
// write them twice. Write out all other errors to stderr.
|
|
25
|
-
if (!error.startsWith("Error: Command failed")) {
|
|
26
|
-
console.error(error);
|
|
27
|
-
}
|
|
21
|
+
console.error(err.toString());
|
|
28
22
|
process.exit(1);
|
|
29
23
|
});
|
package/venvtools.py
CHANGED
|
@@ -62,13 +62,13 @@ def python_run(venv_context, module, command=None, *, additional_dir=".", error_
|
|
|
62
62
|
venv_context.env_exe,
|
|
63
63
|
"-m", module
|
|
64
64
|
] + (command if command else [])
|
|
65
|
-
print("Executing: {}".format(" ".join(cmd_line))
|
|
65
|
+
print("Executing: {}".format(" ".join(cmd_line)))
|
|
66
66
|
subprocess.run(
|
|
67
67
|
cmd_line,
|
|
68
68
|
cwd=_ROOT_DIR / additional_dir,
|
|
69
69
|
check=True,
|
|
70
70
|
)
|
|
71
71
|
except subprocess.CalledProcessError as err:
|
|
72
|
-
print(err
|
|
72
|
+
print(err)
|
|
73
73
|
if not error_ok:
|
|
74
74
|
sys.exit(1)
|