py2docfx 0.1.0.dev1465108__py3-none-any.whl → 0.1.0.dev1465352__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
@@ -12,7 +12,6 @@ from py2docfx.convert_prepare.package_info import PackageInfo
12
12
 
13
13
  print("Adding yaml extension to path")
14
14
  sys.path.insert(0, os.path.join(os.path.dirname(os.path.abspath(__file__)),'docfx_yaml'))
15
- DOC_FOLDER_NAME = "docs-ref-autogen"
16
15
  os.chdir(PACKAGE_ROOT)
17
16
 
18
17
  def get_parser() -> argparse.ArgumentParser:
@@ -249,11 +248,10 @@ def prepare_out_dir(output_root: str | os.PathLike) -> os.PathLike | None:
249
248
  if len(os.listdir(output_root)) > 0:
250
249
  raise ValueError(f"""output-root-folder isn't empty,
251
250
  output-root-folder value: {output_root}""")
251
+ return output_root
252
252
  else:
253
253
  os.makedirs(output_root)
254
- output_doc_folder = os.path.join(output_root, DOC_FOLDER_NAME)
255
- os.makedirs(output_doc_folder)
256
- return output_doc_folder
254
+ return output_root
257
255
  else:
258
256
  return None
259
257
 
@@ -154,4 +154,11 @@ class PackageInfo:
154
154
  for path in self.exclude_path
155
155
  ]
156
156
  )
157
+ # exclude root package __init__.py, prevent generating azure.yml
158
+ current_parent_packages = ''
159
+ package_name_segs = [seg for seg in self.name.split('-') if seg]
160
+ for idx, package_seg in enumerate(package_name_segs):
161
+ if idx != len(package_name_segs)-1:
162
+ current_parent_packages = f'{current_parent_packages}/{package_seg}' if current_parent_packages else package_seg
163
+ exclude_path.append(os.path.join(code_location, f'{current_parent_packages}/__init__.py'))
157
164
  return exclude_path
@@ -1,4 +1,5 @@
1
1
  import os
2
+ import sys
2
3
  from sphinx.application import Sphinx
3
4
  import sphinx.ext.apidoc as apidoc
4
5
  import sphinx.cmd.build
@@ -74,8 +75,10 @@ def run_converter(rst_path, out_path, conf_path = None):
74
75
  app.build(force_all=True)
75
76
  else:
76
77
  sphinx_build_path = sphinx.cmd.build.__file__
78
+ if not sys.executable:
79
+ raise ValueError("Can't get the executable binary for the Python interpreter.")
77
80
  sphinx_param = [
78
- 'python', sphinx_build_path,
81
+ sys.executable, sphinx_build_path,
79
82
  rst_path,
80
83
  outdir,
81
84
  '-c', conf_path or rst_path,
@@ -13,27 +13,26 @@ def test_generate_document(tmp_path):
13
13
  Test the generate_document function.
14
14
  """
15
15
  # init test case
16
- source_code_path = "convert_prepare\\tests\\data\\generate_document\\"
16
+ source_code_path = "convert_prepare\\tests\\data\\generate_document"
17
17
  output_root = os.path.join(tmp_path, "output")
18
18
  shutil.copytree(source_code_path, os.path.join(tmp_path, "source\\0"))
19
19
  package = PackageInfo()
20
- package.name = "dummy_source_code"
20
+ package.name = "azure-dummy-sourcecode"
21
21
  package.exclude_path = ["test*", "example*", "sample*", "doc*"]
22
22
  package.install_type = PackageInfo.InstallType.PYPI
23
23
  package.version = None
24
24
  package.build_in_subpackage = False
25
25
  package.extra_index_url = None
26
26
  package.prefer_source_distribution = False
27
- source_folder = os.path.join(tmp_path, "source\\0")
27
+ source_folder = os.path.join(tmp_path, "source\\0\\azure-dummy-sourcecode")
28
28
  yaml_output_folder = os.path.join(tmp_path, "yaml_output")
29
29
  package.path = Source(
30
30
  source_folder=source_folder, yaml_output_folder=yaml_output_folder, package_name=package.name
31
31
  )
32
32
 
33
33
  # add dummy code to python sys path to simulate installation
34
- dummy_path = os.path.join(tmp_path, "source\\0")
35
- os.environ["PYTHONPATH"] = os.path.abspath(dummy_path)
36
- sys.path.insert(0, os.path.abspath(dummy_path))
34
+ os.environ["PYTHONPATH"] = os.path.abspath(source_folder)
35
+ sys.path.insert(0, os.path.abspath(source_folder))
37
36
 
38
37
  # add docfx_yaml to python sys path for sphinx build to import
39
38
  sys.path.insert(1, os.path.abspath("docfx_yaml"))
@@ -44,10 +43,13 @@ def test_generate_document(tmp_path):
44
43
  #assert the result
45
44
  yaml_path = os.path.join(yaml_output_folder, "_build\\docfx_yaml")
46
45
  assert os.path.exists(yaml_path)
47
- assert os.path.exists(os.path.join(yaml_path, "dummy_source_code.foo.foo.yml"))
48
- assert os.path.exists(os.path.join(yaml_path, "dummy_source_code.boo.boo.yml"))
49
- assert os.path.exists(os.path.join(yaml_path, "dummy_source_code.foo.foo.Foo.yml"))
50
- assert os.path.exists(os.path.join(yaml_path, "dummy_source_code.boo.boo.Boo.yml"))
46
+ assert os.path.exists(os.path.join(yaml_path, "azure.dummy.sourcecode.foo.foo.yml"))
47
+ assert os.path.exists(os.path.join(yaml_path, "azure.dummy.sourcecode.boo.boo.yml"))
48
+ assert os.path.exists(os.path.join(yaml_path, "azure.dummy.sourcecode.foo.foo.Foo.yml"))
49
+ assert os.path.exists(os.path.join(yaml_path, "azure.dummy.sourcecode.boo.boo.Boo.yml"))
50
+ assert os.path.exists(os.path.join(yaml_path, "azure.dummy.sourcecode.yml"))
51
+ assert not os.path.exists(os.path.join(yaml_path, "azure.dummy.yml"))
52
+ assert not os.path.exists(os.path.join(yaml_path, "azure.yml"))
51
53
  assert os.path.exists(os.path.join(yaml_path, "toc.yml"))
52
54
  assert os.path.exists(os.path.join(yaml_path, "index.yml"))
53
55
 
@@ -19,7 +19,7 @@ package_info_1 = PackageInfo.parse_from(test_dict["packages"][1], False)
19
19
 
20
20
  def test_parse_from():
21
21
  assert package_info_0.exclude_path == ["test*", "example*", "sample*", "doc*"]
22
- assert package_info_0.name == "mltable"
22
+ assert package_info_0.name == "azure-mltable-py2docfxtest"
23
23
  assert package_info_0.install_type.name == "PYPI"
24
24
 
25
25
  def test_get_combined_name_version():
@@ -28,7 +28,7 @@ def test_get_combined_name_version():
28
28
 
29
29
  def test_intall_command():
30
30
  install_command = package_info_0.get_install_command()
31
- assert install_command[0] == "mltable"
31
+ assert install_command[0] == "azure-mltable-py2docfxtest"
32
32
  assert install_command[1] == ["--upgrade"]
33
33
 
34
34
  install_command = package_info_1.get_install_command()
@@ -39,7 +39,7 @@ def test_get_exclude_command(tmp_path):
39
39
  source_folder = os.path.join(tmp_path,"source_folder")
40
40
  yaml_output_folder = os.path.join(tmp_path,"yaml_output_folder")
41
41
  package_info_0.path = Source(
42
- source_folder = source_folder, yaml_output_folder = yaml_output_folder, package_name = "dummy"
42
+ source_folder = source_folder, yaml_output_folder = yaml_output_folder, package_name = "azure-mltable-py2docfxtest"
43
43
  )
44
44
  exclude_path = package_info_0.get_exluded_command()
45
45
  expected_exclude_path = [
@@ -49,8 +49,9 @@ def test_get_exclude_command(tmp_path):
49
49
  "example*",
50
50
  "sample*",
51
51
  "doc*",
52
+ "azure/__init__.py",
53
+ "azure/mltable/__init__.py"
52
54
  ]
53
55
  def form_exclude_path(raletive_path):
54
56
  return os.path.join(source_folder, raletive_path)
55
- expected_exclude_path = map(form_exclude_path, expected_exclude_path)
56
- assert exclude_path == list(expected_exclude_path)
57
+ assert exclude_path == [form_exclude_path(path) for path in expected_exclude_path]
@@ -12,7 +12,7 @@ def extract_package_infos(iterator):
12
12
 
13
13
  def package_info_assert(package_info_list, required_package_info_list):
14
14
  package = package_info_list[0]
15
- assert package.name == "mltable"
15
+ assert package.name == "azure-mltable-py2docfxtest"
16
16
  assert package.install_type.name == "PYPI"
17
17
  assert package.exclude_path == ["test*", "example*", "sample*", "doc*"]
18
18
 
@@ -18,7 +18,7 @@ def init_paths(tmp_path):
18
18
  package_info.exclude_path = ["testcode\\exclude\\*"]
19
19
  package_info.path = Source(source_folder=destination, yaml_output_folder=rst_path, package_name="testcode")
20
20
  package_info.build_in_subpackage = False
21
-
21
+ package_info.name = 'testcode'
22
22
  return rst_path, destination
23
23
 
24
24
 
@@ -28,7 +28,6 @@ def test_run_apidoc(tmp_path):
28
28
 
29
29
  # List all files under rst_path
30
30
  rst_list = os.listdir(rst_path)
31
- assert "testcode.rst" in rst_list
32
31
  assert "testcode.fakemodule.rst" in rst_list
33
32
  assert "testcode.exclude.rst" not in rst_list
34
33
 
@@ -51,7 +50,6 @@ def test_run_converter(tmp_path):
51
50
 
52
51
  if os.path.exists(out_path):
53
52
  yaml_list = os.listdir(os.path.join(out_path, "docfx_yaml"))
54
- assert "testcode.yml" in yaml_list
55
53
  assert "testcode.fakemodule.test_code.yml" in yaml_list
56
54
  assert "testcode.fakemodule.test_code.testClass.yml" in yaml_list
57
55
  assert "toc.yml" in yaml_list
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: py2docfx
3
- Version: 0.1.0.dev1465108
3
+ Version: 0.1.0.dev1465352
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=9eGiHBw-4m_Yz8rVDSJgXbVPyxh1BD8bXhzzwIAH5bE,10970
2
+ py2docfx/__main__.py,sha256=bKG36Em2iCug0frJFXlW_Pg4YGZCVIMuluQXlvvv0qQ,10842
3
3
  py2docfx/convert_prepare/__init__.py,sha256=XxtxrP0kmW3ZBHIAoxsPDEHzcgeC0WSnole8Lk6CjKs,11
4
4
  py2docfx/convert_prepare/environment.py,sha256=AwS4c4OSwVdxlExBLVo310HrVhFMhWQ2Wh9RJPJKH1c,894
5
5
  py2docfx/convert_prepare/generate_conf.py,sha256=wqs6iyElzJarH-20_qEL9zvZvt5xfBMsGXSXPSZy6wg,2295
@@ -8,13 +8,13 @@ py2docfx/convert_prepare/get_source.py,sha256=1XOdFABdzhmSld8-w72gaOQv8_xaUX7_Vn
8
8
  py2docfx/convert_prepare/git.py,sha256=fY9urQQp5aMnlGnFrSvTTR0FPnIc-28b50W1NzIPpaw,5640
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
11
- py2docfx/convert_prepare/package_info.py,sha256=8H-v-6-ta1mx3fY2o20ra1uO1lfu2mheikbarDSpK7U,6292
11
+ py2docfx/convert_prepare/package_info.py,sha256=RCN3enfwXeU_9H8xBHLalvbhUrGxMtmlX0F9omGoPjU,6856
12
12
  py2docfx/convert_prepare/params.py,sha256=PXMB8pLtb4XbfI322avA47q0AO-TyBE6kZf7FU8I6v4,1771
13
13
  py2docfx/convert_prepare/paths.py,sha256=964RX81Qf__rzXgEATfqBNFCKTYVjLt9J7WCz2TnNdc,485
14
14
  py2docfx/convert_prepare/pip_utils.py,sha256=W8PJQQSZXUW7W_mdBxaK6KRuxMEskO1-Hw6hjRazqTY,1127
15
15
  py2docfx/convert_prepare/repo_info.py,sha256=6ASJlhBwf6vZTSENgrWCVlJjlJVhuBxzdQyWEdWAC4c,117
16
16
  py2docfx/convert_prepare/source.py,sha256=reRr3zPG_Q8zCGaJf-7JbaO0A58RCQAURiGYamx6LEM,1449
17
- py2docfx/convert_prepare/sphinx_caller.py,sha256=ZeCEtJPdondwX50Gso6nPwre5VUqtVoBTtbWJ5ID5tU,4132
17
+ py2docfx/convert_prepare/sphinx_caller.py,sha256=CQjDmZRKxTIT83Ah8LSwhdSTObCqYesTVcTRFIXtenY,4275
18
18
  py2docfx/convert_prepare/subpackage.py,sha256=mXAi_07pXvnPkSLZfykDh_7VeFxfLy74pYlzhMO8N_Q,5183
19
19
  py2docfx/convert_prepare/conf_templates/conf.py_t,sha256=VL5K6xUTIw2cb4GFjDXu5iCZFPA2Kb36KLvier78HFg,3811
20
20
  py2docfx/convert_prepare/conf_templates/master_doc.rst_t,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -23,17 +23,21 @@ py2docfx/convert_prepare/post_process/merge_toc.py,sha256=jF4u9Zb618SCSQG7u8IxCd
23
23
  py2docfx/convert_prepare/subpackage_merge/merge_root_package.py,sha256=uK96qL2asuSfo_3SZaoP8XZaUvjf5mNkr17JNbZR4Lg,1026
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
- py2docfx/convert_prepare/tests/test_generate_document.py,sha256=ylSLBuAkoZStRUYYtE6tZf3C377dXN8zlrwdpe7iRLM,2255
26
+ py2docfx/convert_prepare/tests/test_generate_document.py,sha256=BKw8pMSsygLnv6bETlA2MIVarECzfWoNo4JglxHb-T4,2480
27
27
  py2docfx/convert_prepare/tests/test_get_source.py,sha256=c22JfobgbEbWWiNzBNYpZm2yDfo5LwBioUuRwft9WZE,5858
28
28
  py2docfx/convert_prepare/tests/test_pack.py,sha256=46JWMNzknIptDVs7D3CuxcmqBr_OKMmaw1br9H7wqco,4134
29
- py2docfx/convert_prepare/tests/test_package_info.py,sha256=Id7mBpmuQb4dGZ-wEIYBeWlgLfOFKzLO8IETlUeZ0_o,2179
30
- py2docfx/convert_prepare/tests/test_params.py,sha256=Kc6JnoCbC3VvZwzPac1_46USsoZy-2YG-GrwhqFa8sI,2017
29
+ py2docfx/convert_prepare/tests/test_package_info.py,sha256=L2ax9dItnz5QNSsSjSjEcaS6UPZxiq3MwysBB1FdJxI,2262
30
+ py2docfx/convert_prepare/tests/test_params.py,sha256=p9DaGveocMBRih02KjpudJZE752neFBTLzOFbS47izQ,2036
31
31
  py2docfx/convert_prepare/tests/test_post_process_merge_toc.py,sha256=YKOcn4_lf4syGsAvJ9BqpdUUc3SLfK4TiOX1lpXJT_Y,885
32
32
  py2docfx/convert_prepare/tests/test_source.py,sha256=xkbYu-F6xNBlXWW0nu0YDYwc5zNj8h67Qd-3QpJ_B0M,1281
33
- py2docfx/convert_prepare/tests/test_sphinx_caller.py,sha256=IgZ4Pm3-SNBgGW938NqIg8XlFbnE7lJvwoCip3uBY78,2533
33
+ py2docfx/convert_prepare/tests/test_sphinx_caller.py,sha256=bhZJ7eH-YvjAPxPS4ANzmMqKo5SHExiCd1kvLWvPHtc,2484
34
34
  py2docfx/convert_prepare/tests/test_subpackage.py,sha256=n0lCcdrTE1gkmmfGE85tSBMlpOEBszZafaHXffxo3Oc,4982
35
- py2docfx/convert_prepare/tests/data/generate_document/dummy_source_code/boo/boo.py,sha256=zXze_R2qRsJsAB8Z1LY5ZGRHWDo-j3N6Tnw1yBy9gVs,97
36
- py2docfx/convert_prepare/tests/data/generate_document/dummy_source_code/foo/foo.py,sha256=i2oC5eoHl-HNW1mhLotsOwgdnVzkR0jRj4rnNjMbbCU,97
35
+ py2docfx/convert_prepare/tests/data/generate_document/azure-dummy-sourcecode/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
36
+ py2docfx/convert_prepare/tests/data/generate_document/azure-dummy-sourcecode/azure/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
37
+ py2docfx/convert_prepare/tests/data/generate_document/azure-dummy-sourcecode/azure/dummy/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
38
+ py2docfx/convert_prepare/tests/data/generate_document/azure-dummy-sourcecode/azure/dummy/sourcecode/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
39
+ py2docfx/convert_prepare/tests/data/generate_document/azure-dummy-sourcecode/azure/dummy/sourcecode/boo/boo.py,sha256=zXze_R2qRsJsAB8Z1LY5ZGRHWDo-j3N6Tnw1yBy9gVs,97
40
+ py2docfx/convert_prepare/tests/data/generate_document/azure-dummy-sourcecode/azure/dummy/sourcecode/foo/foo.py,sha256=i2oC5eoHl-HNW1mhLotsOwgdnVzkR0jRj4rnNjMbbCU,97
37
41
  py2docfx/convert_prepare/tests/data/get_source/mock-1/setup.py,sha256=6Zcy-AkzBIuiyU67AdApqj7nF6rNNTd8733ie0M4R-A,121
38
42
  py2docfx/convert_prepare/tests/data/pack/foo/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
39
43
  py2docfx/convert_prepare/tests/data/pack/foo/foo.py,sha256=nFSS0Abt9DB2jpxbrpv6UNmDiz8pgeChJoPWsFDrRQU,14
@@ -99,7 +103,7 @@ py2docfx/docfx_yaml/tests/roots/test-translator-signatures/refered_objects.py,sh
99
103
  py2docfx/docfx_yaml/tests/roots/test-writer-table/code_with_table_desc.py,sha256=J4eFvXsymgFvjnwVUY0APtUGwuxvt-AFJjTaEaQ7zMQ,574
100
104
  py2docfx/docfx_yaml/tests/roots/test-writer-table/conf.py,sha256=avcbnIOV2mlGQwhMQJZC4W6UGRBRhnq1QBxjPWlySxQ,260
101
105
  py2docfx/docfx_yaml/tests/utils/test_utils.py,sha256=N61dPDo5vuRSWlq3FIbdmalOwxGMzbKDILpRBeN58RE,3374
102
- py2docfx-0.1.0.dev1465108.dist-info/METADATA,sha256=NiXZP9dXBHBsQvE-Rx91CLPZXE8P5Y2ImGHk1EZfgO4,601
103
- py2docfx-0.1.0.dev1465108.dist-info/WHEEL,sha256=yQN5g4mg4AybRjkgi-9yy4iQEFibGQmlz78Pik5Or-A,92
104
- py2docfx-0.1.0.dev1465108.dist-info/top_level.txt,sha256=5dH2uP81dczt_qQJ38wiZ-gzoVWasfiJALWRSjdbnYU,9
105
- py2docfx-0.1.0.dev1465108.dist-info/RECORD,,
106
+ py2docfx-0.1.0.dev1465352.dist-info/METADATA,sha256=MTA4_JXloK6UX9JPQhrICkyxad_85YqSVk31S3PE-x0,601
107
+ py2docfx-0.1.0.dev1465352.dist-info/WHEEL,sha256=yQN5g4mg4AybRjkgi-9yy4iQEFibGQmlz78Pik5Or-A,92
108
+ py2docfx-0.1.0.dev1465352.dist-info/top_level.txt,sha256=5dH2uP81dczt_qQJ38wiZ-gzoVWasfiJALWRSjdbnYU,9
109
+ py2docfx-0.1.0.dev1465352.dist-info/RECORD,,