Skip to content

fix: generate references for published packages#378

Open
willkill07 wants to merge 3 commits into
NVIDIA:release/0.5from
willkill07:fix/api-reference-coverage
Open

fix: generate references for published packages#378
willkill07 wants to merge 3 commits into
NVIDIA:release/0.5from
willkill07:fix/api-reference-coverage

Conversation

@willkill07

@willkill07 willkill07 commented Jul 7, 2026

Copy link
Copy Markdown
Member

Overview

Generate complete API references for published NeMo Relay Rust crates and Python packages.

  • I confirm this contribution is my own work, or I have the right to submit it under this project's license.
  • I searched existing issues and open pull requests, and this does not duplicate existing work.

Details

  • Include the published types, native plugin, worker protocol, and worker SDK crates in Rust reference generation.
  • Generate package-scoped Python references for both nemo-relay and nemo-relay-plugin; the latter renders its public worker SDK symbols.
  • Redirect the legacy PII Python-reference URL to its package-scoped location.

Where should the reviewer start?

Start with scripts/docs/generate_python_library_reference.py and scripts/docs/generate_rust_library_reference.py, which declare the generated package and crate surfaces.

Validation: just docs; uv run pre-commit run --all-files.

Related Issues: (use one of the action keywords Closes / Fixes / Resolves / Relates to)

  • Relates to: none

Summary by CodeRabbit

  • New Features
    • Expanded the API reference generator to support multiple Python packages, with package-aware URLs, navigation, and landing pages.
    • Expanded the Rust API reference coverage to include additional NeMo Relay crates, ensuring generated docs stay in sync.
  • Bug Fixes
    • Added a documentation redirect so the legacy pii-redaction Python reference path now routes to the correct nemo-relay destination.

Signed-off-by: Will Killian <wkillian@nvidia.com>
@willkill07 willkill07 requested a review from lvojtku as a code owner July 7, 2026 18:38
@github-actions github-actions Bot added size:M PR is medium Bug issue describes bug; PR fixes bug lang:python PR changes/introduces Python code labels Jul 7, 2026
@coderabbitai

coderabbitai Bot commented Jul 7, 2026

Copy link
Copy Markdown

Review Change Stack

Walkthrough

The Python reference generator now handles multiple packages with package-scoped URLs, output paths, discovery, and generation flow. The Rust reference script expands its crate set dynamically. A docs redirect was added for the moved Python path.

Changes

Python Library Reference Multi-Package Refactor

Layer / File(s) Summary
Package data model and config
scripts/docs/generate_python_library_reference.py
Adds Package, PACKAGES, and package-aware fields on ModuleDoc.
Package-aware naming and discovery
scripts/docs/generate_python_library_reference.py
Updates module naming, collection, discovery, and __init__ parsing to use package context and optional public API sources.
Routing, output paths, and index generation
scripts/docs/generate_python_library_reference.py
Adds package slugs to URLs and MDX paths, adjusts sibling grouping, and rewrites the landing page to list packages.
Generation flow, CLI, and redirect
scripts/docs/generate_python_library_reference.py, fern/docs.yml
Iterates all configured packages from the repo root, removes --package-root, and adds the pii-redaction redirect.

Rust Crate Registry Expansion

Layer / File(s) Summary
Dynamic crate list and cargo doc invocation
scripts/docs/generate_rust_library_reference.py
Extends CRATES, derives GENERATED_BY from it, and passes -p for every configured crate.

Estimated code review effort: 3 (Moderate) | ~25 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed Conventional-commit title is valid and matches the documentation reference generation changes.
Description check ✅ Passed The description follows the template with overview, details, reviewer start, validation, and related-issues sections.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands.

@willkill07 willkill07 added this to the 0.5 milestone Jul 7, 2026
@willkill07 willkill07 self-assigned this Jul 7, 2026
Signed-off-by: Will Killian <2007799+willkill07@users.noreply.github.com>

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
scripts/docs/generate_rust_library_reference.py (1)

23-38: 🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick win

Update stale downstream crate list text in fern_cleanup.py.

