@typespec/http-client-python 0.8.1 → 0.9.0-dev.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/dist/emitter/code-model.d.ts.map +1 -1
  2. package/dist/emitter/code-model.js +2 -2
  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 +9 -5
  6. package/dist/emitter/emitter.js.map +1 -1
  7. package/dist/emitter/lib.d.ts +11 -2
  8. package/dist/emitter/lib.d.ts.map +1 -1
  9. package/dist/emitter/lib.js +7 -1
  10. package/dist/emitter/lib.js.map +1 -1
  11. package/dist/emitter/utils.d.ts +1 -0
  12. package/dist/emitter/utils.d.ts.map +1 -1
  13. package/dist/emitter/utils.js +31 -16
  14. package/dist/emitter/utils.js.map +1 -1
  15. package/emitter/src/code-model.ts +3 -13
  16. package/emitter/src/emitter.ts +9 -7
  17. package/emitter/src/lib.ts +8 -4
  18. package/emitter/src/utils.ts +32 -18
  19. package/emitter/temp/tsconfig.tsbuildinfo +1 -1
  20. package/eng/scripts/ci/regenerate.ts +96 -41
  21. package/eng/scripts/setup/__pycache__/venvtools.cpython-38.pyc +0 -0
  22. package/generator/build/lib/pygen/codegen/__init__.py +0 -2
  23. package/generator/build/lib/pygen/codegen/models/code_model.py +5 -5
  24. package/generator/build/lib/pygen/codegen/serializers/__init__.py +18 -14
  25. package/generator/build/lib/pygen/codegen/serializers/general_serializer.py +5 -2
  26. package/generator/build/lib/pygen/codegen/serializers/test_serializer.py +1 -1
  27. package/generator/build/lib/pygen/codegen/templates/packaging_templates/MANIFEST.in.jinja2 +6 -2
  28. package/generator/build/lib/pygen/codegen/templates/packaging_templates/README.md.jinja2 +5 -5
  29. package/generator/build/lib/pygen/codegen/templates/packaging_templates/dev_requirements.txt.jinja2 +3 -3
  30. package/generator/build/lib/pygen/codegen/templates/packaging_templates/setup.py.jinja2 +14 -5
  31. package/generator/dist/pygen-0.1.0-py3-none-any.whl +0 -0
  32. package/generator/pygen/codegen/__init__.py +0 -2
  33. package/generator/pygen/codegen/models/code_model.py +5 -5
  34. package/generator/pygen/codegen/serializers/__init__.py +18 -14
  35. package/generator/pygen/codegen/serializers/general_serializer.py +5 -2
  36. package/generator/pygen/codegen/serializers/test_serializer.py +1 -1
  37. package/generator/pygen/codegen/templates/packaging_templates/MANIFEST.in.jinja2 +6 -2
  38. package/generator/pygen/codegen/templates/packaging_templates/README.md.jinja2 +5 -5
  39. package/generator/pygen/codegen/templates/packaging_templates/dev_requirements.txt.jinja2 +3 -3
  40. package/generator/pygen/codegen/templates/packaging_templates/setup.py.jinja2 +14 -5
  41. package/generator/pygen.egg-info/PKG-INFO +2 -2
  42. package/generator/pygen.egg-info/requires.txt +2 -2
  43. package/generator/setup.py +2 -2
  44. package/package.json +4 -4
@@ -1,5 +1,5 @@
1
1
  {% if code_model.is_azure_flavor %}
2
- {% if package_mode == "mgmtplane" -%}
2
+ {% if package_mode == "mgmtplane" %}
3
3
  # Microsoft Azure SDK for Python
4
4
 
5
5
  This is the Microsoft {{package_pprint_name}} Client Library.
@@ -40,7 +40,7 @@ python -m pip install {{ package_name }}
40
40
  - You need an [Azure subscription][azure_sub] to use this package.
41
41
  - An existing {{ package_pprint_name }} instance.
42
42
 
43
- {%- if token_credential %}
43
+ {% if token_credential %}
44
44
  #### Create with an Azure Active Directory Credential
45
45
  To use an [Azure Active Directory (AAD) token credential][authenticate_with_token],
46
46
  provide an instance of the desired credential type obtained from the
@@ -57,7 +57,7 @@ Set the values of the client ID, tenant ID, and client secret of the AAD applica
57
57
  Use the returned token credential to authenticate the client:
58
58
 
59
59
  ```python
60
- >>> from {{ namespace }} import {{ client_name }}
60
+ >>> from {{ code_model.namespace }} import {{ client_name }}
61
61
  >>> from azure.identity import DefaultAzureCredential
62
62
  >>> client = {{ client_name }}(endpoint='<endpoint>', credential=DefaultAzureCredential())
63
63
  ```
@@ -65,7 +65,7 @@ Use the returned token credential to authenticate the client:
65
65
  ## Examples
66
66
 
67
67
  ```python
68
- >>> from {{ namespace }} import {{ client_name }}
68
+ >>> from {{ code_model.namespace }} import {{ client_name }}
69
69
  >>> from azure.identity import DefaultAzureCredential
70
70
  >>> from {{ code_model.core_library }}.exceptions import HttpResponseError
71
71
 
@@ -76,7 +76,7 @@ Use the returned token credential to authenticate the client:
76
76
  print('service responds error: {}'.format(e.response.json()))
77
77
 
78
78
  ```
79
- {%- endif %}
79
+ {% endif %}
80
80
 
81
81
  ## Contributing
82
82
 
@@ -1,9 +1,9 @@
1
1
  -e ../../../tools/azure-sdk-tools
2
2
  ../../core/azure-core
3
- {% if token_credential -%}
3
+ {% if token_credential %}
4
4
  ../../identity/azure-identity
5
5
  {% endif -%}
6
- {% if azure_arm -%}
6
+ {% if azure_arm %}
7
7
  ../../core/azure-mgmt-core
8
- {% endif -%}
8
+ {% endif %}
9
9
  aiohttp
@@ -2,19 +2,27 @@
2
2
  {{ license_header }}
3
3
  # coding: utf-8
4
4
  {% if package_mode %}
5
+
5
6
  import os
6
7
  import re
7
- {% endif -%}
8
+ {% endif %}
8
9
  from setuptools import setup, find_packages
9
10
 
10
11
  {% set package_name = package_name or code_model.clients[0].name %}
11
12
 
12
13
  PACKAGE_NAME = "{{ package_name|lower }}"
13
- {% if package_mode -%}
14
+ {% if package_mode %}
14
15
  PACKAGE_PPRINT_NAME = "{{ package_pprint_name }}"
16
+ {% if code_model.is_tsp %}
17
+ PACKAGE_NAMESPACE = "{{ code_model.namespace|lower }}"
18
+
19
+ # a.b.c => a/b/c
20
+ package_folder_path = PACKAGE_NAMESPACE.replace(".", "/")
21
+ {% else %}
15
22
 
16
23
  # a-b-c => a/b/c
17
24
  package_folder_path = PACKAGE_NAME.replace("-", "/")
25
+ {% endif %}
18
26
 
19
27
  # Version extraction inspired from 'requests'
20
28
  with open(os.path.join(package_folder_path, "_version.py"), "r") as fd:
@@ -33,7 +41,8 @@ version = "{{ package_version }}"
33
41
  {% set long_description = code_model.description %}
34
42
  {% set author_email = "" %}
35
43
  {% set url = "" %}
36
- {% endif -%}
44
+ {% endif %}
45
+
37
46
 
