@typespec/http-client-python 0.6.11 → 0.7.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.
@@ -58,6 +58,7 @@ const EMITTER_OPTIONS: Record<string, Record<string, string> | Record<string, st
58
58
  },
59
59
  "type/array": {
60
60
  "package-name": "typetest-array",
61
+ "use-pyodide": "true",
61
62
  },
62
63
  "type/dictionary": {
63
64
  "package-name": "typetest-dictionary",
@@ -85,6 +86,7 @@ const EMITTER_OPTIONS: Record<string, Record<string, string> | Record<string, st
85
86
  },
86
87
  "type/model/inheritance/recursive": {
87
88
  "package-name": "typetest-model-recursive",
89
+ "use-pyodide": "true",
88
90
  },
89
91
  "type/model/usage": {
90
92
  "package-name": "typetest-model-usage",
@@ -314,10 +316,24 @@ function _getCmdList(spec: string, flags: RegenerateFlags): TspCommand[] {
314
316
  });
315
317
  }
316
318
 
319
+ async function runTaskPool(tasks: Array<() => Promise<void>>, poolLimit: number): Promise<void> {
320
+ let currentIndex = 0;
321
+
322
+ async function worker() {
323
+ while (currentIndex < tasks.length) {
324
+ const index = currentIndex++;
325
+ await tasks[index]();
326
+ }
327
+ }
328
+
329
+ const workers = new Array(Math.min(poolLimit, tasks.length)).fill(null).map(() => worker());
330
+ await Promise.all(workers);
331
+ }
332
+
317
333
  async function regenerate(flags: RegenerateFlagsInput): Promise<void> {
318
334
  if (flags.flavor === undefined) {
319
335
  await regenerate({ flavor: "azure", ...flags });
320
- await regenerate({ flavor: "unbranded", pyodide: true, ...flags });
336
+ await regenerate({ flavor: "unbranded", ...flags });
321
337
  } else {
322
338
  const flagsResolved = { debug: false, flavor: flags.flavor, ...flags };
323
339
  const subdirectoriesForAzure = await getSubdirectories(AZURE_HTTP_SPECS, flagsResolved);
@@ -329,11 +345,22 @@ async function regenerate(flags: RegenerateFlagsInput): Promise<void> {
329
345
  const cmdList: TspCommand[] = subdirectories.flatMap((subdirectory) =>
330
346
  _getCmdList(subdirectory, flagsResolved),
331
347
  );
332
- const PromiseCommands = cmdList.map((tspCommand) => executeCommand(tspCommand));
333
- await Promise.all(PromiseCommands);
348
+
349
+ // Create tasks as functions for the pool
350
+ const tasks: Array<() => Promise<void>> = cmdList.map((tspCommand) => {
351
+ return () => executeCommand(tspCommand);
352
+ });
353
+
354
+ // Run tasks with a concurrency limit
355
+ await runTaskPool(tasks, 30);
334
356
  }
335
357
  }
336
358
 
359
+ const start = performance.now();
337
360
  regenerate(argv.values)
338
- .then(() => console.log("Regeneration successful"))
361
+ .then(() =>
362
+ console.log(
363
+ `Regeneration successful, time taken: ${Math.round((performance.now() - start) / 1000)} s`,
364
+ ),
365
+ )
339
366
  .catch((error) => console.error(`Regeneration failed: ${error.message}`));
@@ -8,6 +8,8 @@
8
8
  # This script is used to execute apiview generation within a tox environment. Depending on which package is being executed against,
9
9
  # a failure may be suppressed.
10
10
 
11
+ import os
12
+ import sys
11
13
  from subprocess import check_call, CalledProcessError
12
14
  import logging
13
15
  from util import run_check
@@ -37,4 +39,7 @@ def _single_dir_apiview(mod):
37
39
 
38
40
 
39
41
  if __name__ == "__main__":
42
+ if os.name == "nt":
43
+ logging.info("Skip running ApiView on Windows for now to reduce time cost in CI")
44
+ sys.exit(0)
40
45
  run_check("apiview", _single_dir_apiview, "APIView")
@@ -8,16 +8,6 @@
8
8
 
9
9
  {{ serializer.discriminator_docstring(model) | wordwrap(width=95, break_long_words=False, break_on_hyphens=False, wrapstring='\n ') }}
10
10
  {% endif %}
11
- {% if model.has_readonly_or_constant_property %}
12
-
13
- Readonly variables are only populated by the server, and will be ignored when sending a request.
14
- {% endif %}
15
- {% if (model.properties | selectattr('optional', "equalto", false) | first) is defined %}
16
-
17
- {% if not model.is_usage_output %}
18
- All required parameters must be populated in order to send to server.
19
- {% endif %}
20
- {% endif %}
21
11
 
22
12
  {% if model.properties != None %}
23
13
  {% for p in model.properties %}
@@ -410,7 +410,7 @@ class Model:
410
410
  :param function key_extractors: A key extractor function.
411
411
  :param str content_type: JSON by default, set application/xml if XML.
412
412
  :returns: An instance of this model
413
- :raises: DeserializationError if something went wrong
413
+ :raises DeserializationError: if something went wrong
414
414
  :rtype: Self
415
415
  """
416
416
  deserializer = Deserializer(cls._infer_class_models())
@@ -126,9 +126,9 @@
126
126
  "implementation_version": "3.8.10",
127
127
  "os_name": "posix",
128
128
  "platform_machine": "x86_64",
129
- "platform_release": "5.15.0-1079-azure",
129
+ "platform_release": "5.15.0-1081-azure",
130
130
  "platform_system": "Linux",
131
- "platform_version": "#88~20.04.1-Ubuntu SMP Fri Jan 17 18:28:29 UTC 2025",
131
+ "platform_version": "#90~20.04.1-Ubuntu SMP Tue Jan 28 05:34:18 UTC 2025",
132
132
  "python_full_version": "3.8.10",
133
133
  "platform_python_implementation": "CPython",
134
134
  "python_version": "3.8",
@@ -8,16 +8,6 @@
8
8
 
9
9
  {{ serializer.discriminator_docstring(model) | wordwrap(width=95, break_long_words=False, break_on_hyphens=False, wrapstring='\n ') }}
10
10
  {% endif %}
11
- {% if model.has_readonly_or_constant_property %}
12
-
13
- Readonly variables are only populated by the server, and will be ignored when sending a request.
14
- {% endif %}
15
- {% if (model.properties | selectattr('optional', "equalto", false) | first) is defined %}
16
-
17
- {% if not model.is_usage_output %}
18
- All required parameters must be populated in order to send to server.
19
- {% endif %}
20
- {% endif %}
21
11
 
22
12
  {% if model.properties != None %}
23
13
  {% for p in model.properties %}
@@ -410,7 +410,7 @@ class Model:
410
410
  :param function key_extractors: A key extractor function.
411
411
  :param str content_type: JSON by default, set application/xml if XML.
412
412
  :returns: An instance of this model
413
- :raises: DeserializationError if something went wrong
413
+ :raises DeserializationError: if something went wrong
414
414
  :rtype: Self
415
415
  """
416
416
  deserializer = Deserializer(cls._infer_class_models())
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@typespec/http-client-python",
3
- "version": "0.6.11",
3
+ "version": "0.7.0",
4
4
  "author": "Microsoft Corporation",
5
5
  "description": "TypeSpec emitter for Python SDKs",
6
6
  "homepage": "https://typespec.io",
@@ -53,16 +53,16 @@
53
53
  "emitter"
54
54
  ],
