py2docfx 0.1.11.dev1859874__py3-none-any.whl → 0.1.11.dev1869610__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
@@ -3,11 +3,8 @@ import argparse
3
3
  import os
4
4
  import shutil
5
5
  import sys
6
- import threading
7
6
  import time
8
7
 
9
- sys.path.insert(0, "C:\\MsCodeRepo\\py2docfx\\src")
10
-
11
8
  from py2docfx import PACKAGE_ROOT
12
9
  from py2docfx.convert_prepare.environment import VirtualEnvironmentManager
13
10
  from py2docfx.convert_prepare.generate_document import generate_document
@@ -18,7 +15,6 @@ from py2docfx.convert_prepare.params import load_file_params, load_command_param
18
15
  from py2docfx.convert_prepare.package_info import PackageInfo
19
16
 
20
17
  CLEAN_UP_FOLDERS = ["dist_temp", "source_repo", "target_repo", "venv"]
21
- CACHED_VIRTUALENV_LENGTH = 5
22
18
 
23
19
  print("Adding yaml extension to path")
24
20
  sys.path.insert(0, os.path.join(os.path.dirname(os.path.abspath(__file__)),'docfx_yaml'))
@@ -227,20 +223,6 @@ def donwload_package_generate_documents(
227
223
  github_token: str, ado_token: str):
228
224
 
229
225
  venv_manager = VirtualEnvironmentManager(package_info_list, required_package_list, github_token, ado_token)
230
- def initial_venv_cache():
231
- package_count = len(package_info_list)
232
- cache_cout = CACHED_VIRTUALENV_LENGTH
233
- if package_count < CACHED_VIRTUALENV_LENGTH:
234
- cache_cout = package_count
235
-
236
- threads = []
237
- for i in range(cache_cout):
238
- thread = threading.Thread(target = venv_manager.create_template_venv, args=[str(i)])
239
- threads.append(thread)
240
- thread.start()
241
-
242
- for thread in threads:
243
- thread.join()
244
226
 