CRATES now includes 8 crates, but scripts/docs/fern_cleanup.py's SUPPORT_API_REFERENCE_TEXT still hardcodes only 4: nemo-relay, nemo-relay-adaptive, nemo-relay-pii-redaction, nemo-relay-ffi. That static doc text will now be inaccurate/stale relative to the generated reference.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@scripts/docs/generate_rust_library_reference.py` around lines 23 - 38, The
downstream API reference text is stale because the hardcoded crate list no
longer matches the full CRATES tuple used by generate_rust_library_reference.py.
Update the support/reference text in fern_cleanup.py to derive or mirror the
same crate set from CRATES, so it stays aligned with the generated Rust library
reference and includes all eight crates instead of only the original four.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In `@scripts/docs/generate_rust_library_reference.py`:
- Around line 23-38: The downstream API reference text is stale because the
hardcoded crate list no longer matches the full CRATES tuple used by
generate_rust_library_reference.py. Update the support/reference text in
fern_cleanup.py to derive or mirror the same crate set from CRATES, so it stays
aligned with the generated Rust library reference and includes all eight crates
instead of only the original four.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Enterprise

Run ID: 5faafd34-c6f1-434a-b756-98b8e79a5922

📥 Commits

Reviewing files that changed from the base of the PR and between 8cfb71d and ad1d25e.

📒 Files selected for processing (3)
  • fern/docs.yml
  • scripts/docs/generate_python_library_reference.py
  • scripts/docs/generate_rust_library_reference.py
📜 Review details
⏰ Context from checks skipped due to timeout. (2)
  • GitHub Check: Check / Run
  • GitHub Check: Preview docs
🧰 Additional context used
📓 Path-based instructions (9)
{README.md,docs/**/*.{md,rst,txt},fern/**/*}

📄 CodeRabbit inference engine (.agents/skills/prepare-code-freeze/SKILL.md)

Search and update documentation source for references to the old version in README.md, docs, and fern directories, updating current-version install commands, package examples, and configuration examples to <next-version>

Files:

  • fern/docs.yml
**/*.{rs,py,js,ts,mjs,c,h,md,toml,yml,yaml,sh,json,go}

📄 CodeRabbit inference engine (AGENTS.md)

Keep SPDX headers on source files, documentation, scripts, and configuration files.

Files:

  • fern/docs.yml
  • scripts/docs/generate_rust_library_reference.py
  • scripts/docs/generate_python_library_reference.py
**/*.{rs,py,go,js,ts,jsx,tsx,md,mdx,toml,yaml,yml,html}

📄 CodeRabbit inference engine (CONTRIBUTING.md)

All source files must include an SPDX license header using the comment syntax appropriate for the file type, with SPDX-FileCopyrightText for 2026 NVIDIA CORPORATION & AFFILIATES and SPDX-License-Identifier: Apache-2.0.

Files:

  • fern/docs.yml
  • scripts/docs/generate_rust_library_reference.py
  • scripts/docs/generate_python_library_reference.py
**/*.{rs,py,go,js,ts,md,mdx,toml,yaml,yml,json}

📄 CodeRabbit inference engine (CONTRIBUTING.md)

Avoid using SONAR_IGNORE_START / SONAR_IGNORE_END except for documented false positives; keep the ignored block small, add a brief explanatory comment, and call it out in the PR description.

Files:

  • fern/docs.yml
  • scripts/docs/generate_rust_library_reference.py
  • scripts/docs/generate_python_library_reference.py
**

⚙️ CodeRabbit configuration file

**:

AGENTS.md

This file provides guidance to agents, including Claude Code and OpenAI Codex, when working in this repository.

Project Overview

NeMo Relay is a multi-language agent runtime framework for execution scopes, lifecycle events, middleware, plugins, and observability around tool and LLM calls. The core runtime is Rust. Primary supported bindings are Rust, Python, and Node.js. Go and the raw C FFI are experimental and source-first.

The shared runtime model is:

  1. Scope stacks decide where work belongs and which scope-local behavior is visible.
  2. Middleware registries decide what guardrails and intercepts run around managed calls.
  3. Plugins install reusable runtime behavior from configuration.
  4. Events record runtime behavior in ATOF form.
  5. Subscribers and exporters consume events in-process or export them to ATIF, OpenTelemetry, OpenInference, or other backends.

Repository Structure

The repository layout separates the Rust runtime, language bindings,
documentation, integrations, and agent-facing skills.

crates/
  core/       # Rust core runtime crate, published as nemo-relay
  adaptive/   # Adaptive runtime primitives and plugin components
  python/     # PyO3 native extension for the Python package
  ffi/        # Raw C ABI layer used by downstream bindings such as Go
  node/       # NAPI Node.js binding and JavaScript/TypeScript entry points
python/
  nemo_relay/  # Python wrapper package: scopes, tools, LLM, middleware, typed helpers, plugins, adaptive helpers
  tests/      # Python tests
go/
  nemo_relay/  # Experimental Go CGo binding and tests
fern/         # Fern documentation site
scripts/      # Stable wrappers and helper scripts; build/test/docs entry points live in justfile
skills/       # Published Codex/agent skills for NeMo Relay usage patterns

Prerequisites

Insta...

Files:

  • fern/docs.yml
  • scripts/docs/generate_rust_library_reference.py
  • scripts/docs/generate_python_library_reference.py
**/*.py

📄 CodeRabbit inference engine (AGENTS.md)

Follow Python naming conventions, including snake_case identifiers and wrapper module API shapes.

When changing the Python wrapper package, tests, or docs tooling, follow Ruff rules E, F, W, and I, format with Ruff formatter (line length 120, double quotes), and satisfy ty type checking.

Files:

  • scripts/docs/generate_rust_library_reference.py
  • scripts/docs/generate_python_library_reference.py
**/*.{rs,py,go,js,ts}

📄 CodeRabbit inference engine (CONTRIBUTING.md)

Use the naming conventions appropriate to each language: Rust snake_case, C FFI exports prefixed nemo_relay_, Go PascalCase, Node.js camelCase, and Python snake_case.

Files:

  • scripts/docs/generate_rust_library_reference.py
  • scripts/docs/generate_python_library_reference.py
**/*.{rs,py,go,js,ts,wasm}

📄 CodeRabbit inference engine (.agents/skills/maintain-observability/SKILL.md)

Ensure binding-native wrappers expose the same observability configuration knobs and lifecycle behavior across Rust, Python, Go, Node.js, and WebAssembly.

Files:

  • scripts/docs/generate_rust_library_reference.py
  • scripts/docs/generate_python_library_reference.py
{.github/**,.gitlab-ci.yml,.pre-commit-config.yaml,justfile,scripts/**}

⚙️ CodeRabbit configuration file

{.github/**,.gitlab-ci.yml,.pre-commit-config.yaml,justfile,scripts/**}: Review automation changes for reproducibility, pinned versions where appropriate, secret handling, and consistency with the documented validation matrix.
Pay attention to commands that need generated native artifacts, FFI libraries, or platform-specific environment variables.

Files:

  • scripts/docs/generate_rust_library_reference.py
  • scripts/docs/generate_python_library_reference.py
🪛 Ruff (0.15.20)
scripts/docs/generate_python_library_reference.py

[warning] 378-378: Use list.extend to create a transformed list

(PERF401)


[warning] 382-382: Too many branches (14 > 12)

(PLR0912)


[warning] 437-437: Avoid specifying long messages outside the exception class

(TRY003)

🔇 Additional comments (8)
scripts/docs/generate_rust_library_reference.py (1)

164-164: LGTM!

scripts/docs/generate_python_library_reference.py (6)

19-44: LGTM!


63-87: LGTM!


241-302: LGTM!


324-346: LGTM!


353-369: 🩺 Stability & Availability

Verify package-root pages don't collide on position.

Every package's top-level module is the sole member of its parent group (_package_slug(module.package),), so each package root receives position == 1. If Fern orders the package sections in the sidebar by position frontmatter, two package roots sharing 1 can produce nondeterministic ordering. Confirm ordering is stable (e.g., driven by the landing-page list order rather than position).


432-457: 🩺 Stability & Availability

No issue: the docs recipe already runs the generator from the repository root. just docs and docs-api-reference cd to $NEMO_RELAY_REPO_ROOT before invoking scripts/docs/generate_python_library_reference.py, and CI runs those recipes from source-checkout.

			> Likely an incorrect or invalid review comment.
fern/docs.yml (1)

23-24: LGTM!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bug issue describes bug; PR fixes bug lang:python PR changes/introduces Python code size:M PR is medium

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant