Skip to content

Commit 2d02975

Browse files
authored
deterministic module order (#12)
1 parent 3060209 commit 2d02975

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# SPDX-FileCopyrightText: 2024-present deepset GmbH <[email protected]>
22
#
33
# SPDX-License-Identifier: Apache-2.0
4-
__version__ = "0.6.2"
4+
__version__ = "0.6.3"

src/haystack_pydoc_tools/loaders.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,10 @@ def load(self) -> t.Iterable[docspec.Module]:
1212
Load the modules, but include inherited methods in the classes.
1313
"""
1414
# Load all haystack modules
15+
# Sort by module name to ensure deterministic ordering across different filesystems
1516
temp_loader = PythonLoader(search_path=["../../../haystack"])
1617
temp_loader.init(Context(directory="."))
17-
all_modules = list(temp_loader.load())
18+
all_modules = sorted(temp_loader.load(), key=lambda m: m.name)
1819

1920
# Collect all classes
2021
classes = {}
@@ -24,7 +25,8 @@ def load(self) -> t.Iterable[docspec.Module]:
2425
classes[member.name] = member
2526

2627
# Load the modules specified in the search path
27-
modules = super().load()
28+
# Sort by module name to ensure deterministic ordering across different filesystems
29+
modules = sorted(super().load(), key=lambda m: m.name)
2830

2931
# Add inherited methods to the classes
3032
modules = self.include_inherited_methods(modules, classes)

0 commit comments

Comments
 (0)