Skip to content

DOC generate API pages for empty modules and render aliases#1469

Open
biefan wants to merge 1 commit intoAzure:mainfrom
biefan:docs/api-gen-include-empty-modules-653
Open

DOC generate API pages for empty modules and render aliases#1469
biefan wants to merge 1 commit intoAzure:mainfrom
biefan:docs/api-gen-include-empty-modules-653

Conversation

@biefan
Copy link

@biefan biefan commented Mar 14, 2026

Summary

This updates build_scripts/gen_api_md.py to make generated API docs more complete and avoid broken links.

What changed

  • Render module aliases under a new ## Aliases section.
  • Always generate per-module markdown pages, including modules with no public members.
  • Add a placeholder line for empty modules: No public API members were detected for this module.
  • Improve index preview by including classes, functions, and aliases (instead of classes only).

Why

  • Fixes missing module pages that caused broken links from doc/api/index.md.
  • Improves readability of generated docs for modules that mostly expose aliases.

Validation

  • uv run --with ruff ruff check build_scripts/gen_api_md.py
  • missing_links 0 check for links in doc/api/index.md

Fixes #653

Signed-off-by: biefan <70761325+biefan@users.noreply.github.com>
@biefan
Copy link
Author

biefan commented Mar 14, 2026

@microsoft-github-policy-service agree

Copy link
Contributor

@romanlutz romanlutz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! Just want to try it out locally before merging

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the documentation build script that generates MyST API reference markdown from griffe JSON so that re-exported names (aliases) are represented and modules with no detected public members are handled more explicitly.

Changes:

  • Add alias rendering and an “Aliases” section to per-module API pages.
  • Generate per-module pages for all collected modules and show an explicit “no public API members” message when empty.
  • Improve index previews to include functions and aliases (not just classes), with a fallback message for empty modules.

You can also share your feedback on Copilot code review. Take the survey.

Comment on lines 260 to 270
members = data.get("members", [])
member_count = len(members)
slug = mod_name.replace(".", "_")
classes = [m["name"] for m in members if m.get("kind") == "class"][:8]
preview = ", ".join(f"`{c}`" for c in classes)
if len(classes) < member_count:

classes = [f"`{m['name']}`" for m in members if m.get("kind") == "class"]
functions = [f"`{m['name']}()`" for m in members if m.get("kind") == "function"]
aliases = [f"`{m['name']}`" for m in members if m.get("kind") == "alias"]
preview_items = (classes + functions + aliases)[:8]
preview = ", ".join(preview_items)
if member_count > len(preview_items):
preview += f" ... ({member_count} total)"
Comment on lines +253 to +254
md_path.write_text(content, encoding="utf-8")
print(f"Written {md_path} ({len(members)} members)")
@romanlutz romanlutz changed the title docs: generate API pages for empty modules and render aliases DOC generate API pages for empty modules and render aliases Mar 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

DOC API reference has missing or malformed content

3 participants