38
47
  setup(
39
48
  name=PACKAGE_NAME,
@@ -70,9 +79,9 @@ setup(
70
79
  {% if pkgutil_names %}
71
80
  # Exclude packages that will be covered by PEP420 or nspkg
72
81
  {% endif %}
73
- {%- for pkgutil_name in pkgutil_names %}
82
+ {% for pkgutil_name in pkgutil_names %}
74
83
  "{{ pkgutil_name }}",
75
- {%- endfor %}
84
+ {% endfor %}
76
85
  ]
77
86
  ),
78
87
  include_package_data=True,
@@ -19,9 +19,9 @@ Description-Content-Type: text/markdown
19
19
  License-File: LICENSE
20
20
  Requires-Dist: black==24.8.0
21
21
  Requires-Dist: docutils>=0.20.1
22
- Requires-Dist: Jinja2==3.1.3
22
+ Requires-Dist: Jinja2==3.1.6
23
23
  Requires-Dist: PyYAML==6.0.1
24
24
  Requires-Dist: tomli==2.0.1
25
- Requires-Dist: setuptools==69.5.1
25
+ Requires-Dist: setuptools==70.0.0
26
26
 
27
27
  # Core Library for Python Generation
@@ -1,6 +1,6 @@
1
1
  black==24.8.0
2
2
  docutils>=0.20.1
3
- Jinja2==3.1.3
3
+ Jinja2==3.1.6
4
4
  PyYAML==6.0.1
5
5
  tomli==2.0.1
6
- setuptools==69.5.1
6
+ setuptools==70.0.0
@@ -50,9 +50,9 @@ setup(
50
50
  install_requires=[
51
51
  "black==24.8.0",
52
52
  "docutils>=0.20.1",
53
- "Jinja2==3.1.3",
53
+ "Jinja2==3.1.6",
54
54
  "PyYAML==6.0.1",
55
55
  "tomli==2.0.1",
56
- "setuptools==69.5.1",
56
+ "setuptools==70.0.0",
57
57
  ],
58
58
  )
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@typespec/http-client-python",
3
- "version": "0.8.1",
3
+ "version": "0.9.0-dev.1",
4
4
  "author": "Microsoft Corporation",
5
5
  "description": "TypeSpec emitter for Python SDKs",
6
6
  "homepage": "https://typespec.io",
@@ -26,7 +26,7 @@
26
26
  }
27
27
  },
28
28
  "engines": {
29
- "node": ">=18.0.0"
29
+ "node": ">=20.0.0"
30
30
  },
31
31
  "scripts": {
32
32
  "clean": "rimraf ./dist ./temp ./emitter/temp ./generator/test/azure/generated ./generator/test/unbranded/generated ./venv",
@@ -57,7 +57,7 @@
57
57
  "@azure-tools/typespec-azure-core": ">=0.53.0 <1.0.0",
58
58
  "@azure-tools/typespec-azure-resource-manager": ">=0.53.0 <1.0.0",
59
59
  "@azure-tools/typespec-azure-rulesets": ">=0.53.0 <3.0.0",
60
- "@azure-tools/typespec-client-generator-core": ">=0.53.0 <1.0.0",
60
+ "@azure-tools/typespec-client-generator-core": ">=0.53.1 <1.0.0",
61
61
  "@typespec/compiler": ">=0.67.0 <1.0.0",
62
62
  "@typespec/http": ">=0.67.0 <1.0.0",
63
63
  "@typespec/openapi": ">=0.67.0 <1.0.0",
@@ -77,7 +77,7 @@
77
77
  "@azure-tools/typespec-azure-core": "~0.53.0",
78
78
  "@azure-tools/typespec-azure-resource-manager": "~0.53.0",
79
79
  "@azure-tools/typespec-azure-rulesets": "~0.53.0",
80
- "@azure-tools/typespec-client-generator-core": "~0.53.0",
80
+ "@azure-tools/typespec-client-generator-core": "~0.53.1",
81
81
  "@types/js-yaml": "~4.0.5",
82
82
  "@types/node": "~22.5.4",
83
83
  "@types/semver": "7.5.8",