245
227
  def donwload_one_package_generate_document(
246
228
  package: PackageInfo,
@@ -274,25 +256,10 @@ def donwload_package_generate_documents(
274
256
  if output_doc_folder:
275
257
  package.path.move_document_to_target(os.path.join(output_doc_folder, package.name))
276
258
 
277
- # Cache virtual environments
278
- start_time = time.time()
279
- initial_venv_cache()
280
- end_time = time.time()
281
- print(f"<initial_venv_cache>{end_time - start_time}<initial_venv_cache/>")
282
-
283
259
  for package_index, package in enumerate(package_info_list):
284
260
  worker_venv_id = str(package_index)
261
+ venv_manager.create_template_venv(worker_venv_id)
285
262
  env_executable = os.path.join(PACKAGE_ROOT, "venv", worker_venv_id, "Scripts", "python.exe")
286
- # check if the venv is created
287
- if not os.path.exists(env_executable):
288
- raise RuntimeError(f"Virtual environment for {package.name} is not avaliable")
289
-
290
- # start caching new venv
291
- cache_condition = package_index + CACHED_VIRTUALENV_LENGTH < len(package_info_list)
292
- if cache_condition:
293
- cache_venv_id = str(package_index + CACHED_VIRTUALENV_LENGTH)
294
- thread = threading.Thread(target = venv_manager.create_template_venv, args=[cache_venv_id])
295
- thread.start()
296
263
 
297
264
  start_time = time.time()
298
265
  donwload_one_package_generate_document(package, package_index, env_executable)
@@ -302,10 +269,6 @@ def donwload_package_generate_documents(
302
269
  # used venv clean up
303
270
  folder_clean_up(os.path.join(PACKAGE_ROOT, "venv", worker_venv_id))
304
271
 
305
- # wait for the new venv to be cached
306
- if cache_condition:
307
- thread.join()
308
-
309
272
  if output_doc_folder:
310
273
  start_time = time.time()
311
274
  move_root_toc_to_target(YAML_OUTPUT_ROOT, output_doc_folder)
@@ -3,12 +3,12 @@ from py2docfx import PACKAGE_ROOT
3
3
  PYPI = "pypi"
4
4
 
5
5
  pip_install_common_options = [
6
- # "--no-cache-dir",
6
+ "--no-cache-dir",
7
7
  "--quiet",
8
- "--no-compile",
8
+ #"--no-compile",
9
9
  "--no-warn-conflicts",
10
10
  "--disable-pip-version-check",
11
- # "--verbose",
11
+ "--verbose",
12
12
  ]
13
13
 
14
14
 
@@ -26,12 +26,15 @@ def download(package_name, path, executable, extra_index_url=None, prefer_source
26
26
 
27
27
 
28
28
  def install(package_name, options, executable, quiet_install=True):
29
- # Installs a package from PyPI using pip.
30
- install_param = "pip install {} {}".format(
31
- " ".join(pip_install_common_options + options), package_name
32
- ).split(" ")
29
+ install_param = [
30
+ executable,
31
+ "-m"
32
+ "pip",
33
+ "install",
34
+ package_name
35
+ ]
33
36
 
34
37
  if quiet_install:
35
- subprocess.run([executable, "-m"] + install_param + pip_install_common_options, check=True, cwd=PACKAGE_ROOT)
38
+ subprocess.run(install_param + pip_install_common_options, check=True, cwd=PACKAGE_ROOT)
36
39
  else:
37
- subprocess.run([executable, "-m"] + install_param, check=True, cwd=PACKAGE_ROOT)
40
+ subprocess.run(install_param, check=True, cwd=PACKAGE_ROOT)
@@ -79,7 +79,8 @@ def run_converter(rst_path, out_path, executable, conf_path = None):
79
79
  if not executable:
80
80
  raise ValueError("Can't get the executable binary for the Python interpreter.")
81
81
  sphinx_param = [
82
- executable, sphinx_build_path,
82
+ executable,
83
+ sphinx_build_path,
83
84
  rst_path,
84
85
  outdir,
85
86
  '-c', conf_path or rst_path,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: py2docfx
3
- Version: 0.1.11.dev1859874
3
+ Version: 0.1.11.dev1869610
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,5 +1,5 @@
1
1
  py2docfx/__init__.py,sha256=kPRhPGPC1JknDotkksG428c1iIgfFr_4_7Jm-llrowY,72
2
- py2docfx/__main__.py,sha256=KJoUsy5BCnk6-Qt7JghIQYy7MJ6PRl1aPi8cpGv7iDI,13555
2
+ py2docfx/__main__.py,sha256=_FCsC7Gt7WnOGb4ZTAAsd5JIDuuLNQm1CNlcGPv82y0,12157
3
3
  py2docfx/convert_prepare/__init__.py,sha256=XxtxrP0kmW3ZBHIAoxsPDEHzcgeC0WSnole8Lk6CjKs,11
4
4
  py2docfx/convert_prepare/environment.py,sha256=r_Jp3hL_wGsM0ZkliFjJOC_jiFbEh90Wmw2ZXhn_MwI,2955
5
5
  py2docfx/convert_prepare/generate_conf.py,sha256=wqs6iyElzJarH-20_qEL9zvZvt5xfBMsGXSXPSZy6wg,2295
@@ -12,10 +12,10 @@ py2docfx/convert_prepare/package_info.py,sha256=vRkFKuBxxIm4yyb2daWTzdISma8pL-RM
12
12
  py2docfx/convert_prepare/package_info_extra_settings.py,sha256=u5B5e8hc0m9PA_-0kJzq1LtKn-xzZlucwXHTFy49mDg,1475
13
13
  py2docfx/convert_prepare/params.py,sha256=PXMB8pLtb4XbfI322avA47q0AO-TyBE6kZf7FU8I6v4,1771
14
14
  py2docfx/convert_prepare/paths.py,sha256=964RX81Qf__rzXgEATfqBNFCKTYVjLt9J7WCz2TnNdc,485
15
- py2docfx/convert_prepare/pip_utils.py,sha256=KsPGKPHJmDKZXufquto7lOGcPzo2f52LVC9OdYwjdj8,1373
15
+ py2docfx/convert_prepare/pip_utils.py,sha256=qA_bMoORlFnKriIqGohbskYIwLfslXpWJkwTOQo8H2A,1267
16
16
  py2docfx/convert_prepare/repo_info.py,sha256=6ASJlhBwf6vZTSENgrWCVlJjlJVhuBxzdQyWEdWAC4c,117
17
17
  py2docfx/convert_prepare/source.py,sha256=6-A7oof3-WAQcQZZVpT9pKiFLH4CCIZeYqq0MN0O3gw,1710
18
- py2docfx/convert_prepare/sphinx_caller.py,sha256=fGgNiNZRjFsV3HqpemVVbEVYaN5BoJs8N1BfYPiFaQI,4435
18
+ py2docfx/convert_prepare/sphinx_caller.py,sha256=JUafEpC2L-S3lZDpRwRFPhSzD-2EzFA8CPel8rnSA4s,4448
19
19
  py2docfx/convert_prepare/subpackage.py,sha256=mXAi_07pXvnPkSLZfykDh_7VeFxfLy74pYlzhMO8N_Q,5183
20
20
  py2docfx/convert_prepare/conf_templates/conf.py_t,sha256=VL5K6xUTIw2cb4GFjDXu5iCZFPA2Kb36KLvier78HFg,3811
21
21
  py2docfx/convert_prepare/conf_templates/master_doc.rst_t,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -1883,7 +1883,7 @@ py2docfx/venv/0/Scripts/rst2s5.py,sha256=qup0-LMkBGLuh6Bj-1n8ucEVc5T8ANpqL0Pscmp
1883
1883
  py2docfx/venv/0/Scripts/rst2xetex.py,sha256=FNBX2UuBN3vqJQss_DdqjMBSU5BQmOFGLOZV8DSNAuk,905
1884
1884
  py2docfx/venv/0/Scripts/rst2xml.py,sha256=7uyNsZb5QOV243R-EQqdsyUKX7t5_9sQd6LYtw1ZyPA,634
1885
1885
  py2docfx/venv/0/Scripts/rstpep2html.py,sha256=p-PYRUWuvD1LWAzofxrQu_Go3SMfIS8q0pmy6HT2Y5E,702
1886
- py2docfx-0.1.11.dev1859874.dist-info/METADATA,sha256=sAohHeMJItV8oOmJckAc2_BOzCgGPF_NLarh1M1LEFA,601
1887
- py2docfx-0.1.11.dev1859874.dist-info/WHEEL,sha256=eOLhNAGa2EW3wWl_TU484h7q1UNgy0JXjjoqKoxAAQc,92
1888
- py2docfx-0.1.11.dev1859874.dist-info/top_level.txt,sha256=5dH2uP81dczt_qQJ38wiZ-gzoVWasfiJALWRSjdbnYU,9
1889
- py2docfx-0.1.11.dev1859874.dist-info/RECORD,,
1886
+ py2docfx-0.1.11.dev1869610.dist-info/METADATA,sha256=8Ce8hBQ_337Beft-kjIhxPoBLixD304QaJTxJzRmW9Q,601
1887
+ py2docfx-0.1.11.dev1869610.dist-info/WHEEL,sha256=eOLhNAGa2EW3wWl_TU484h7q1UNgy0JXjjoqKoxAAQc,92
1888
+ py2docfx-0.1.11.dev1869610.dist-info/top_level.txt,sha256=5dH2uP81dczt_qQJ38wiZ-gzoVWasfiJALWRSjdbnYU,9
1889
+ py2docfx-0.1.11.dev1869610.dist-info/RECORD,,