Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions docs_generator/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,22 @@
from docs_generator.markdown_writer import generate_markdown
import logging
import ast
import yaml

logger = logging.getLogger(__name__)


def get_brick_id_from_yaml(yaml_path):
try:
with open(yaml_path + "/brick_config.yaml", "r", encoding="utf-8") as f:
config = yaml.safe_load(f)
id = config.get("id", None)
return id.split(":")[1] if id and ":" in id else None
except Exception as e:
logger.warning("unable to get brick id from yaml: %s", e)
return None


def process_app_bricks(src_root: str, output_dir: str):
"""Generate markdown API reference and example documentation for each brick in the app_bricks directory.

Expand Down Expand Up @@ -107,6 +119,9 @@ def process_app_bricks(src_root: str, output_dir: str):
else:
all_docstrings = list(docstrings_by_name.values())
# Create output folder for this brick
brick_id = get_brick_id_from_yaml(folder_path)
if brick_id:
folder = brick_id
brick_output_dir = os.path.join(output_dir, "arduino", "app_bricks", folder)
os.makedirs(brick_output_dir, exist_ok=True)
if all_docstrings:
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[build-system]
requires = ["setuptools>=77,<81", "wheel", "setuptools_scm>=8", "docstring_parser>=0.16", "msgpack>=1.0.0", "watchdog", "requests", "Pillow", "numpy"]
requires = ["setuptools>=77,<81", "wheel", "setuptools_scm>=8", "docstring_parser>=0.16", "msgpack>=1.0.0", "watchdog", "requests", "Pillow", "numpy", "pyyaml"]
build-backend = "builder"
backend-path = ["src/arduino/app_tools"]

Expand Down