py2docfx 0.1.10.dev1871193__py3-none-any.whl → 0.1.10.dev1871308__py3-none-any.whl

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.
py2docfx/__main__.py CHANGED
@@ -247,10 +247,13 @@ async def donwload_package_generate_documents(
247
247
  env_prepare_tasks = []
248
248
  env_remove_tasks = []
249
249
 
250
+ start_time = time.time()
250
251
  for idx in range(min([py2docfxEnvironment.VENV_BUFFER, len(package_info_list)])):
251
252
  env_prepare_tasks.append(asyncio.create_task(
252
253
  py2docfxEnvironment.prepare_venv(idx, required_package_list, github_token, ado_token)))
253
-
254
+ end_time = time.time()
255
+ print(f"<warmup_venvs>{end_time-start_time}<warmup_venvs/>")
256
+
254
257
  for idx, package in enumerate(package_info_list):
255
258
  package_number = start_num + idx
256
259
  print(f"Processing package {package.name}, env_prepare_tasks: {len(env_prepare_tasks)}")
@@ -261,7 +264,7 @@ async def donwload_package_generate_documents(
261
264
  print(f"Failed to setup venv for package {package.name}: {e}")
262
265
  raise
263
266
  end_time = time.time()
264
- print(f"<wait_prepare_venv>{end_time-start_time}<wait_prepare_venv/>")
267
+ print(f"<wait_prepare_venv>{package.name},{end_time-start_time}<wait_prepare_venv/>")
265
268
 
266
269
  start_time = time.time()
267
270
  get_source(py2docfxEnvironment.get_venv_exe(idx), package, package_number, vststoken=ado_token, githubtoken=github_token)
@@ -298,6 +301,7 @@ async def donwload_package_generate_documents(
298
301
  end_time = time.time()
299
302
  print(f"<move_document_to_target>{package.name},{end_time-start_time}<move_document_to_target/>")
300
303
 
304
+ start_time = time.time()
301
305
  if idx + py2docfxEnvironment.VENV_BUFFER < len(package_info_list):
302
306
  print(f"Creating venv {idx + py2docfxEnvironment.VENV_BUFFER}")
303
307
  env_prepare_tasks.append(
@@ -309,12 +313,20 @@ async def donwload_package_generate_documents(
309
313
  ado_token)
310
314
  )
311
315
  )
316
+ end_time = time.time()
317
+ print(f"<create_prepare_venv>{package.name},{end_time-start_time}<create_prepare_venv/>")
312
318
  if idx >= 1:
319
+ start_time = time.time()
313
320
  env_remove_tasks.append(asyncio.create_task(
314
- asyncio.to_thread(py2docfxEnvironment.remove_environment,idx-1)))
321
+ py2docfxEnvironment.remove_environment(idx-1)))
322
+ end_time = time.time()
323
+ print(f"<create_remove_venv>{package.name},{end_time-start_time}<create_remove_venv/>")
315
324
  if idx > py2docfxEnvironment.VENV_BUFFER and env_remove_tasks[idx-py2docfxEnvironment.VENV_BUFFER] != None:
325
+ start_time = time.time()
316
326
  print(f"Removing venv {idx-py2docfxEnvironment.VENV_BUFFER}")
317
327
  await env_remove_tasks[idx-py2docfxEnvironment.VENV_BUFFER]
328
+ end_time = time.time()
329
+ print(f"<wait_remove_venv>{package.name},{end_time-start_time}<wait_remove_venv/>")
318
330
 
319
331
  if output_doc_folder:
320
332
  start_time = time.time()
@@ -322,9 +334,12 @@ async def donwload_package_generate_documents(
322
334
  end_time = time.time()
323
335
  print(f"<move_root_toc_to_target>{end_time-start_time}<move_root_toc_to_target/>")
324
336
 
337
+ start_time = time.time()
325
338
  for idx in range(len(env_remove_tasks)):
326
339
  if env_remove_tasks[idx] != None and not env_remove_tasks[idx].done():
327
340
  await env_remove_tasks[idx]
341
+ end_time = time.time()
342
+ print(f"<wait_remove_venv>{end_time-start_time}<wait_remove_venv/>")
328
343
 
329
344
  def prepare_out_dir(output_root: str | os.PathLike) -> os.PathLike | None:
330
345
  # prepare output_root\DOC_FOLDER_NAME (if folder contains files, raise exception)
@@ -73,11 +73,18 @@ async def prepare_venv(venv_num: int, required_package_list: list[PackageInfo],
73
73
  await install_required_packages(get_venv_exe(venv_num), required_package_list, github_token, ado_token)
74
74
  print(f"<CI INFO>: venv{venv_num} setup complete.")
75
75
 
76
- def remove_environment(venv_num: int):
76
+ async def remove_environment(venv_num: int):
77
77
  venv_path = get_venv_path(venv_num)
78
78
  if os.path.exists(venv_path):
79
79
  print(f"<CI INFO>: Removing venv{venv_num}...")
80
- shutil.rmtree(venv_path)
81
-
82
- # Example usage
83
- # asyncio.run(remove_environment(1))
80
+ # Create a subprocess to run the shell command for removing the directory
81
+ process = await asyncio.create_subprocess_shell(
82
+ f'rm -rf {venv_path}' if os.name != 'nt' else f'rmdir /S /Q {venv_path}',
83
+ stdout=asyncio.subprocess.PIPE,
84
+ stderr=asyncio.subprocess.PIPE
85
+ )
86
+ stdout, stderr = await process.communicate()
87
+ if process.returncode == 0:
88
+ print(f"<CI INFO>: venv{venv_num} removed.")
89
+ else:
90
+ print(f"<CI ERROR>: Failed to remove venv{venv_num}. Error: {stderr.decode()}")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: py2docfx
3
- Version: 0.1.10.dev1871193
3
+ Version: 0.1.10.dev1871308
4
4
  Summary: A package built based on Sphinx which download source code package and generate yaml files supported by docfx.
5
5
  Author: Microsoft Corporation
6
6
  License: MIT License
@@ -1,7 +1,7 @@
1
1
  py2docfx/__init__.py,sha256=kPRhPGPC1JknDotkksG428c1iIgfFr_4_7Jm-llrowY,72
2
- py2docfx/__main__.py,sha256=NeNJ-Vu1C16P9vTYhp1TcujtK52QQRPsjnnV0nBKnss,15794
2
+ py2docfx/__main__.py,sha256=3vyfQ8XV8TtKPCb7C7A0d-VnzKXb58zfHOz806lUBa0,16554
3
3
  py2docfx/convert_prepare/__init__.py,sha256=XxtxrP0kmW3ZBHIAoxsPDEHzcgeC0WSnole8Lk6CjKs,11
4
- py2docfx/convert_prepare/environment.py,sha256=ihivOlbJ_AipP2OrgrvYcaE3EBYg4yqqsS4LzFl54m0,3624
4
+ py2docfx/convert_prepare/environment.py,sha256=DzmHS4dfOcOvkWroYXk3o4EHmeZIW1g7QVe1LRTDQSI,4126
5
5
  py2docfx/convert_prepare/generate_conf.py,sha256=wqs6iyElzJarH-20_qEL9zvZvt5xfBMsGXSXPSZy6wg,2295
6
6
  py2docfx/convert_prepare/generate_document.py,sha256=cLfFr7od0RHADkXyh2gaPreXZGvKNBUlduBosYTuPbk,3118
7
7
  py2docfx/convert_prepare/get_source.py,sha256=hvWR_yPlfliLI9wywtnimKpjhJkx-LUYD6adGHgYTFA,5899
@@ -1882,7 +1882,7 @@ py2docfx/venv/venv0/Scripts/rst2s5.py,sha256=lnv7lRNv1Oz3gjI5BOJlTqfCJQLJxgwJ9l3
1882
1882
  py2docfx/venv/venv0/Scripts/rst2xetex.py,sha256=5_9VjwA5RKUMJG9L__1ZiS8DIeLHRdPWeWW7B4otM8M,909
1883
1883
  py2docfx/venv/venv0/Scripts/rst2xml.py,sha256=hU2nzGVbXbQBnH_ydI5f2VDkGQyDMUdTgz3rfa45JMg,638
1884
1884
  py2docfx/venv/venv0/Scripts/rstpep2html.py,sha256=uLmCJKfEKPeeWS0n76HharN9YEYIuCRQQXfPPBJaRso,706
1885
- py2docfx-0.1.10.dev1871193.dist-info/METADATA,sha256=z9gHaJOpywGaoBDTaHhjL33nrLivlXQilUFNMiy30KU,601
1886
- py2docfx-0.1.10.dev1871193.dist-info/WHEEL,sha256=eOLhNAGa2EW3wWl_TU484h7q1UNgy0JXjjoqKoxAAQc,92
1887
- py2docfx-0.1.10.dev1871193.dist-info/top_level.txt,sha256=5dH2uP81dczt_qQJ38wiZ-gzoVWasfiJALWRSjdbnYU,9
1888
- py2docfx-0.1.10.dev1871193.dist-info/RECORD,,
1885
+ py2docfx-0.1.10.dev1871308.dist-info/METADATA,sha256=n7uLT1RnYyrbHOqNdysT6OrGuozubkH86PkVKH1kgms,601
1886
+ py2docfx-0.1.10.dev1871308.dist-info/WHEEL,sha256=eOLhNAGa2EW3wWl_TU484h7q1UNgy0JXjjoqKoxAAQc,92
1887
+ py2docfx-0.1.10.dev1871308.dist-info/top_level.txt,sha256=5dH2uP81dczt_qQJ38wiZ-gzoVWasfiJALWRSjdbnYU,9
1888
+ py2docfx-0.1.10.dev1871308.dist-info/RECORD,,