Skip to content

fix(docs): mock rcl_interfaces to fix empty Node API page#1682

Draft
mjcarroll wants to merge 1 commit into
rollingfrom
fix/node-api-docs-empty
Draft

fix(docs): mock rcl_interfaces to fix empty Node API page#1682
mjcarroll wants to merge 1 commit into
rollingfrom
fix/node-api-docs-empty

Conversation

@mjcarroll

@mjcarroll mjcarroll commented Jun 22, 2026

Copy link
Copy Markdown
Member

Description

Fixes the empty Node API docs page reported in #1681.

rclpy.node imports rcl_interfaces.msg at module level, which transitively requires rosidl_pycommon.interface_base_classes — unavailable in the Sphinx docs build environment. The import silently fails and autodoc renders a blank page. Adding autodoc_mock_imports = ['rcl_interfaces'] to conf.py unblocks the import without affecting the build.

All other modules (publisher, client, etc.) happen to avoid this because they don't import rcl_interfaces directly.

Testing

# Clone and check out this branch
git clone https://github.com/ros2/rclpy.git && cd rclpy

# Install deps (rclpy must be importable — source your ROS install first)
source /opt/ros/rolling/setup.bash
pip install sphinx sphinx-rtd-theme

# Build docs
cd rclpy/docs
sphinx-build -b html source /tmp/rclpy-docs

# Open the Node page and confirm it has content (not just a heading)
xdg-open /tmp/rclpy-docs/api/node.html
# or: grep -c 'py class\|py method' /tmp/rclpy-docs/api/node.html

Before this fix: api/node.html contains only <h1>Node</h1> — no class or method entries.
After this fix: Node class with all ~124 methods is documented.

To reproduce the failure, revert conf.py and rebuild.

Did you use Generative AI?

Yes — Antigravity (Gemini CLI / Claude Sonnet 4.6) was used to diagnose the root cause and author the fix.

@mergify

mergify Bot commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

Tick the box to add this pull request to the merge queue (same as @mergifyio queue).

  • Queue this pull request

@mjcarroll mjcarroll marked this pull request as draft June 22, 2026 20:33
Fixes: #1681

Assisted-by: Gemini CLI:Claude Sonnet 4.6 (Thinking) [gh, read_url_content, grep_search, run_command]
Signed-off-by: Michael Carroll <mjcarroll.oss@gmail.com>
@mjcarroll mjcarroll force-pushed the fix/node-api-docs-empty branch from 5ba50a1 to 4246b9b Compare June 22, 2026 20:39
@mjcarroll mjcarroll requested a review from ahcorde June 22, 2026 20:40
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.

1 participant