55
55
  "peerDependencies": {
56
- "@azure-tools/typespec-autorest": ">=0.51.0 <1.0.0",
57
- "@azure-tools/typespec-azure-core": ">=0.51.0 <1.0.0",
58
- "@azure-tools/typespec-azure-resource-manager": ">=0.51.0 <1.0.0",
59
- "@azure-tools/typespec-azure-rulesets": ">=0.51.0 <3.0.0",
60
- "@azure-tools/typespec-client-generator-core": ">=0.51.1 <1.0.0",
61
- "@typespec/compiler": ">=0.65.0 <1.0.0",
62
- "@typespec/http": ">=0.65.0 <1.0.0",
63
- "@typespec/openapi": ">=0.65.0 <1.0.0",
64
- "@typespec/rest": ">=0.65.0 <1.0.0",
65
- "@typespec/versioning": ">=0.65.0 <1.0.0"
56
+ "@azure-tools/typespec-autorest": ">=0.52.0 <1.0.0",
57
+ "@azure-tools/typespec-azure-core": ">=0.52.0 <1.0.0",
58
+ "@azure-tools/typespec-azure-resource-manager": ">=0.52.0 <1.0.0",
59
+ "@azure-tools/typespec-azure-rulesets": ">=0.52.0 <3.0.0",
60
+ "@azure-tools/typespec-client-generator-core": ">=0.52.0 <1.0.0",
61
+ "@typespec/compiler": ">=0.66.0 <1.0.0",
62
+ "@typespec/http": ">=0.66.0 <1.0.0",
63
+ "@typespec/openapi": ">=0.66.0 <1.0.0",
64
+ "@typespec/rest": ">=0.66.0 <1.0.0",
65
+ "@typespec/versioning": ">=0.66.0 <1.0.0"
66
66
  },
67
67
  "dependencies": {
68
68
  "js-yaml": "~4.1.0",
@@ -71,21 +71,21 @@
71
71
  "tsx": "~4.19.1"
72
72
  },
73
73
  "devDependencies": {
74
- "@azure-tools/azure-http-specs": "0.1.0-alpha.6",
75
- "@azure-tools/typespec-autorest": "~0.51.0",
76
- "@azure-tools/typespec-azure-core": "~0.51.0",
77
- "@azure-tools/typespec-azure-resource-manager": "~0.51.0",
78
- "@azure-tools/typespec-azure-rulesets": "~0.51.0",
79
- "@azure-tools/typespec-client-generator-core": "~0.51.1",
74
+ "@azure-tools/azure-http-specs": "0.1.0-alpha.7",
75
+ "@azure-tools/typespec-autorest": "~0.52.0",
76
+ "@azure-tools/typespec-azure-core": "~0.52.0",
77
+ "@azure-tools/typespec-azure-resource-manager": "~0.52.0",
78
+ "@azure-tools/typespec-azure-rulesets": "~0.52.0",
79
+ "@azure-tools/typespec-client-generator-core": "~0.52.0",
80
80
  "@types/js-yaml": "~4.0.5",
81
81
  "@types/node": "~22.5.4",
82
82
  "@types/semver": "7.5.8",
83
- "@typespec/compiler": "~0.65.0",
84
- "@typespec/http": "~0.65.0",
85
- "@typespec/http-specs": "0.1.0-alpha.9",
86
- "@typespec/openapi": "~0.65.0",
87
- "@typespec/rest": "~0.65.0",
88
- "@typespec/versioning": "~0.65.0",
83
+ "@typespec/compiler": "~0.66.0",
84
+ "@typespec/http": "~0.66.0",
85
+ "@typespec/http-specs": "0.1.0-alpha.11",
86
+ "@typespec/openapi": "~0.66.0",
87
+ "@typespec/rest": "~0.66.0",
88
+ "@typespec/versioning": "~0.66.0",
89
89
  "c8": "^10.1.3",
90
90
  "chalk": "5.3.0",
91
91
  "rimraf": "~6.0.1",