@typespec/http-client-python 0.9.2 → 0.9.3-dev.2
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/eng/scripts/setup/__pycache__/venvtools.cpython-39.pyc +0 -0
- package/generator/build/lib/pygen/codegen/models/enum_type.py +2 -2
- package/generator/build/lib/pygen/codegen/models/model_type.py +1 -1
- package/generator/build/lib/pygen/codegen/serializers/general_serializer.py +20 -1
- package/generator/build/lib/pygen/codegen/templates/packaging_templates/setup.py.jinja2 +12 -11
- package/generator/dist/pygen-0.1.0-py3-none-any.whl +0 -0
- package/generator/pygen/codegen/models/enum_type.py +2 -2
- package/generator/pygen/codegen/models/model_type.py +1 -1
- package/generator/pygen/codegen/serializers/general_serializer.py +20 -1
- package/generator/pygen/codegen/templates/packaging_templates/setup.py.jinja2 +12 -11
- package/package.json +1 -1
|
Binary file
|
|
@@ -52,7 +52,7 @@ class EnumValue(BaseType):
|
|
|
52
52
|
"""The python type used for RST syntax input and type annotation."""
|
|
53
53
|
|
|
54
54
|
type_annotation = self.value_type.type_annotation(**kwargs)
|
|
55
|
-
enum_type_annotation = f"{self.
|
|
55
|
+
enum_type_annotation = f"{self.enum_type.client_namespace}.models.{self.name}"
|
|
56
56
|
return f"{type_annotation} or ~{enum_type_annotation}"
|
|
57
57
|
|
|
58
58
|
def get_json_template_representation(
|
|
@@ -198,7 +198,7 @@ class EnumType(BaseType):
|
|
|
198
198
|
"""The python type used for RST syntax input and type annotation."""
|
|
199
199
|
if self.code_model.options["models_mode"]:
|
|
200
200
|
type_annotation = self.value_type.type_annotation(**kwargs)
|
|
201
|
-
enum_type_annotation = f"{self.
|
|
201
|
+
enum_type_annotation = f"{self.client_namespace}.models.{self.name}"
|
|
202
202
|
return f"{type_annotation} or ~{enum_type_annotation}"
|
|
203
203
|
return self.value_type.type_annotation(**kwargs)
|
|
204
204
|
|
|
@@ -292,7 +292,7 @@ class GeneratedModelType(ModelType):
|
|
|
292
292
|
|
|
293
293
|
def docstring_type(self, **kwargs: Any) -> str:
|
|
294
294
|
type_annotation = self.type_annotation(need_model_alias=False, skip_quote=True, **kwargs)
|
|
295
|
-
return f"~{self.
|
|
295
|
+
return f"~{self.client_namespace}.models.{type_annotation}"
|
|
296
296
|
|
|
297
297
|
def docstring_text(self, **kwargs: Any) -> str:
|
|
298
298
|
return self.name
|
|
@@ -16,13 +16,29 @@ from ..models.utils import NamespaceType
|
|
|
16
16
|
from .client_serializer import ClientSerializer, ConfigSerializer
|
|
17
17
|
from .base_serializer import BaseSerializer
|
|
18
18
|
|
|
19
|
+
VERSION_MAP = {
|
|
20
|
+
"msrest": "0.7.1",
|
|
21
|
+
"isodate": "0.6.1",
|
|
22
|
+
"azure-mgmt-core": "1.3.2",
|
|
23
|
+
"azure-core": "1.30.0",
|
|
24
|
+
"typing-extensions": "4.6.0",
|
|
25
|
+
"corehttp": "1.0.0b6",
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
MIN_PYTHON_VERSION = "3.9"
|
|
29
|
+
MAX_PYTHON_VERSION = "3.12"
|
|
30
|
+
|
|
19
31
|
|
|
20
32
|
class GeneralSerializer(BaseSerializer):
|
|
21
33
|
"""General serializer for SDK root level files"""
|
|
22
34
|
|
|
23
35
|
def serialize_setup_file(self) -> str:
|
|
24
36
|
template = self.env.get_template("packaging_templates/setup.py.jinja2")
|
|
25
|
-
params = {
|
|
37
|
+
params = {
|
|
38
|
+
"VERSION_MAP": VERSION_MAP,
|
|
39
|
+
"MIN_PYTHON_VERSION": MIN_PYTHON_VERSION,
|
|
40
|
+
"MAX_PYTHON_VERSION": MAX_PYTHON_VERSION,
|
|
41
|
+
}
|
|
26
42
|
params.update(self.code_model.options)
|
|
27
43
|
return template.render(code_model=self.code_model, **params)
|
|
28
44
|
|
|
@@ -48,6 +64,9 @@ class GeneralSerializer(BaseSerializer):
|
|
|
48
64
|
"pkgutil_names": [".".join(package_parts[: i + 1]) for i in range(len(package_parts))],
|
|
49
65
|
"init_names": ["/".join(package_parts[: i + 1]) + "/__init__.py" for i in range(len(package_parts))],
|
|
50
66
|
"client_name": self.code_model.clients[0].name,
|
|
67
|
+
"VERSION_MAP": VERSION_MAP,
|
|
68
|
+
"MIN_PYTHON_VERSION": MIN_PYTHON_VERSION,
|
|
69
|
+
"MAX_PYTHON_VERSION": MAX_PYTHON_VERSION,
|
|
51
70
|
}
|
|
52
71
|
params.update(self.code_model.options)
|
|
53
72
|
params.update(kwargs)
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
# coding=utf-8
|
|
2
|
+
{% set min_version = MIN_PYTHON_VERSION.split('.')[1] | int %}
|
|
3
|
+
{% set max_version = MAX_PYTHON_VERSION.split('.')[1] | int %}
|
|
2
4
|
{% if code_model.license_header %}
|
|
3
5
|
{{ code_model.license_header }}
|
|
4
6
|
{% endif %}
|
|
@@ -67,10 +69,9 @@ setup(
|
|
|
67
69
|
"Programming Language :: Python",
|
|
68
70
|
"Programming Language :: Python :: 3 :: Only",
|
|
69
71
|
"Programming Language :: Python :: 3",
|
|
70
|
-
|
|
71
|
-
"Programming Language :: Python :: 3.
|
|
72
|
-
|
|
73
|
-
"Programming Language :: Python :: 3.12",
|
|
72
|
+
{% for version in range(min_version, max_version + 1) %}
|
|
73
|
+
"Programming Language :: Python :: 3.{{ version }}",
|
|
74
|
+
{% endfor %}
|
|
74
75
|
"License :: OSI Approved :: MIT License",
|
|
75
76
|
],
|
|
76
77
|
zip_safe=False,
|
|
@@ -95,21 +96,21 @@ setup(
|
|
|
95
96
|
{% endif %}
|
|
96
97
|
install_requires=[
|
|
97
98
|
{% if code_model.is_legacy %}
|
|
98
|
-
"msrest>=
|
|
99
|
+
"msrest>={{ VERSION_MAP["msrest"] }}",
|
|
99
100
|
{% else %}
|
|
100
|
-
"isodate>=
|
|
101
|
+
"isodate>={{ VERSION_MAP["isodate"] }}",
|
|
101
102
|
{% endif %}
|
|
102
103
|
{% if azure_arm %}
|
|
103
|
-
"azure-mgmt-core>=
|
|
104
|
+
"azure-mgmt-core>={{ VERSION_MAP["azure-mgmt-core"] }}",
|
|
104
105
|
{% elif code_model.is_azure_flavor %}
|
|
105
|
-
"azure-core>=
|
|
106
|
+
"azure-core>={{ VERSION_MAP["azure-core"] }}",
|
|
106
107
|
{% else %}
|
|
107
|
-
"corehttp[requests]",
|
|
108
|
+
"corehttp[requests]>={{ VERSION_MAP["corehttp"] }}",
|
|
108
109
|
{% endif %}
|
|
109
|
-
"typing-extensions>=
|
|
110
|
+
"typing-extensions>={{ VERSION_MAP['typing-extensions'] }}",
|
|
110
111
|
],
|
|
111
112
|
{% if package_mode %}
|
|
112
|
-
python_requires=">=
|
|
113
|
+
python_requires=">={{ MIN_PYTHON_VERSION }}",
|
|
113
114
|
{% else %}
|
|
114
115
|
long_description="""\
|
|
115
116
|
{{ code_model.description }}
|
|
Binary file
|
|
@@ -52,7 +52,7 @@ class EnumValue(BaseType):
|
|
|
52
52
|
"""The python type used for RST syntax input and type annotation."""
|
|
53
53
|
|
|
54
54
|
type_annotation = self.value_type.type_annotation(**kwargs)
|
|
55
|
-
enum_type_annotation = f"{self.
|
|
55
|
+
enum_type_annotation = f"{self.enum_type.client_namespace}.models.{self.name}"
|
|
56
56
|
return f"{type_annotation} or ~{enum_type_annotation}"
|
|
57
57
|
|
|
58
58
|
def get_json_template_representation(
|
|
@@ -198,7 +198,7 @@ class EnumType(BaseType):
|
|
|
198
198
|
"""The python type used for RST syntax input and type annotation."""
|
|
199
199
|
if self.code_model.options["models_mode"]:
|
|
200
200
|
type_annotation = self.value_type.type_annotation(**kwargs)
|
|
201
|
-
enum_type_annotation = f"{self.
|
|
201
|
+
enum_type_annotation = f"{self.client_namespace}.models.{self.name}"
|
|
202
202
|
return f"{type_annotation} or ~{enum_type_annotation}"
|
|
203
203
|
return self.value_type.type_annotation(**kwargs)
|
|
204
204
|
|
|
@@ -292,7 +292,7 @@ class GeneratedModelType(ModelType):
|
|
|
292
292
|
|
|
293
293
|
def docstring_type(self, **kwargs: Any) -> str:
|
|
294
294
|
type_annotation = self.type_annotation(need_model_alias=False, skip_quote=True, **kwargs)
|
|
295
|
-
return f"~{self.
|
|
295
|
+
return f"~{self.client_namespace}.models.{type_annotation}"
|
|
296
296
|
|
|
297
297
|
def docstring_text(self, **kwargs: Any) -> str:
|
|
298
298
|
return self.name
|
|
@@ -16,13 +16,29 @@ from ..models.utils import NamespaceType
|
|
|
16
16
|
from .client_serializer import ClientSerializer, ConfigSerializer
|
|
17
17
|
from .base_serializer import BaseSerializer
|
|
18
18
|
|
|
19
|
+
VERSION_MAP = {
|
|
20
|
+
"msrest": "0.7.1",
|
|
21
|
+
"isodate": "0.6.1",
|
|
22
|
+
"azure-mgmt-core": "1.3.2",
|
|
23
|
+
"azure-core": "1.30.0",
|
|
24
|
+
"typing-extensions": "4.6.0",
|
|
25
|
+
"corehttp": "1.0.0b6",
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
MIN_PYTHON_VERSION = "3.9"
|
|
29
|
+
MAX_PYTHON_VERSION = "3.12"
|
|
30
|
+
|
|
19
31
|
|
|
20
32
|
class GeneralSerializer(BaseSerializer):
|
|
21
33
|
"""General serializer for SDK root level files"""
|
|
22
34
|
|
|
23
35
|
def serialize_setup_file(self) -> str:
|
|
24
36
|
template = self.env.get_template("packaging_templates/setup.py.jinja2")
|
|
25
|
-
params = {
|
|
37
|
+
params = {
|
|
38
|
+
"VERSION_MAP": VERSION_MAP,
|
|
39
|
+
"MIN_PYTHON_VERSION": MIN_PYTHON_VERSION,
|
|
40
|
+
"MAX_PYTHON_VERSION": MAX_PYTHON_VERSION,
|
|
41
|
+
}
|
|
26
42
|
params.update(self.code_model.options)
|
|
27
43
|
return template.render(code_model=self.code_model, **params)
|
|
28
44
|
|
|
@@ -48,6 +64,9 @@ class GeneralSerializer(BaseSerializer):
|
|
|
48
64
|
"pkgutil_names": [".".join(package_parts[: i + 1]) for i in range(len(package_parts))],
|
|
49
65
|
"init_names": ["/".join(package_parts[: i + 1]) + "/__init__.py" for i in range(len(package_parts))],
|
|
50
66
|
"client_name": self.code_model.clients[0].name,
|
|
67
|
+
"VERSION_MAP": VERSION_MAP,
|
|
68
|
+
"MIN_PYTHON_VERSION": MIN_PYTHON_VERSION,
|
|
69
|
+
"MAX_PYTHON_VERSION": MAX_PYTHON_VERSION,
|
|
51
70
|
}
|
|
52
71
|
params.update(self.code_model.options)
|
|
53
72
|
params.update(kwargs)
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
# coding=utf-8
|
|
2
|
+
{% set min_version = MIN_PYTHON_VERSION.split('.')[1] | int %}
|
|
3
|
+
{% set max_version = MAX_PYTHON_VERSION.split('.')[1] | int %}
|
|
2
4
|
{% if code_model.license_header %}
|
|
3
5
|
{{ code_model.license_header }}
|
|
4
6
|
{% endif %}
|
|
@@ -67,10 +69,9 @@ setup(
|
|
|
67
69
|
"Programming Language :: Python",
|
|
68
70
|
"Programming Language :: Python :: 3 :: Only",
|
|
69
71
|
"Programming Language :: Python :: 3",
|
|
70
|
-
|
|
71
|
-
"Programming Language :: Python :: 3.
|
|
72
|
-
|
|
73
|
-
"Programming Language :: Python :: 3.12",
|
|
72
|
+
{% for version in range(min_version, max_version + 1) %}
|
|
73
|
+
"Programming Language :: Python :: 3.{{ version }}",
|
|
74
|
+
{% endfor %}
|
|
74
75
|
"License :: OSI Approved :: MIT License",
|
|
75
76
|
],
|
|
76
77
|
zip_safe=False,
|
|
@@ -95,21 +96,21 @@ setup(
|
|
|
95
96
|
{% endif %}
|
|
96
97
|
install_requires=[
|
|
97
98
|
{% if code_model.is_legacy %}
|
|
98
|
-
"msrest>=
|
|
99
|
+
"msrest>={{ VERSION_MAP["msrest"] }}",
|
|
99
100
|
{% else %}
|
|
100
|
-
"isodate>=
|
|
101
|
+
"isodate>={{ VERSION_MAP["isodate"] }}",
|
|
101
102
|
{% endif %}
|
|
102
103
|
{% if azure_arm %}
|
|
103
|
-
"azure-mgmt-core>=
|
|
104
|
+
"azure-mgmt-core>={{ VERSION_MAP["azure-mgmt-core"] }}",
|
|
104
105
|
{% elif code_model.is_azure_flavor %}
|
|
105
|
-
"azure-core>=
|
|
106
|
+
"azure-core>={{ VERSION_MAP["azure-core"] }}",
|
|
106
107
|
{% else %}
|
|
107
|
-
"corehttp[requests]",
|
|
108
|
+
"corehttp[requests]>={{ VERSION_MAP["corehttp"] }}",
|
|
108
109
|
{% endif %}
|
|
109
|
-
"typing-extensions>=
|
|
110
|
+
"typing-extensions>={{ VERSION_MAP['typing-extensions'] }}",
|
|
110
111
|
],
|
|
111
112
|
{% if package_mode %}
|
|
112
|
-
python_requires=">=
|
|
113
|
+
python_requires=">={{ MIN_PYTHON_VERSION }}",
|
|
113
114
|
{% else %}
|
|
114
115
|
long_description="""\
|
|
115
116
|
{{ code_model.description }}
|