py2docfx 0.1.4.dev1689521__py3-none-any.whl → 0.1.4.dev1696736__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/docfx_yaml/build_finished.py +9 -3
- py2docfx/docfx_yaml/tests/test_build_finished.py +26 -1
- {py2docfx-0.1.4.dev1689521.dist-info → py2docfx-0.1.4.dev1696736.dist-info}/METADATA +1 -1
- {py2docfx-0.1.4.dev1689521.dist-info → py2docfx-0.1.4.dev1696736.dist-info}/RECORD +6 -6
- {py2docfx-0.1.4.dev1689521.dist-info → py2docfx-0.1.4.dev1696736.dist-info}/WHEEL +0 -0
- {py2docfx-0.1.4.dev1689521.dist-info → py2docfx-0.1.4.dev1696736.dist-info}/top_level.txt +0 -0
@@ -28,11 +28,11 @@ def string_representer(dumper, data):
|
|
28
28
|
style="'" if (scientific_notation_regex.match(data)) else None)
|
29
29
|
yml.add_representer(str, string_representer)
|
30
30
|
|
31
|
-
def
|
31
|
+
def insert_node_to_toc_tree_return_is_root_package(toc_yaml, uid, project_name, toc_node_map):
|
32
32
|
# Build nested TOC
|
33
33
|
parent_level = uid
|
34
34
|
cur_node = None
|
35
|
-
|
35
|
+
is_root = False
|
36
36
|
# Try all ancestors azure.core.class1 -> azure.core -> azure
|
37
37
|
while parent_level.count('.') >= 1:
|
38
38
|
parent_level = '.'.join(parent_level.split('.')[:-1])
|
@@ -53,9 +53,11 @@ def insert_node_to_toc_tree(toc_yaml, uid, project_name, toc_node_map):
|
|
53
53
|
# if uid doesn't contain '.', the name needn't to simplify
|
54
54
|
cur_node = {'name': uid}
|
55
55
|
toc_yaml.append(cur_node)
|
56
|
+
is_root = True
|
56
57
|
|
57
58
|
# insert to uid-toc map
|
58
59
|
toc_node_map[uid] = cur_node
|
60
|
+
return is_root
|
59
61
|
|
60
62
|
def merge_params(arg_params, doc_params):
|
61
63
|
merged_params = deepcopy(doc_params)
|
@@ -239,6 +241,7 @@ def build_finished(app, exception):
|
|
239
241
|
|
240
242
|
references = []
|
241
243
|
# Merge module data with class data
|
244
|
+
package_obj = None
|
242
245
|
for obj in yaml_data:
|
243
246
|
obj = filter_out_self_from_args(obj)
|
244
247
|
|
@@ -257,11 +260,14 @@ def build_finished(app, exception):
|
|
257
260
|
# To distinguish distribution package and import package
|
258
261
|
if obj.get('type', '') == 'package' and obj.get('kind', '') != 'distribution':
|
259
262
|
obj['kind'] = 'import'
|
263
|
+
package_obj = obj
|
260
264
|
|
261
265
|
if (obj['type'] == 'class' and obj['inheritance']):
|
262
266
|
convert_class_to_enum_if_needed(obj)
|
263
267
|
|
264
|
-
|
268
|
+
is_root = insert_node_to_toc_tree_return_is_root_package(toc_yaml, uid, project_name, toc_node_map)
|
269
|
+
if is_root and package_obj is not None:
|
270
|
+
package_obj['kind'] = 'rootImport' # API Browser only list root packages for ApiList feature
|
265
271
|
|
266
272
|
for data_set in (app.env.docfx_yaml_packages,
|
267
273
|
app.env.docfx_yaml_modules,
|
@@ -178,5 +178,30 @@ def test_build_finished_check_toc(tmp_path, app):
|
|
178
178
|
assert 'Blueprint' == toc[0]['items'][3]['name']
|
179
179
|
assert 'azure.durable_functions.Blueprint' == toc[0]['items'][3]['uid']
|
180
180
|
|
181
|
+
@pytest.mark.sphinx('yaml', testroot='build-finished')
|
182
|
+
def test_build_finished_check_root_package_type(tmp_path, app):
|
183
|
+
app.builder.outdir = tmp_path
|
184
|
+
app.config.project = 'azure-durable-functions'
|
185
|
+
app.env.docfx_yaml_packages = {
|
186
|
+
'azure.durable_functions':[{'uid':'azure.durable_functions','type':'package'}],
|
187
|
+
'azure.durable_functions.models':[{'uid':'azure.durable_functions.models','type':'package'}],
|
188
|
+
}
|
189
|
+
app.env.docfx_yaml_modules = {
|
190
|
+
'azure.durable_functions.constants':[{'uid':'azure.durable_functions.constants','type':'module'}],
|
191
|
+
'azure.durable_functions.models.DurableEntityContext':[{'uid':'azure.durable_functions.models.DurableEntityContext','type':'module'}],
|
192
|
+
}
|
193
|
+
app.env.docfx_yaml_classes = {'azure.durable_functions.Blueprint':[{'uid':'azure.durable_functions.Blueprint','type':'class', 'inheritance':[]}]}
|
181
194
|
|
182
|
-
|
195
|
+
# Act
|
196
|
+
build_finished(app, None)
|
197
|
+
|
198
|
+
# Assert after build_finished
|
199
|
+
rootPackageYaml = None
|
200
|
+
with open(os.path.join(tmp_path, API_ROOT, 'azure.durable_functions.yml'), 'r', encoding='utf-8') as file:
|
201
|
+
rootPackageYaml = yaml.safe_load(file)
|
202
|
+
assert 'rootImport' == rootPackageYaml['type']
|
203
|
+
|
204
|
+
subPackageYaml = None
|
205
|
+
with open(os.path.join(tmp_path, API_ROOT, 'azure.durable_functions.models.yml'), 'r', encoding='utf-8') as file:
|
206
|
+
subPackageYaml = yaml.safe_load(file)
|
207
|
+
assert 'import' == subPackageYaml['type']
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: py2docfx
|
3
|
-
Version: 0.1.4.
|
3
|
+
Version: 0.1.4.dev1696736
|
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
|
@@ -53,7 +53,7 @@ py2docfx/convert_prepare/tests/data/subpackage/azure-mgmt-containerservice/azure
|
|
53
53
|
py2docfx/convert_prepare/tests/data/subpackage/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_03_31/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
54
54
|
py2docfx/convert_prepare/tests/data/subpackage/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_03_31/models.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
55
55
|
py2docfx/docfx_yaml/__init__.py,sha256=KCEizAXv-SXtrYhvFfLHdBWDhz51AA9uagaeTL-Itpo,100
|
56
|
-
py2docfx/docfx_yaml/build_finished.py,sha256=
|
56
|
+
py2docfx/docfx_yaml/build_finished.py,sha256=i7oPa_zdWplwiVUNUqwAArM7gTskkWeeflv03N_i6Bg,13468
|
57
57
|
py2docfx/docfx_yaml/build_init.py,sha256=lAw-fnBVQbySfZ7Sut_NpFQUjnqLOmnGQrTBBH2RXcg,1860
|
58
58
|
py2docfx/docfx_yaml/common.py,sha256=UN1MUmjUoN1QSFDR1Cm_bfRuHr6FQiOe5VQV6s8xzjc,6841
|
59
59
|
py2docfx/docfx_yaml/convert_class.py,sha256=boKDaxnXbnLxja62UFXi3eChGDB_WBW6ouUUJgOhdpE,2098
|
@@ -74,7 +74,7 @@ py2docfx/docfx_yaml/writer.py,sha256=BQ02TshJM7O53_n07i_DJ-WtI7PYNyBJ2OLzivq4iiA
|
|
74
74
|
py2docfx/docfx_yaml/yaml_builder.py,sha256=qSxXVS4iFCc1ZdL5QzLrv8hy3LHIQCrhO4WcTp01vag,2575
|
75
75
|
py2docfx/docfx_yaml/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
76
76
|
py2docfx/docfx_yaml/tests/conftest.py,sha256=CykkZxaDZ-3a1EIQdGBieSmHL9FdyTE2xTJZe9QgKcg,1214
|
77
|
-
py2docfx/docfx_yaml/tests/test_build_finished.py,sha256=
|
77
|
+
py2docfx/docfx_yaml/tests/test_build_finished.py,sha256=PSyWuY_XWmNeSjQl4kBwHUWpEhQHuEXQCZPWtFZ7vb4,8433
|
78
78
|
py2docfx/docfx_yaml/tests/test_method_arguments.py,sha256=Cvj9aoADtacKciVN8nempXW-KQL8nujSa9GNVuk6l_8,1578
|
79
79
|
py2docfx/docfx_yaml/tests/test_numpy_syntax.py,sha256=ssb3J_-Jzjybhh4eycCA_LkXbGflyZyIUAiTjlEYLiw,863
|
80
80
|
py2docfx/docfx_yaml/tests/test_translator_attributes.py,sha256=qZCsQGffq31k3UzpXkJpycplOXIq9gi2SxY6vu0DTfw,5224
|
@@ -123,7 +123,7 @@ py2docfx/docfx_yaml/tests/roots/test-writer-uri/conf.py,sha256=avcbnIOV2mlGQwhMQ
|
|
123
123
|
py2docfx/docfx_yaml/tests/roots/test-writer-versions/code_with_version_directives.py,sha256=UuizbrJPaG_PcaH18BvbI9KQevOaLd4SslpnzMSqcrE,1030
|
124
124
|
py2docfx/docfx_yaml/tests/roots/test-writer-versions/conf.py,sha256=SCEKrm9VigArfdgf-GAieJD-40d0ctT6urmGIjFOZLM,404
|
125
125
|
py2docfx/docfx_yaml/tests/utils/test_utils.py,sha256=d0OYSUQ6NyoZx5mlLdNGGNhiNmmQhjVT4hQ6jY3VE_M,3383
|
126
|
-
py2docfx-0.1.4.
|
127
|
-
py2docfx-0.1.4.
|
128
|
-
py2docfx-0.1.4.
|
129
|
-
py2docfx-0.1.4.
|
126
|
+
py2docfx-0.1.4.dev1696736.dist-info/METADATA,sha256=2zzC4BCfZ37vD0QjsbCh-3_7-gqYFUHdnYGMiDo1lQU,601
|
127
|
+
py2docfx-0.1.4.dev1696736.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
|
128
|
+
py2docfx-0.1.4.dev1696736.dist-info/top_level.txt,sha256=5dH2uP81dczt_qQJ38wiZ-gzoVWasfiJALWRSjdbnYU,9
|
129
|
+
py2docfx-0.1.4.dev1696736.dist-info/RECORD,,
|
File without changes
|
File without changes
|