Skip to content

Commit 8fdff11

Browse files
committed
Added progress for API generation
1 parent bc70d00 commit 8fdff11

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

docs/gen_api.py

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import importlib
22
import inspect
3-
import os
3+
import sys
44
from pathlib import Path
55

66
# List of PyAML modules to include in the API reference
@@ -86,6 +86,10 @@
8686

8787

8888
def generate_selective_module(m):
89+
# Display a progress
90+
sys.stdout.write(".")
91+
sys.stdout.flush()
92+
8993
# Module introspection
9094
p = importlib.import_module(m)
9195
classes = inspect.getmembers(p, inspect.isclass)
@@ -149,9 +153,16 @@ def generate_toctree(filename: str, title: str, level: int, module: str):
149153

150154

151155
# Generate toctrees
156+
sys.stdout.write("Generating API")
157+
sys.stdout.flush()
152158
paths = generate_toctree("api.rst", "API Reference", 0, "pyaml")
153159
level = 1
154160
while len(paths) > 0:
161+
npaths = []
155162
for p in paths:
156-
paths = generate_toctree(f"api/{'pyaml.' + p}.rst", f"{p}", level, "pyaml." + p)
163+
npaths.extend(
164+
generate_toctree(f"api/{'pyaml.' + p}.rst", f"{p}", level, "pyaml." + p)
165+
)
166+
paths = npaths
157167
level += 1
168+
print("done")

0 commit comments

Comments
 (0)