Skip to content

[data][llm] Convert ray.data.llm docstring examples to render-only doctests - #67208

Merged
dstrodtman merged 1 commit into
masterfrom
doc-1855-data-llm-doctests
Oct 21, 2026
Merged

dstrodtman merged 1 commit into
masterfrom
doc-1855-data-llm-doctests

Conversation

@dstrodtman

Copy link
Copy Markdown
Contributor

Description

Converts the seven .. testcode:: examples in python/ray/data/llm.py to >>> doctests. They're in HttpRequestProcessorConfig, vLLMEngineProcessorConfig, SGLangEngineProcessorConfig, ServeDeploymentProcessorConfig, and build_processor, which holds three of them. The change touches only docstrings.

The examples stay render-only. Every block was :skipif: True, because running them needs GPUs and model downloads, an OpenAI API key, or a running Serve deployment. Each docstring now carries one # doctest: +SKIP_EXAMPLE flag on its first line, which skips the whole docstring in both the //python/ray/data:doctest target and the docstring-only examples step. Sphinx strips the flag from the rendered page. The code itself is unchanged apart from the >>> and ... prompts and the removal of the blank lines a doctest can't contain.

This is separate from the other Ray Data docstring conversions, such as #67202 and #67207, because CODEOWNERS assigns python/ray/data/llm.py to @ray-project/ray-llm.

Related issues

Related to #67080, #67202, and #67207.

Additional information

Not a duplicate. I searched open PRs that mention llm.py or converting ray.data.llm docstring examples. None touches these examples.

Tests run

  • ci/ray_ci/doc/check_docstring_only.py --base upstream/master: "1 file(s), docstrings only."
  • ci/ray_ci/doc/run_docstring_examples.py python/ray/data/llm.py against the macOS arm64 Ray nightly at 43b706d733c, whose llm.py matches this PR's base, with the converted file swapped in: 0 run, 0 failed, 5 skipped for +SKIP_EXAMPLE.
  • pytest --doctest-modules -p doctest_pytest_plugin on the same file, with the Ray Data doctest plugin: 5 skipped as "render-only example (+SKIP_EXAMPLE)", no collection errors.
  • Every converted example parses with doctest.DocTestParser and compiles.
  • pre-commit on commit: all hooks pass, including black, ruff, and the Ray docstyle check.

The PR carries the docstring-only label, and its commit carries an @rtd-build line for the Read the Docs preview.

AI assistance (Claude Code) was used for this PR.

🤖 Generated with Claude Code

…ctests

Convert the seven `:skipif: True` testcode blocks in the processor
config classes and build_processor to `>>>` doctests. Each docstring
carries one `# doctest: +SKIP_EXAMPLE` flag, which skips it whole: the
examples need GPUs, model downloads, an OpenAI key, or a Serve
deployment, so they stay render-only as before.

@rtd-build

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Douglas Strodtman <[email protected]>
@dstrodtman
dstrodtman requested a review from a team as a code owner October 20, 2026 20:26
@dstrodtman dstrodtman added data Ray Data-related issues llm go add ONLY when ready to merge, run all tests docstring-only Skip heavy library tests for Ray API docstring edits. labels Oct 20, 2026

@gemini-code-assist gemini-code-assist 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.

Code Review

This pull request converts Sphinx-style testcode blocks to standard Python doctest blocks with skip annotations in python/ray/data/llm.py. The review feedback points out that two of the example blocks in build_processor are missing the # doctest: +SKIP_EXAMPLE annotation on their first lines, which is necessary to ensure they are consistently skipped by doctest runners.

Comment thread python/ray/data/llm.py Resolved
Comment thread python/ray/data/llm.py Resolved
@dstrodtman
dstrodtman merged commit 0ec552f into master Oct 21, 2026
5 checks passed
@dstrodtman
dstrodtman deleted the doc-1855-data-llm-doctests branch October 21, 2026 10:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

data Ray Data-related issues docstring-only Skip heavy library tests for Ray API docstring edits. go add ONLY when ready to merge, run all tests llm

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants