clear-skies-doc-builder 2.0.10__py3-none-any.whl → 2.0.12__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.
- {clear_skies_doc_builder-2.0.10.dist-info → clear_skies_doc_builder-2.0.12.dist-info}/METADATA +1 -1
- {clear_skies_doc_builder-2.0.10.dist-info → clear_skies_doc_builder-2.0.12.dist-info}/RECORD +7 -7
- clearskies_doc_builder/backends/module_backend.py +9 -3
- clearskies_doc_builder/build_callable.py +28 -7
- clearskies_doc_builder/builders/module.py +6 -1
- {clear_skies_doc_builder-2.0.10.dist-info → clear_skies_doc_builder-2.0.12.dist-info}/WHEEL +0 -0
- {clear_skies_doc_builder-2.0.10.dist-info → clear_skies_doc_builder-2.0.12.dist-info}/licenses/LICENSE +0 -0
{clear_skies_doc_builder-2.0.10.dist-info → clear_skies_doc_builder-2.0.12.dist-info}/METADATA
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: clear-skies-doc-builder
|
|
3
|
-
Version: 2.0.
|
|
3
|
+
Version: 2.0.12
|
|
4
4
|
Summary: The docbuilder for all 'official' clearskies plugins (as well as the main clearskies docs)
|
|
5
5
|
Project-URL: repository, https://github.com/clearskies-py/docs
|
|
6
6
|
Project-URL: issues, https://github.com/clearskies-py/docs/issues
|
{clear_skies_doc_builder-2.0.10.dist-info → clear_skies_doc_builder-2.0.12.dist-info}/RECORD
RENAMED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
clearskies_doc_builder/__init__.py,sha256=AFQzZ9HwIxPyLpsUhkSDRh_6hm8-5H4RpAelTShCDTc,1300
|
|
2
|
-
clearskies_doc_builder/build_callable.py,sha256=
|
|
2
|
+
clearskies_doc_builder/build_callable.py,sha256=UYbWACdDpfG8sLGg0Dhu-KEhsitSXdYqn5je6wr6E6o,4676
|
|
3
3
|
clearskies_doc_builder/prepare_doc_space.py,sha256=BXIH-CQJ1ZY6sf2bj1Fjhrglihls6AnqMNdjirDqSFM,1019
|
|
4
4
|
clearskies_doc_builder/backends/__init__.py,sha256=q5jpy8xfZ4SbGQ1T30q4mp4h346HaMivvmNqtgTMQxw,303
|
|
5
5
|
clearskies_doc_builder/backends/attribute_backend.py,sha256=2nivmJpedPsoQibf9NlIT-Wfvg0PbfHKoT06xKkt0O0,3634
|
|
6
6
|
clearskies_doc_builder/backends/class_backend.py,sha256=JIKRYAVFxYEOHV7tG9RBrfuo1SN8Uw4KKaMz5YzlMHo,4112
|
|
7
|
-
clearskies_doc_builder/backends/module_backend.py,sha256=
|
|
7
|
+
clearskies_doc_builder/backends/module_backend.py,sha256=haOJ1RV9I0GnprFvPKqVM7aqqChPQrf6DnFwinwjINU,6199
|
|
8
8
|
clearskies_doc_builder/backends/python.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
9
9
|
clearskies_doc_builder/builders/__init__.py,sha256=ndAK4-imR9vhl7CS425ASYi46FN5-eR9Dr6bKxCn5lA,292
|
|
10
10
|
clearskies_doc_builder/builders/builder.py,sha256=2QZDscwOZ4vfx4NzFU4AyKgAPuKVU0jsYBcT42CZgzY,7957
|
|
11
|
-
clearskies_doc_builder/builders/module.py,sha256=
|
|
11
|
+
clearskies_doc_builder/builders/module.py,sha256=KCAVYO6RbYqbn_6uIIQqG4LLLpRYIMg20K2EmZYy2x4,5349
|
|
12
12
|
clearskies_doc_builder/builders/single_class.py,sha256=-3b9VC_bxB9r5EHcdUCA1VFWxY0r_N72td0ZHLydy3Y,4846
|
|
13
13
|
clearskies_doc_builder/builders/single_class_to_section.py,sha256=uEyawxW4cIdavBVnK2TBiIqywUgj3IxmUcS16E81cgI,1754
|
|
14
14
|
clearskies_doc_builder/columns/__init__.py,sha256=--cof8kFPwlZncM3MBQYkvfq8TejEeI0B99vTlEVCkU,566
|
|
@@ -32,7 +32,7 @@ clearskies_doc_builder/models/method_reference.py,sha256=U4YOpRLotyEp6G0Y5OHORdo
|
|
|
32
32
|
clearskies_doc_builder/models/module.py,sha256=5JUF2LUKTpVsYlviT7T_qgLdMApGtS4qIUloCEzJ-uo,573
|
|
33
33
|
clearskies_doc_builder/models/module_reference.py,sha256=-zHnrkP6JR7j2XFuW94uGlPENI3ZshxgBu4yY9ayzSg,177
|
|
34
34
|
clearskies_doc_builder/models/property.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
35
|
-
clear_skies_doc_builder-2.0.
|
|
36
|
-
clear_skies_doc_builder-2.0.
|
|
37
|
-
clear_skies_doc_builder-2.0.
|
|
38
|
-
clear_skies_doc_builder-2.0.
|
|
35
|
+
clear_skies_doc_builder-2.0.12.dist-info/METADATA,sha256=BrxKcMZZ5mBoA4zKjfsKxivIeOUrmix1xLpI7tuy0pU,10627
|
|
36
|
+
clear_skies_doc_builder-2.0.12.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
|
|
37
|
+
clear_skies_doc_builder-2.0.12.dist-info/licenses/LICENSE,sha256=pgH32-xrgpIDf6WIBUA1X19o-sIHIXgToCxo-tBWDdw,1071
|
|
38
|
+
clear_skies_doc_builder-2.0.12.dist-info/RECORD,,
|
|
@@ -9,6 +9,7 @@ import clearskies.model
|
|
|
9
9
|
import clearskies.query
|
|
10
10
|
from clearskies.autodoc.schema import Integer as AutoDocInteger
|
|
11
11
|
from clearskies.autodoc.schema import Schema as AutoDocSchema
|
|
12
|
+
from clearskies.configs import Boolean
|
|
12
13
|
from clearskies.query.result import CountQueryResult, RecordQueryResult, RecordsQueryResult, SuccessQueryResult
|
|
13
14
|
|
|
14
15
|
|
|
@@ -20,17 +21,22 @@ class ModuleBackend(clearskies.backends.Backend):
|
|
|
20
21
|
"module": lambda module, value: id(module) == id(value),
|
|
21
22
|
}
|
|
22
23
|
|
|
24
|
+
can_create = Boolean(default=False)
|
|
25
|
+
can_update = Boolean(default=False)
|
|
26
|
+
can_delete = Boolean(default=False)
|
|
27
|
+
can_query = Boolean(default=True)
|
|
28
|
+
|
|
23
29
|
def update(self, id: int | str, data: dict[str, Any], model: clearskies.model.Model) -> RecordQueryResult:
|
|
24
30
|
"""Update the record with the given id with the information from the data dictionary."""
|
|
25
|
-
raise
|
|
31
|
+
raise NotImplementedError(f"The {self.__class__.__name__} only supports read operations: update is not allowed")
|
|
26
32
|
|
|
27
33
|
def create(self, data: dict[str, Any], model: clearskies.model.Model) -> RecordQueryResult:
|
|
28
34
|
"""Create a record with the information from the data dictionary."""
|
|
29
|
-
raise
|
|
35
|
+
raise NotImplementedError(f"The {self.__class__.__name__} only supports read operations: create is not allowed")
|
|
30
36
|
|
|
31
37
|
def delete(self, id: int | str, model: clearskies.model.Model) -> SuccessQueryResult:
|
|
32
38
|
"""Delete the record with the given id."""
|
|
33
|
-
raise
|
|
39
|
+
raise NotImplementedError(f"The {self.__class__.__name__} only supports read operations: delete is not allowed")
|
|
34
40
|
|
|
35
41
|
def count(self, query: clearskies.query.Query) -> CountQueryResult:
|
|
36
42
|
"""Return the number of records which match the given query configuration."""
|
|
@@ -48,11 +48,15 @@ def _sort_key_for_entry(entry: dict[str, Any]) -> tuple[int, str]:
|
|
|
48
48
|
return (type_priority, title)
|
|
49
49
|
|
|
50
50
|
|
|
51
|
-
def
|
|
51
|
+
def _compute_nav_orders_and_child_counts(
|
|
52
|
+
tree: list[dict[str, Any]],
|
|
53
|
+
) -> tuple[dict[int, int], dict[str, int]]:
|
|
52
54
|
"""
|
|
53
|
-
Compute nav_order for each entry
|
|
55
|
+
Compute nav_order for each entry and count children per parent.
|
|
54
56
|
|
|
55
|
-
Returns
|
|
57
|
+
Returns:
|
|
58
|
+
- nav_orders: dict mapping original tree index to computed nav_order
|
|
59
|
+
- child_counts: dict mapping parent title to number of child entries
|
|
56
60
|
|
|
57
61
|
For entries with the same parent:
|
|
58
62
|
- Groups by entry_type (submodules first, then classes)
|
|
@@ -60,6 +64,9 @@ def _compute_nav_orders(tree: list[dict[str, Any]]) -> dict[int, int]:
|
|
|
60
64
|
- Assigns sequential nav_order values
|
|
61
65
|
|
|
62
66
|
Top-level entries maintain their original order (index + 2).
|
|
67
|
+
|
|
68
|
+
The child_counts is used by Module builders to offset their internal class
|
|
69
|
+
nav_orders so that child entries (submodules) appear first in navigation.
|
|
63
70
|
"""
|
|
64
71
|
# Group entries by their parent
|
|
65
72
|
parent_groups: dict[str | None, list[tuple[int, dict[str, Any]]]] = {}
|
|
@@ -72,6 +79,7 @@ def _compute_nav_orders(tree: list[dict[str, Any]]) -> dict[int, int]:
|
|
|
72
79
|
|
|
73
80
|
# Compute nav_order for each entry
|
|
74
81
|
nav_orders: dict[int, int] = {}
|
|
82
|
+
child_counts: dict[str, int] = {}
|
|
75
83
|
|
|
76
84
|
for parent, entries in parent_groups.items():
|
|
77
85
|
if parent is None:
|
|
@@ -84,21 +92,34 @@ def _compute_nav_orders(tree: list[dict[str, Any]]) -> dict[int, int]:
|
|
|
84
92
|
for nav_order, (original_index, entry) in enumerate(sorted_entries, start=1):
|
|
85
93
|
nav_orders[original_index] = nav_order
|
|
86
94
|
|
|
87
|
-
|
|
95
|
+
# Count children for each parent (by title)
|
|
96
|
+
for entry in tree:
|
|
97
|
+
parent = entry.get("parent")
|
|
98
|
+
if parent:
|
|
99
|
+
child_counts[parent] = child_counts.get(parent, 0) + 1
|
|
100
|
+
|
|
101
|
+
return nav_orders, child_counts
|
|
88
102
|
|
|
89
103
|
|
|
90
104
|
def build_callable(modules: models.Module, classes: models.Class, config: dict[str, Any], project_root: str):
|
|
91
105
|
doc_root = prepare_doc_space(project_root)
|
|
92
106
|
|
|
93
|
-
# Pre-compute nav_orders based on sorting rules
|
|
94
|
-
nav_orders =
|
|
107
|
+
# Pre-compute nav_orders and child counts based on sorting rules
|
|
108
|
+
nav_orders, child_counts = _compute_nav_orders_and_child_counts(config["tree"])
|
|
95
109
|
|
|
96
110
|
for index, branch in enumerate(config["tree"]):
|
|
97
111
|
nav_order = nav_orders[index]
|
|
98
112
|
|
|
113
|
+
# Add child_entry_count to branch so Module builder can offset its class nav_orders
|
|
114
|
+
# This ensures child entries (submodules) appear first in navigation
|
|
115
|
+
branch_with_child_count = {
|
|
116
|
+
**branch,
|
|
117
|
+
"child_entry_count": child_counts.get(branch["title"], 0),
|
|
118
|
+
}
|
|
119
|
+
|
|
99
120
|
builder_class = classes.find("import_path=" + branch["builder"]).type
|
|
100
121
|
builder = builder_class(
|
|
101
|
-
|
|
122
|
+
branch_with_child_count,
|
|
102
123
|
modules,
|
|
103
124
|
classes,
|
|
104
125
|
doc_root,
|
|
@@ -13,6 +13,9 @@ class Module(Builder):
|
|
|
13
13
|
self.args_to_additional_attributes_map = branch.get("args_to_additional_attributes_map", {})
|
|
14
14
|
self.parent = branch.get("parent", False)
|
|
15
15
|
self.grand_parent = branch.get("grand_parent", False)
|
|
16
|
+
# Number of child entries (submodules) under this module in the config tree
|
|
17
|
+
# Used to offset class nav_orders so child entries appear first in navigation
|
|
18
|
+
self.child_entry_count = branch.get("child_entry_count", 0)
|
|
16
19
|
|
|
17
20
|
def build(self):
|
|
18
21
|
title_snake_case = clearskies.functional.string.title_case_to_snake_case(self.title.replace(" ", "")).replace(
|
|
@@ -51,7 +54,9 @@ class Module(Builder):
|
|
|
51
54
|
|
|
52
55
|
default_args = self.default_args()
|
|
53
56
|
|
|
54
|
-
nav_order
|
|
57
|
+
# Start nav_order after any child entries (submodules) so they appear first
|
|
58
|
+
# Child entries get nav_order 1, 2, 3... and classes get nav_order after that
|
|
59
|
+
nav_order = self.child_entry_count
|
|
55
60
|
for class_name in self.class_list:
|
|
56
61
|
nav_order += 1
|
|
57
62
|
source_class = self.classes.find(f"import_path={class_name}")
|
|
File without changes
|
|
File without changes
|