Skip to content

docs(api): clarify complex Python interfaces - #12111

Merged
dagil-nvidia merged 14 commits into
dagil-nvidia/api-reference-v2from
dagil-nvidia/api-docstrings-v2
Aug 7, 2026
Merged

docs(api): clarify complex Python interfaces#12111
dagil-nvidia merged 14 commits into
dagil-nvidia/api-reference-v2from
dagil-nvidia/api-docstrings-v2

Conversation

@dagil-nvidia

@dagil-nvidia dagil-nvidia commented Jul 24, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Clarify the request-model parsing contract for dynamo_endpoint and the scaling contract for PlannerConnector.
  • Add a concise, hermetic media URL rewrite example for get_media_url.
  • Regenerate the Python API reference so the improved summaries appear in the generated browser and agent-readable fallback.

Validation

  • 124 passed in docs/fern/scripts/tests
  • gen_python_api.py --check
  • ruff check and ruff format --check passed for the touched Python source
  • The get_media_url example was verified against the in-memory fsspec backend
  • git diff --check passed for the stacked diff

Dependencies


Open in Devin Review

@dagil-nvidia
dagil-nvidia requested review from a team as code owners July 24, 2026 18:12
@github-actions github-actions Bot added docs documentation Improvements or additions to documentation planner labels Jul 24, 2026

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Open in Devin Review

@github-actions

github-actions Bot commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: dba657f771

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread lib/bindings/python/src/dynamo/runtime/__init__.py Outdated
Comment thread lib/bindings/python/src/dynamo/runtime/__init__.py Outdated
@dagil-nvidia

Copy link
Copy Markdown
Collaborator Author

Independent Docstring Audit

I had every authored docstring on this branch audited against the code it documents, by an agent that read the implementations rather than the docstrings. Two of three verified clean; one did not.

dynamo_endpoint was misleading and is now corrected (211bef6a498). The summary claimed requests are parsed into Pydantic models, stated unconditionally. Parsing is actually gated twice:

if len(args) in [1, 2] and issubclass(request_model, BaseModel):

So four documented-as-absent behaviors were real:

  • Three or more positional arguments skip parsing and forward the raw payload.
  • A payload passed by keyword is never inspected, so it also passes through unparsed.
  • An already-constructed request_model instance hits the else branch and is rejected, which is the opposite of what a reader would predict.
  • Because wrapper is itself an async generator, the ValueError surfaces on the first __anext__(), not when the decorated function is called.

The first two matter most: the failure mode is silent pass-through of an unvalidated payload, which is precisely what a reader consults this docstring to rule out. All four are now documented, and the pinned summary assertion moved with it.

PlannerConnector verified accurate, including the blocking contract against both concrete implementations.

get_media_url was accurate but weak as a teaching example: fs was constructed and never read, because the base_url branch returns before touching it. Added the base_url=None branch so the parameter is load-bearing and the documented output pins the triple-slash form DirFileSystem actually returns.

Test quality fix. test_media_url_includes_safe_rewrite_example only asserted that the source file contained the invocation line — it would pass with any wrong output. Replaced with test_storage_doctests_execute, which runs doctest against the module; fsspec added to the api-docs CI job to back it.

165 tests pass, all three generators fresh.

@dagil-nvidia

Copy link
Copy Markdown
Collaborator Author

/ok to test

@dagil-nvidia

Copy link
Copy Markdown
Collaborator Author

/ok to test 35ed55f

Picks up the Kubernetes reference source-path correction and the
crd-ref-docs <br /> collapse from #12110.

Signed-off-by: Dan Gil <dagil@nvidia.com>
@dagil-nvidia

Copy link
Copy Markdown
Collaborator Author

/ok to test 2fe6052

Signed-off-by: Dan Gil <dagil@nvidia.com>
Method carried only a summary, so everything below a docstring first
line was dropped: Connector.begin_read documents two parameters, a
return, and two raises, and the page showed none of them. Method now
carries the same parsed sections as Symbol and renders through the same
path, so the existing ParamField, Returns, Raises, and admonition
handling applies to methods without a second rendering path.

Every method renders through one shape rather than only the documented
ones. Promoting on docstring content would let coverage decide the
visual rhythm of the page.

Each method also gets a stable anchor qualified by its owning symbol.
Method names repeat across classes, so a name-derived id would collide
and resolve a deep link to whichever symbol rendered first.

Validation: 189 passed; fern check 0 errors; output byte-identical on
rerun; 587 method anchors with no duplicate id on any page.

Signed-off-by: Dan Gil <dagil@nvidia.com>
@dagil-nvidia

Copy link
Copy Markdown
Collaborator Author

/ok to test 65226a3

The method heading escaped its visible text with mdx_attribute, the
only call site in the module to do so outside a double-quoted
attribute. That escaper handles the quote character and leaves the
angle bracket and brace alone, which inverts what child position needs.
escape_mdx_prose is the one that escapes JSX-significant characters.

Generated output is byte-identical, since method names are Python
identifiers and never carried a character either escaper would touch.
The fix is about the invariant holding for the next caller.

_split_lead takes a symbol or a method, so its parameter is no longer
named symbol.

Signed-off-by: Dan Gil <dagil@nvidia.com>
@dagil-nvidia

Copy link
Copy Markdown
Collaborator Author

/ok to test 15d2a6e

@dagil-nvidia
dagil-nvidia removed request for a team August 3, 2026 03:50
…nto m12111

Signed-off-by: Dan Gil <dagil@nvidia.com>

# Conflicts:
#	docs/fern/pages/reference/api/python/frontend.mdx
@dagil-nvidia

Copy link
Copy Markdown
Collaborator Author

/ok to test a12804d

…nto u12111

Signed-off-by: Dan Gil <dagil@nvidia.com>

# Conflicts:
#	docs/fern/pages/reference/api/python/_core.mdx
#	docs/fern/pages/reference/api/python/frontend.mdx
#	docs/fern/pages/reference/api/python/llm.mdx
#	docs/fern/pages/reference/api/python/mocker.mdx
#	docs/fern/pages/reference/api/python/planner.mdx
#	docs/fern/pages/reference/api/python/runtime.mdx
@dagil-nvidia

Copy link
Copy Markdown
Collaborator Author

/ok to test 18839be

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

Labels

actions docs documentation Improvements or additions to documentation planner size/XXL

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant