py2docfx 0.1.10.dev1871013__py3-none-any.whl → 0.1.10.dev1871296__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,10 +264,10 @@ 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
- get_source(package, package_number, vststoken=ado_token, githubtoken=github_token)
270
+ get_source(py2docfxEnvironment.get_venv_exe(idx), package, package_number, vststoken=ado_token, githubtoken=github_token)
268
271
  end_time = time.time()
269
272
  print(f"<get_source>{package.name},{end_time-start_time}<get_source/>")
270
273
 
@@ -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,11 +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:
313
- env_remove_tasks.append(asyncio.create_task(py2docfxEnvironment.remove_environment(idx-1)))
319
+ start_time = time.time()
320
+ env_remove_tasks.append(asyncio.create_task(
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/>")
314
324
  if idx > py2docfxEnvironment.VENV_BUFFER and env_remove_tasks[idx-py2docfxEnvironment.VENV_BUFFER] != None:
325
+ start_time = time.time()
315
326
  print(f"Removing venv {idx-py2docfxEnvironment.VENV_BUFFER}")
316
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/>")
317
330
 
318
331
  if output_doc_folder:
319
332
  start_time = time.time()
@@ -321,9 +334,12 @@ async def donwload_package_generate_documents(
321
334
  end_time = time.time()
322
335
  print(f"<move_root_toc_to_target>{end_time-start_time}<move_root_toc_to_target/>")
323
336
 
337
+ start_time = time.time()
324
338
  for idx in range(len(env_remove_tasks)):
325
339
  if env_remove_tasks[idx] != None and not env_remove_tasks[idx].done():
326
340
  await env_remove_tasks[idx]
341
+ end_time = time.time()
342
+ print(f"<wait_remove_venv>{end_time-start_time}<wait_remove_venv/>")
327
343
 
328
344
  def prepare_out_dir(output_root: str | os.PathLike) -> os.PathLike | None:
329
345
  # prepare output_root\DOC_FOLDER_NAME (if folder contains files, raise exception)
@@ -77,7 +77,14 @@ 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
- return asyncio.to_thread(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(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
+ )).wait()
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()}")
@@ -11,7 +11,7 @@ from py2docfx.convert_prepare.source import Source
11
11
 
12
12
  YAML_OUTPUT_ROOT = path.join("target_repo", "docs-ref-autogen")
13
13
 
14
- def update_package_info(pkg: PackageInfo, source_folder: str):
14
+ def update_package_info(executable: str, pkg: PackageInfo, source_folder: str):
15
15
  cur_path = os.getcwd()
16
16
  os.chdir(source_folder) # TODO: replace it
17
17
 
@@ -23,7 +23,7 @@ def update_package_info(pkg: PackageInfo, source_folder: str):
23
23
  if "setup.py" in files:
24
24
  for attr in attrs:
25
25
  proc_ret = subprocess.run(
26
- ["python", "setup.py", "--quiet", "--dry-run", f"--{attr}"],
26
+ [executable, "setup.py", "--quiet", "--dry-run", f"--{attr}"],
27
27
  capture_output=True,
28
28
  text=True,
29
29
  check=True
@@ -70,7 +70,7 @@ def update_package_info(pkg: PackageInfo, source_folder: str):
70
70
  source_folder=source_folder, yaml_output_folder=yaml_output_folder, package_name=pkg.name
71
71
  )
72
72
 
73
- def get_source(pkg: PackageInfo, cnt: int, vststoken=None, githubtoken=None):
73
+ def get_source(executable: str, pkg: PackageInfo, cnt: int, vststoken=None, githubtoken=None):
74
74
  path_cnt = str(cnt)
75
75
  dist_dir = path.join("dist_temp", path_cnt)
76
76
 
@@ -138,6 +138,6 @@ def get_source(pkg: PackageInfo, cnt: int, vststoken=None, githubtoken=None):
138
138
  raise ValueError(f"Unknown install type: {pkg.install_type}")
139
139
 
140
140
  start_time = time.time()
141
- update_package_info(pkg, source_folder)
141
+ update_package_info(executable, pkg, source_folder)
142
142
  end_time = time.time()
143
143
  print(f"<update_package_info>{pkg.name},{end_time-start_time}<update_package_info/>")
@@ -5,6 +5,7 @@ import os
5
5
  import shutil
6
6
  import stat
7
7
  import pytest
8
+ import sys
8
9
  from py2docfx.convert_prepare import git
9
10
  from py2docfx.convert_prepare import get_source
10
11
  from py2docfx.convert_prepare.package_info import PackageInfo
@@ -44,19 +45,19 @@ def test_update_package_info(init_package_info):
44
45
  base_path = "convert_prepare/tests/data/get_source/"
45
46
 
46
47
  # case of setup.py
47
- get_source.update_package_info(package, os.path.join(base_path, "mock-1"))
48
+ get_source.update_package_info(sys.executable, package, os.path.join(base_path, "mock-1"))
48
49
  assert package.name == "dummy_package"
49
50
  assert package.version == "3.1.0"
50
51
 
51
52
  # case of metadata
52
53
  package = init_package_info
53
- get_source.update_package_info(package, os.path.join(base_path, "mock-2"))
54
+ get_source.update_package_info(sys.executable, package, os.path.join(base_path, "mock-2"))
54
55
  assert package.name == "mock_package"
55
56
  assert package.version == "2.2.0"
56
57
 
57
58
  # case of dist-info folder
58
59
  package = init_package_info
59
- get_source.update_package_info(package, os.path.join(base_path, "mock-3"))
60
+ get_source.update_package_info(sys.executable, package, os.path.join(base_path, "mock-3"))
60
61
  assert package.name == "mock_package"
61
62
  assert package.version == "1.2.0"
62
63
 
@@ -75,7 +76,7 @@ def test_get_source_git_clone(init_package_info):
75
76
  package.branch = "main"
76
77
  package.folder = None
77
78
  package.url = "https://github.com/Azure/azure-iot-hub-python"
78
- get_source.get_source(package, 0)
79
+ get_source.get_source(sys.executable, package, 0)
79
80
  assert git.status("source_repo/0") is True
80
81
 
81
82
  def test_get_source_dist_file_zip(init_package_info):
@@ -91,7 +92,7 @@ def test_get_source_dist_file_zip(init_package_info):
91
92
  package.extra_index_url = None
92
93
  package.prefer_source_distribution = True
93
94
  package.location = "https://files.pythonhosted.org/packages/3e/71/f6f71a276e2e69264a97ad39ef850dca0a04fce67b12570730cb38d0ccac/azure-common-1.1.28.zip"
94
- get_source.get_source(package, 1)
95
+ get_source.get_source(sys.executable, package, 1)
95
96
  assert os.path.exists("dist_temp/1/azure-common-1.1.28")
96
97
  assert package.path.source_folder == "dist_temp\\1\\azure-common-1.1.28"
97
98
  assert os.path.exists("dist_temp/1/azure-common-1.1.28.zip") is False
@@ -109,7 +110,7 @@ def test_get_source_dist_file_whl(init_package_info):
109
110
  package.extra_index_url = None
110
111
  package.prefer_source_distribution = True
111
112
  package.location = "https://files.pythonhosted.org/packages/62/55/7f118b9c1b23ec15ca05d15a578d8207aa1706bc6f7c87218efffbbf875d/azure_common-1.1.28-py2.py3-none-any.whl"
112
- get_source.get_source(package, 2)
113
+ get_source.get_source(sys.executable, package, 2)
113
114
  assert os.path.exists("dist_temp/2/azure_common-1.1.28")
114
115
  assert package.path.source_folder == "dist_temp\\2\\azure_common-1.1.28"
115
116
  assert os.path.exists("dist_temp/2/azure_common-1.1.28-py2.py3-none-any.whl") is False
@@ -127,7 +128,7 @@ def test_get_source_dist_file_tar(init_package_info):
127
128
  package.extra_index_url = None
128
129
  package.prefer_source_distribution = True
129
130
  package.location = "https://files.pythonhosted.org/packages/fa/19/43a9eb812b4d6071fdc2c55640318f7eb5a1be8dbd3b6f9d96a1996e1bb6/azure-core-1.29.4.tar.gz"
130
- get_source.get_source(package, 3)
131
+ get_source.get_source(sys.executable, package, 3)
131
132
  assert os.path.exists("dist_temp/3/azure-core-1.29.4")
132
133
  assert package.path.source_folder == "dist_temp\\3\\azure-core-1.29.4"
133
134
  assert os.path.exists("dist_temp/3/azure-core-1.29.4.tar.gz") is False
@@ -144,7 +145,7 @@ def test_get_source_pip_whl(init_package_info):
144
145
  package.build_in_subpackage = False
145
146
  package.extra_index_url = None
146
147
  package.prefer_source_distribution = False
147
- get_source.get_source(package, 4)
148
+ get_source.get_source(sys.executable, package, 4)
148
149
  assert os.path.exists("dist_temp/4/azure_common-1.1.28")
149
150
  assert package.path.source_folder == "dist_temp\\4\\azure_common-1.1.28"
150
151
  assert os.path.exists("dist_temp/4/azure_common-1.1.28-py2.py3-none-any.whl") is False
@@ -161,7 +162,7 @@ def test_get_source_pip_zip(init_package_info):
161
162
  package.build_in_subpackage = False
162
163
  package.extra_index_url = None
163
164
  package.prefer_source_distribution = True
164
- get_source.get_source(package, 5)
165
+ get_source.get_source(sys.executable, package, 5)
165
166
  assert os.path.exists("dist_temp/5/azure-common-1.1.28")
166
167
  assert package.path.source_folder == "dist_temp\\5\\azure-common-1.1.28"
167
168
  assert os.path.exists("dist_temp/5/azure-common-1.1.28.zip") is False
@@ -178,7 +179,7 @@ def test_get_source_zip_file_at_position_0(init_package_info):
178
179
  package.build_in_subpackage = False
179
180
  package.extra_index_url = None
180
181
  package.prefer_source_distribution = True
181
- get_source.get_source(package, 6)
182
+ get_source.get_source(sys.executable, package, 6)
182
183
  assert os.path.exists("dist_temp/6/azure_template-0.1.0b3942895")
183
184
  assert package.path.source_folder == "dist_temp\\6\\azure_template-0.1.0b3942895"
184
185
  assert os.path.exists("dist_temp/6/azure_template-0.1.0b3942895.tar.gz") is False
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: py2docfx
3
- Version: 0.1.10.dev1871013
3
+ Version: 0.1.10.dev1871296
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,10 +1,10 @@
1
1
  py2docfx/__init__.py,sha256=kPRhPGPC1JknDotkksG428c1iIgfFr_4_7Jm-llrowY,72
2
- py2docfx/__main__.py,sha256=Nq5DzPY8RZNuUqUUTW6rF_k_75LNrGG39lX4injCWrY,15719
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=_gGbLRnuOnL8vsU-b7jZITqIN9CUeSXNFB8_xKWtKjk,3656
4
+ py2docfx/convert_prepare/environment.py,sha256=PDQfOUHEHFIZUiBPDK1zsrOM_dnC0HES-IpClk7a_us,4140
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
- py2docfx/convert_prepare/get_source.py,sha256=eEIbfLkGdBSOIJElMBTiXkKlkujb_hdFu5g6InNroTg,5851
7
+ py2docfx/convert_prepare/get_source.py,sha256=hvWR_yPlfliLI9wywtnimKpjhJkx-LUYD6adGHgYTFA,5899
8
8
  py2docfx/convert_prepare/git.py,sha256=xGJp2nDWLfVljrxyPnFKPoLIqmBh6by-QdITogIuxi0,5893
9
9
  py2docfx/convert_prepare/install_package.py,sha256=hATmgazcSX7k2n4jQXh9sQMyNUc1k1YqHv5K5UMALq4,262
10
10
  py2docfx/convert_prepare/pack.py,sha256=vZS67_GzEhUmZWHU1dxm8gnWyRBs-kB6-KjX1d_FdOU,1260
@@ -24,7 +24,7 @@ py2docfx/convert_prepare/subpackage_merge/merge_root_package.py,sha256=uK96qL2as
24
24
  py2docfx/convert_prepare/subpackage_merge/merge_toc.py,sha256=nkVqe8R0m8D6cyTYV7aIpMDXorvn4-LXfU_vIK_hJBg,1706
25
25
  py2docfx/convert_prepare/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
26
26
  py2docfx/convert_prepare/tests/test_generate_document.py,sha256=FpxwyRQFBfEdYUH16tpcJrqTAC0J5mq-Edn-N7Lz0rY,2413
27
- py2docfx/convert_prepare/tests/test_get_source.py,sha256=70EVlIZe71aDYDOXMnhqzZclKL8KuIg4t-X0U-pVyhA,7429
27
+ py2docfx/convert_prepare/tests/test_get_source.py,sha256=pry20HGWLfQGDtpNoj2uc_y1AwgNGWEvBWPpJUEVSVY,7601
28
28
  py2docfx/convert_prepare/tests/test_pack.py,sha256=46JWMNzknIptDVs7D3CuxcmqBr_OKMmaw1br9H7wqco,4134
29
29
  py2docfx/convert_prepare/tests/test_package_info.py,sha256=3B-IzmUjETVO-5s3g3Lmh2E6JgopwnRauv8mB-SDZEM,3361
30
30
  py2docfx/convert_prepare/tests/test_params.py,sha256=C-aY9xDjsNTcGQATco_J_i4nF4JSmaeFPEMI3-NtiGE,2229
@@ -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.dev1871013.dist-info/METADATA,sha256=tnMc1MCAhdOQTwQam94xJuJfhlBL1Elbd28qOYpzGFI,601
1886
- py2docfx-0.1.10.dev1871013.dist-info/WHEEL,sha256=eOLhNAGa2EW3wWl_TU484h7q1UNgy0JXjjoqKoxAAQc,92
1887
- py2docfx-0.1.10.dev1871013.dist-info/top_level.txt,sha256=5dH2uP81dczt_qQJ38wiZ-gzoVWasfiJALWRSjdbnYU,9
1888
- py2docfx-0.1.10.dev1871013.dist-info/RECORD,,
1885
+ py2docfx-0.1.10.dev1871296.dist-info/METADATA,sha256=bblQMXf6CUjCcgJcRO1yU0S01CIXfig8J_Rpdk6-FbQ,601
1886
+ py2docfx-0.1.10.dev1871296.dist-info/WHEEL,sha256=eOLhNAGa2EW3wWl_TU484h7q1UNgy0JXjjoqKoxAAQc,92
1887
+ py2docfx-0.1.10.dev1871296.dist-info/top_level.txt,sha256=5dH2uP81dczt_qQJ38wiZ-gzoVWasfiJALWRSjdbnYU,9
1888
+ py2docfx-0.1.10.dev1871296.dist-info/RECORD,,