clear-skies-doc-builder 2.0.9__py3-none-any.whl → 2.0.11__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: clear-skies-doc-builder
3
- Version: 2.0.9
3
+ Version: 2.0.11
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
@@ -1,5 +1,5 @@
1
1
  clearskies_doc_builder/__init__.py,sha256=AFQzZ9HwIxPyLpsUhkSDRh_6hm8-5H4RpAelTShCDTc,1300
2
- clearskies_doc_builder/build_callable.py,sha256=DjPGTXD9mwwhCzTFSVcEPOHAU4Nn6yWjPf8ZJQBn-WQ,3758
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
@@ -8,7 +8,7 @@ clearskies_doc_builder/backends/module_backend.py,sha256=hHJXt00TJIF3-69p_kjdAZu
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=tPtXcqmI-XG-yH82WdmK4MLBL73RMiAHL_0VOJZaIKw,4920
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.9.dist-info/METADATA,sha256=NySZL3qttV4RKPaSOZQdp4r1ysct3CPa_8NT-O_3IFY,10626
36
- clear_skies_doc_builder-2.0.9.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
37
- clear_skies_doc_builder-2.0.9.dist-info/licenses/LICENSE,sha256=pgH32-xrgpIDf6WIBUA1X19o-sIHIXgToCxo-tBWDdw,1071
38
- clear_skies_doc_builder-2.0.9.dist-info/RECORD,,
35
+ clear_skies_doc_builder-2.0.11.dist-info/METADATA,sha256=NbuacUKaE_mVxC_GFBnNVii8jFJGZNfODFpCff6QOGk,10627
36
+ clear_skies_doc_builder-2.0.11.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
37
+ clear_skies_doc_builder-2.0.11.dist-info/licenses/LICENSE,sha256=pgH32-xrgpIDf6WIBUA1X19o-sIHIXgToCxo-tBWDdw,1071
38
+ clear_skies_doc_builder-2.0.11.dist-info/RECORD,,
@@ -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 _compute_nav_orders(tree: list[dict[str, Any]]) -> dict[int, int]:
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 in the tree based on sorting rules.
55
+ Compute nav_order for each entry and count children per parent.
54
56
 
55
- Returns a dict mapping original tree index to computed nav_order.
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
- return nav_orders
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 = _compute_nav_orders(config["tree"])
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
- branch,
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 = 0
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}")