Skip to content

[doc] Add a guide for running the API consistency check locally - #64450

Closed
dstrodtman wants to merge 2 commits into
ray-project:masterfrom
dstrodtman:doc-1313-apiref-localrun-guide
Closed

dstrodtman wants to merge 2 commits into
ray-project:masterfrom
dstrodtman:doc-1313-apiref-localrun-guide

Conversation

@dstrodtman

@dstrodtman dstrodtman commented Jun 30, 2026 •

Copy link
Copy Markdown
Contributor

Why are these changes needed?

The API doc consistency check (the api_policy_check function in ci/lint/lint.sh, which runs ci/ray_ci/doc/cmd_check_api_discrepancy.py) introspects the live @PublicAPI surface, so it needs an environment where Ray and the libraries it checks import for real. That's the opposite of the docs build environment, which deliberately doesn't install Ray, so no existing contributor doc covered how to run this check locally.

This adds a "Running the API consistency check locally" section to doc/source/ray-contribute/ci.md:

  • What the premerge step actually does: install Ray --no-deps, generate the autosummary stubs with doc/source/api_autogen.py, then run the checker.
  • How the mocking works, and that it mocks only the absent optional backends (doc/source/api_mock_imports.py), so it can't shadow an installed library the walk needs.
  • The faithful environment (the docbuild image), including which libraries are real there (pandas) versus mocked even in CI (torch, transformers, tensorflow), and why the docs lock alone isn't a complete env.
  • A lightweight local approximation: a uv venv, a nightly wheel, setup-dev.py, and Sphinx (which the Ray wheel doesn't bring but both the checker and the stub generator import).
  • The single-team vs. full-pass difference: core ordering and the cross-team unwalked-subpackage guard only apply on the full run.
  • Warnings about nightly-wheel vs. checkout version skew, and about pandas being mocked locally where CI walks it for real.

Docs-only change (single file).

Related issue number

N/A, contributor-docs improvement.

Checks

  • I've signed off every commit (DCO).
  • Docs-only; doc/source/ray-contribute/ci.md.
  • Verified every claim against upstream/master (lint.sh, cmd_check_api_discrepancy.py, api_autogen.py, api_mock_imports.py, doc.build.Dockerfile, doc.rayci.yml, and the docs deplock).

Note: ci/lint/check-documentation-style.sh scopes Vale to doc/source/data and doc/source/ray-overview/examples, so this file isn't Vale-gated.

🤖 Generated with Claude Code

@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 adds documentation on how to run the API consistency check locally, covering both the official Docker-based environment and a lightweight local approximation. The reviewer provided valuable feedback to improve the local setup instructions by linking the local checkout's Python files via setup-dev.py so that local changes are actually tested, and by adding a note regarding the platform-specific nature of the hardcoded nightly wheel URL.

Comment on lines +52 to +63
```bash
uv venv --python 3.11 ~/.virtualenvs/ray-apiref
uv pip install --python ~/.virtualenvs/ray-apiref/bin/python \
"https://s3-us-west-2.amazonaws.com/ray-wheels/latest/ray-3.0.0.dev0-cp311-cp311-macosx_11_0_arm64.whl"
# Dependencies the walked surfaces need at import time (no vllm/sglang required):
uv pip install --python ~/.virtualenvs/ray-apiref/bin/python \
pandas pyarrow numpy starlette fastapi uvicorn pydantic aiohttp grpcio transformers

# Run the check against your checkout (PYTHONPATH so the checker imports from your tree):
PYTHONPATH="$(pwd)" ~/.virtualenvs/ray-apiref/bin/python \
ci/ray_ci/doc/cmd_check_api_discrepancy.py "$(pwd)" serve
```

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.

medium

There are two important improvements needed for this local setup block:

  1. Local Changes are Ignored: Without linking your local Python files, the checker will run against the unmodified nightly wheel's code in site-packages. Any local changes to Python files (such as adding or modifying @PublicAPI annotations) will be completely ignored. Running python/ray/setup-dev.py links your local checkout's Python files so that your local changes are actually tested.
  2. Platform-Specific URL: The hardcoded wheel URL is specific to macOS Apple Silicon (arm64) and Python 3.11. Adding a comment reminding users to adjust this URL for their platform will prevent installation failures on Linux or Intel macOS.
Suggested change
```bash
uv venv --python 3.11 ~/.virtualenvs/ray-apiref
uv pip install --python ~/.virtualenvs/ray-apiref/bin/python \
"https://s3-us-west-2.amazonaws.com/ray-wheels/latest/ray-3.0.0.dev0-cp311-cp311-macosx_11_0_arm64.whl"
# Dependencies the walked surfaces need at import time (no vllm/sglang required):
uv pip install --python ~/.virtualenvs/ray-apiref/bin/python \
pandas pyarrow numpy starlette fastapi uvicorn pydantic aiohttp grpcio transformers
# Run the check against your checkout (PYTHONPATH so the checker imports from your tree):
PYTHONPATH="$(pwd)" ~/.virtualenvs/ray-apiref/bin/python \
ci/ray_ci/doc/cmd_check_api_discrepancy.py "$(pwd)" serve
```
uv venv --python 3.11 ~/.virtualenvs/ray-apiref
# Install the nightly Ray wheel (adjust the URL below for your OS/architecture/Python version if not macOS arm64 Python 3.11):
uv pip install --python ~/.virtualenvs/ray-apiref/bin/python \
"https://s3-us-west-2.amazonaws.com/ray-wheels/latest/ray-3.0.0.dev0-cp311-cp311-macosx_11_0_arm64.whl"
# Link your local checkout's Python files so your local changes are tested:
~/.virtualenvs/ray-apiref/bin/python python/ray/setup-dev.py --yes
# Dependencies the walked surfaces need at import time (no vllm/sglang required):
uv pip install --python ~/.virtualenvs/ray-apiref/bin/python \
pandas pyarrow numpy starlette fastapi uvicorn pydantic aiohttp grpcio transformers
# Run the check against your checkout (PYTHONPATH so the checker imports from your tree):
PYTHONPATH="$(pwd)" ~/.virtualenvs/ray-apiref/bin/python \
ci/ray_ci/doc/cmd_check_api_discrepancy.py "$(pwd)" serve

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Both of your numbered points were adopted: the block now runs python/ray/setup-dev.py --yes and carries a comment telling readers to adjust the wheel URL for their OS, architecture, and Python version. There is also a warning admonition covering the residual skew, since setup-dev.py links only the Python files and the compiled extensions stay at the nightly commit.

I did not take the bulk dependency install from the suggestion block, and the reason is worth recording. The checker mocks the third-party backends that are absent, reading the list from doc/source/api_mock_imports.py, so most of that list is unnecessary: transformers in particular is mocked in CI too, and installing it for real makes a local run less like CI rather than more. The one entry that genuinely matters is pandas, which is installed in the docbuild image via python/requirements.txt and therefore walked for real, while a bare Ray wheel does not pull it in. The page now calls that specific gap out instead of installing everything.

Two things have also changed under this guide since the review, and the section has been rewritten for them: #64423 made api_policy_check generate autosummary stubs with doc/source/api_autogen.py as a separate phase, which the recipe now includes, and Sphinx has to be installed explicitly because the checker imports sphinx.ext.autodoc.mock and the stub generator imports sphinx.ext.autosummary, neither of which the Ray wheel provides.

@dstrodtman
dstrodtman force-pushed the doc-1313-apiref-localrun-guide branch from 5dbe322 to 52f6ca6 Compare July 6, 2026 19:03
@dstrodtman
dstrodtman force-pushed the doc-1313-apiref-localrun-guide branch from 52f6ca6 to 5d803ff Compare July 16, 2026 19:17
@dstrodtman dstrodtman added the docs-go RtD-only checks for docs-only changes. Doesn't run full library doc-test suites. label Jul 16, 2026
elliot-barn pushed a commit that referenced this pull request Jul 17, 2026
## Why

The `ray-contribute` pages were recently converted rST → MyST and
soft-wrapped, but those were format-only passes and left several
content-level problems in `doc/source/ray-contribute/docs.md` and
`testing-tips.md`. This PR fixes the stale content and reconciles
contradictions with `writing-style.md` and the shipped tooling.

## What changed

- **Modernize the RLlib notebook example** (`docs.md`, "Creating a
notebook example"). The example used the long-removed
`ray.rllib.agents.ppo` / `PPOTrainer` API, `CartPole-v0`, and an unused
`from ray import serve` import. Replaced with the current
`PPOConfig().environment("CartPole-v1")` → `build_algo()` → `train()`
pattern, matching the canonical snippet in
`doc/source/rllib/getting-started.rst`.
- **Fix the API-reference example** (`docs.md`, "Adding API
references"). It documented `ray.tune.integration.docker.DockerSyncer`
(module removed) and `ray.tune.integration.keras.TuneReportCallback`
(deprecated), and claimed the snippet came from
`tune/api/integration.rst` (which now uses `autosummary`, not
`autofunction`/`autoclass`). Switched to two current public APIs,
`ray.tune.register_env` and `ray.tune.Tuner`, and pointed the "change
the source" link at the live `registry.py` on `master`.
- **Reconcile the Vale scope** (`docs.md`). It said Vale is enforced
only on the Ray Data docs; the CI lint
(`ci/lint/check-documentation-style.sh`) runs Vale on both
`doc/source/data` and `doc/source/ray-overview/examples`. Updated to
"the Ray Data documentation and the example gallery," matching
`writing-style.md`.
- **State the MyST-for-new-pages policy** (`docs.md`). It presented rST
and MyST as an equal free choice. Updated to state that new pages must
be MyST Markdown and that a lint check rejects newly added `.rst` files,
matching `writing-style.md`.
- **Drop the stale TravisCI reference** (`testing-tips.md`). Ray uses
Buildkite, not TravisCI. Generalized the "limited cores" example to a CI
environment and removed the dead TravisCI link.
- **De-pin two hard-coded commit SHAs** to `master` (`docs.md`): the
`WordList.yml` link and the API-reference source link, so they track
current content instead of rotting against a frozen commit.

## Not a duplicate

No open PR touches `doc/source/ray-contribute/docs.md` or
`testing-tips.md` (checked `gh pr list --search`). PR #64450 in the same
area is a separate topic (running the API consistency check locally).

## Testing

- Verified every referenced API against the source tree in this
checkout: `ray.tune.register_env` (`python/ray/tune/registry.py`,
exported in `ray.tune`), `ray.tune.Tuner`
(`@PublicAPI(stability="beta")`), and confirmed `ray.rllib.agents` /
`PPOTrainer` and `ray.tune.integration.docker` are gone.
- The changed RLlib snippet is illustrative MyST (a fenced example and a
rendered block), not a CI-executed code cell, so no automated test runs
it. It mirrors the tested canonical pattern in `getting-started.rst`.
- I did not run the full Sphinx docs build in this environment. These
are prose-only changes to two non-code pages with no new files or
cross-references, so build risk is minimal, but the docs build in CI
(and a local `make rtd-build`) is the authoritative check.

AI assistance (Claude Code) was used to prepare this change.

---------

Signed-off-by: Douglas Strodtman <[email protected]>
@github-actions

Copy link
Copy Markdown

This pull request has been automatically marked as stale because it has not had
any activity for 14 days. It will be closed in another 14 days if no further activity occurs.
Thank you for your contributions.

You can always ask for help on our discussion forum or Ray's public slack channel.

If you'd like to keep this open, just leave any comment, and the stale label will be removed.

@github-actions github-actions Bot added the stale The issue is stale. It will be closed within 7 days unless there are further conversation label Jul 31, 2026
@dstrodtman dstrodtman added unstale A PR that has been marked unstale. It will not get marked stale again if this label is on it. and removed stale The issue is stale. It will be closed within 7 days unless there are further conversation labels Aug 3, 2026
@dstrodtman
dstrodtman force-pushed the doc-1313-apiref-localrun-guide branch from 46e54d9 to aa29710 Compare August 5, 2026 14:41
@dstrodtman
dstrodtman marked this pull request as ready for review August 5, 2026 19:44
@dstrodtman
dstrodtman requested review from a team as code owners August 5, 2026 19:44

@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 adds documentation on how to run the API consistency check locally, explaining the CI environment and providing a lightweight local approximation setup. The reviewer suggested simplifying the local setup commands by activating the virtual environment first, which avoids repeating the full path to the virtual environment's Python interpreter.

Comment thread doc/source/ray-contribute/ci.md Outdated
Comment on lines +59 to +72
uv venv --python 3.11 ~/.virtualenvs/ray-apiref
# The wheel URL below is macOS arm64 / Python 3.11. Adjust it for your OS, architecture, and Python version.
uv pip install --python ~/.virtualenvs/ray-apiref/bin/python \
sphinx \
"https://s3-us-west-2.amazonaws.com/ray-wheels/latest/ray-3.0.0.dev0-cp311-cp311-macosx_11_0_arm64.whl"
# Link your checkout's Python files over the wheel so the check walks your local @PublicAPI changes, not the wheel's:
~/.virtualenvs/ray-apiref/bin/python python/ray/setup-dev.py --yes

# Generate the autosummary stubs the check reads, as CI does in the same step:
PYTHONPATH="$(pwd)" ~/.virtualenvs/ray-apiref/bin/python doc/source/api_autogen.py

# Run the check against your checkout (PYTHONPATH so the checker imports from your tree):
PYTHONPATH="$(pwd)" ~/.virtualenvs/ray-apiref/bin/python \
ci/ray_ci/doc/cmd_check_api_discrepancy.py "$(pwd)" serve

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.

medium

Activating the virtual environment first simplifies the commands significantly by removing the need to repeatedly specify the full path to the virtual environment's Python interpreter.

Suggested change
uv venv --python 3.11 ~/.virtualenvs/ray-apiref
# The wheel URL below is macOS arm64 / Python 3.11. Adjust it for your OS, architecture, and Python version.
uv pip install --python ~/.virtualenvs/ray-apiref/bin/python \
sphinx \
"https://s3-us-west-2.amazonaws.com/ray-wheels/latest/ray-3.0.0.dev0-cp311-cp311-macosx_11_0_arm64.whl"
# Link your checkout's Python files over the wheel so the check walks your local @PublicAPI changes, not the wheel's:
~/.virtualenvs/ray-apiref/bin/python python/ray/setup-dev.py --yes
# Generate the autosummary stubs the check reads, as CI does in the same step:
PYTHONPATH="$(pwd)" ~/.virtualenvs/ray-apiref/bin/python doc/source/api_autogen.py
# Run the check against your checkout (PYTHONPATH so the checker imports from your tree):
PYTHONPATH="$(pwd)" ~/.virtualenvs/ray-apiref/bin/python \
ci/ray_ci/doc/cmd_check_api_discrepancy.py "$(pwd)" serve
uv venv --python 3.11 ~/.virtualenvs/ray-apiref
source ~/.virtualenvs/ray-apiref/bin/activate
# The wheel URL below is macOS arm64 / Python 3.11. Adjust it for your OS, architecture, and Python version.
uv pip install sphinx "https://s3-us-west-2.amazonaws.com/ray-wheels/latest/ray-3.0.0.dev0-cp311-cp311-macosx_11_0_arm64.whl"
# Link your checkout's Python files over the wheel so the check walks your local @PublicAPI changes, not the wheel's:
python python/ray/setup-dev.py --yes
# Generate the autosummary stubs the check reads, as CI does in the same step:
PYTHONPATH="$(pwd)" python doc/source/api_autogen.py
# Run the check against your checkout (PYTHONPATH so the checker imports from your tree):
PYTHONPATH="$(pwd)" python ci/ray_ci/doc/cmd_check_api_discrepancy.py "$(pwd)" serve

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Adopted. Activating the virtual environment once and dropping the explicit interpreter path makes the block noticeably easier to read, and it removes the line continuation from the uv pip install and the final checker invocation. uv pip install picks up VIRTUAL_ENV from the activated shell, so the install still targets the right environment.

I kept the two comments the block already carried: the wheel-URL platform note and the reason setup-dev.py is there. I also kept the continuation on the wheel install itself, since the S3 URL is long enough that a single line hurts more than it helps.

Addresses review feedback: activating the virtual environment once removes
the repeated interpreter path from every subsequent command.

Signed-off-by: Douglas Strodtman <[email protected]>
@ray-gardener ray-gardener Bot added docs An issue or change related to documentation core Issues that should be addressed in Ray Core devprod labels Aug 6, 2026
@dstrodtman

Copy link
Copy Markdown
Contributor Author

Superseded by #65285.

This PR's content is correct and carries over essentially unchanged. It's folded into #65285 because #64842 added an identically titled section to the same page from the same pre-#64775 base, so the two conflicted. Reviewing one combined change is cheaper than rebasing both.

@dstrodtman

Copy link
Copy Markdown
Contributor Author

Closing in favor of #65285, which carries this PR's content over verbatim, including the venv-activation refinement from the last review round.

@dstrodtman dstrodtman closed this Aug 7, 2026
dstrodtman added a commit that referenced this pull request Aug 7, 2026
…cipe (#65285)

## Why this change

`doc/source/ray-contribute/ci.md` explains what CI runs on a PR, but
stops at `microcheck` and the `go` label. It says nothing about what
runs when the PR changes documentation, which is the case the page's
likely reader is in.

This adds that, and folds in a recipe for reproducing the API
consistency check locally.

### What's new

**"Documentation CI checks"** covers, in the order a contributor meets
them:

- The Read the Docs render gate, including that `fail_on_warning: true`
makes any Sphinx warning a build failure, and when the preview build
skips.
- The two API surface checks, and the `doc_api` tag that lets an API
reference page edit reach them even though it's a documentation change.
- The per-library `<library>: docs example tests` steps, with a table
mapping path to step to tag, plus the Ray Core fallback and the Ray LLM
exception.
- That a prose-only or image-only change runs no library test steps at
all.
- The `docs-go` label and the `lint: validate docs-go scope` guard that
bounds it.
- The two post-merge-only steps, `doc: build` and `doc: linkcheck`.

**"Running the API consistency check locally"** documents the three
phases of `api_policy_check`, what the `docbuild` image does and doesn't
install (the deep-learning backends are mocked even in CI), and a `uv`
recipe that gets close enough for iteration.

It also updates one example commit message under the `microcheck`
section that named the old `serve doc tests` step label.

**`doc/.claude/CLAUDE.md`** carried the same staleness, so it's fixed in
the same PR. It still said the `doc` tag "covers content under `doc/`",
which stopped being true when #64775 landed. It now describes the
three-way split (`doc` for build and validation infra, `<lib>_doc` for
executable doc assets, `doc_api` for the API reference surface), records
that prose and images trigger nothing, and documents the `docs-go` label
and its scope guard. Two smaller drifts are corrected alongside: the
docs deplock rule emits `doc_api` now too, and the "tag it `doc`" advice
pointed at a tag that no longer selects content steps.

This file is an agent instruction file rather than published
documentation, so it's worth saying why it rides along here instead of
going out separately. `AGENTS.md` requires a dedicated PR for changes to
itself, which this isn't. `doc/.claude/` is on the skip rule in
`test.rules.txt` and excluded from the Read the Docs build guard, so
including it changes this PR's trigger set by nothing. And it's the same
factual correction as the page, from the same source reading — splitting
them would mean verifying the same CI configuration twice and risking
the two descriptions drifting apart again.

## Not a duplicate

This supersedes two of my own open PRs and replaces both:

- #64842 added a documentation CI overview. It was written before #64775
landed and describes the pre-rework model, where a single `doc` tag
selected the per-team doc test steps. That's no longer how routing
works, so landing it as-is would have documented the wrong thing.
- #64450 added the local API-check section. Its content is carried over
here essentially unchanged.

Both branched from the same pre-#64775 commit and added an identically
titled section, so they also conflicted with each other. Combining them
is cheaper to review than rebasing two PRs that overlap.

I'm not aware of another open PR touching this page. Checked with `gh pr
list --repo ray-project/ray --state open --search "ray-contribute
ci.md"`.

## Verification

Every factual claim was checked against `master` at `695a8814ea` rather
than carried over from the superseded PRs:

- Step labels, tags, and `if:` guards read from
`.buildkite/doc.rayci.yml`, `core.rayci.yml`, `data.rayci.yml`,
`ml.rayci.yml`, `rllib.rayci.yml`, `serve.rayci.yml`, and
`lint.rayci.yml`.
- Path-to-tag routing read from `.buildkite/test.rules.txt`.
- The render gate behavior read from `.readthedocs.yaml`
(`fail_on_warning: true`, the `post_checkout` skip guard) and
`doc/Makefile`.
- The mocked-backend claim checked against
`ci/docker/doc.build.Dockerfile`, which stages the `ray-core` and
`ray-dashboard` artifacts and installs only the docs lock, and
`doc/source/api_mock_imports.py`, which lists `torch`, `transformers`,
and `tensorflow`. This corrects #64842, which claimed the base images
supply those libraries for real.
- `doc: build`'s upload behavior read from `ci/ray_ci/doc/cmd_build.py`
(postmerge, `master` only).
- The `docs/readthedocs.com:anyscale-ray` check name confirmed from the
status checks on an open PR.

Commands run:

```
vale --config=.vale.ini doc/source/ray-contribute/ci.md
python doc/test_no_new_rst.py
pre-commit run --files doc/source/ray-contribute/ci.md
```

`test_no_new_rst.py` passes. `pre-commit` reports no applicable hooks
for a Markdown file under `doc/source/`. Vale surfaces no new findings
in the added text beyond spelling hits on project vocabulary
(`Buildkite`, `premerge`, `docbuild`, `autodoc`, `autosummary`,
`toctree`); note that CI's `documentation_style` lint scopes Vale to
`doc/source/data` and `doc/source/ray-overview/examples`, so this page
isn't in its path set.

The same source reading backs the `doc/.claude/CLAUDE.md` edit; it
asserts nothing the page doesn't.

Rendering verified by parsing the page with `myst-parser` using the
repo's `myst_heading_anchors = 4`: the table, the `{warning}` directive,
and the heading hierarchy all parse, with no skipped heading levels.
Both cross-references (`writing-code-snippets.md`,
`docs.md#building-the-ray-documentation`) point at existing `.md`
sources and an existing heading. The Read the Docs preview on this PR is
the real render check.

## AI assistance

AI assistance (Claude Code) was used to draft this change and to
cross-check the claims against the CI configuration. I've reviewed every
line.

---------

Signed-off-by: Douglas Strodtman <[email protected]>
Artimislyy pushed a commit to Artimislyy/ray that referenced this pull request Aug 11, 2026
…cipe (ray-project#65285)

## Why this change

`doc/source/ray-contribute/ci.md` explains what CI runs on a PR, but
stops at `microcheck` and the `go` label. It says nothing about what
runs when the PR changes documentation, which is the case the page's
likely reader is in.

This adds that, and folds in a recipe for reproducing the API
consistency check locally.

### What's new

**"Documentation CI checks"** covers, in the order a contributor meets
them:

- The Read the Docs render gate, including that `fail_on_warning: true`
makes any Sphinx warning a build failure, and when the preview build
skips.
- The two API surface checks, and the `doc_api` tag that lets an API
reference page edit reach them even though it's a documentation change.
- The per-library `<library>: docs example tests` steps, with a table
mapping path to step to tag, plus the Ray Core fallback and the Ray LLM
exception.
- That a prose-only or image-only change runs no library test steps at
all.
- The `docs-go` label and the `lint: validate docs-go scope` guard that
bounds it.
- The two post-merge-only steps, `doc: build` and `doc: linkcheck`.

**"Running the API consistency check locally"** documents the three
phases of `api_policy_check`, what the `docbuild` image does and doesn't
install (the deep-learning backends are mocked even in CI), and a `uv`
recipe that gets close enough for iteration.

It also updates one example commit message under the `microcheck`
section that named the old `serve doc tests` step label.

**`doc/.claude/CLAUDE.md`** carried the same staleness, so it's fixed in
the same PR. It still said the `doc` tag "covers content under `doc/`",
which stopped being true when ray-project#64775 landed. It now describes the
three-way split (`doc` for build and validation infra, `<lib>_doc` for
executable doc assets, `doc_api` for the API reference surface), records
that prose and images trigger nothing, and documents the `docs-go` label
and its scope guard. Two smaller drifts are corrected alongside: the
docs deplock rule emits `doc_api` now too, and the "tag it `doc`" advice
pointed at a tag that no longer selects content steps.

This file is an agent instruction file rather than published
documentation, so it's worth saying why it rides along here instead of
going out separately. `AGENTS.md` requires a dedicated PR for changes to
itself, which this isn't. `doc/.claude/` is on the skip rule in
`test.rules.txt` and excluded from the Read the Docs build guard, so
including it changes this PR's trigger set by nothing. And it's the same
factual correction as the page, from the same source reading — splitting
them would mean verifying the same CI configuration twice and risking
the two descriptions drifting apart again.

## Not a duplicate

This supersedes two of my own open PRs and replaces both:

- ray-project#64842 added a documentation CI overview. It was written before ray-project#64775
landed and describes the pre-rework model, where a single `doc` tag
selected the per-team doc test steps. That's no longer how routing
works, so landing it as-is would have documented the wrong thing.
- ray-project#64450 added the local API-check section. Its content is carried over
here essentially unchanged.

Both branched from the same pre-ray-project#64775 commit and added an identically
titled section, so they also conflicted with each other. Combining them
is cheaper to review than rebasing two PRs that overlap.

I'm not aware of another open PR touching this page. Checked with `gh pr
list --repo ray-project/ray --state open --search "ray-contribute
ci.md"`.

## Verification

Every factual claim was checked against `master` at `695a8814ea` rather
than carried over from the superseded PRs:

- Step labels, tags, and `if:` guards read from
`.buildkite/doc.rayci.yml`, `core.rayci.yml`, `data.rayci.yml`,
`ml.rayci.yml`, `rllib.rayci.yml`, `serve.rayci.yml`, and
`lint.rayci.yml`.
- Path-to-tag routing read from `.buildkite/test.rules.txt`.
- The render gate behavior read from `.readthedocs.yaml`
(`fail_on_warning: true`, the `post_checkout` skip guard) and
`doc/Makefile`.
- The mocked-backend claim checked against
`ci/docker/doc.build.Dockerfile`, which stages the `ray-core` and
`ray-dashboard` artifacts and installs only the docs lock, and
`doc/source/api_mock_imports.py`, which lists `torch`, `transformers`,
and `tensorflow`. This corrects ray-project#64842, which claimed the base images
supply those libraries for real.
- `doc: build`'s upload behavior read from `ci/ray_ci/doc/cmd_build.py`
(postmerge, `master` only).
- The `docs/readthedocs.com:anyscale-ray` check name confirmed from the
status checks on an open PR.

Commands run:

```
vale --config=.vale.ini doc/source/ray-contribute/ci.md
python doc/test_no_new_rst.py
pre-commit run --files doc/source/ray-contribute/ci.md
```

`test_no_new_rst.py` passes. `pre-commit` reports no applicable hooks
for a Markdown file under `doc/source/`. Vale surfaces no new findings
in the added text beyond spelling hits on project vocabulary
(`Buildkite`, `premerge`, `docbuild`, `autodoc`, `autosummary`,
`toctree`); note that CI's `documentation_style` lint scopes Vale to
`doc/source/data` and `doc/source/ray-overview/examples`, so this page
isn't in its path set.

The same source reading backs the `doc/.claude/CLAUDE.md` edit; it
asserts nothing the page doesn't.

Rendering verified by parsing the page with `myst-parser` using the
repo's `myst_heading_anchors = 4`: the table, the `{warning}` directive,
and the heading hierarchy all parse, with no skipped heading levels.
Both cross-references (`writing-code-snippets.md`,
`docs.md#building-the-ray-documentation`) point at existing `.md`
sources and an existing heading. The Read the Docs preview on this PR is
the real render check.

## AI assistance

AI assistance (Claude Code) was used to draft this change and to
cross-check the claims against the CI configuration. I've reviewed every
line.

---------

Signed-off-by: Douglas Strodtman <[email protected]>
400Ping pushed a commit to 400Ping/ray that referenced this pull request Aug 18, 2026
…roject#64770)

## Why

The `ray-contribute` pages were recently converted rST → MyST and
soft-wrapped, but those were format-only passes and left several
content-level problems in `doc/source/ray-contribute/docs.md` and
`testing-tips.md`. This PR fixes the stale content and reconciles
contradictions with `writing-style.md` and the shipped tooling.

## What changed

- **Modernize the RLlib notebook example** (`docs.md`, "Creating a
notebook example"). The example used the long-removed
`ray.rllib.agents.ppo` / `PPOTrainer` API, `CartPole-v0`, and an unused
`from ray import serve` import. Replaced with the current
`PPOConfig().environment("CartPole-v1")` → `build_algo()` → `train()`
pattern, matching the canonical snippet in
`doc/source/rllib/getting-started.rst`.
- **Fix the API-reference example** (`docs.md`, "Adding API
references"). It documented `ray.tune.integration.docker.DockerSyncer`
(module removed) and `ray.tune.integration.keras.TuneReportCallback`
(deprecated), and claimed the snippet came from
`tune/api/integration.rst` (which now uses `autosummary`, not
`autofunction`/`autoclass`). Switched to two current public APIs,
`ray.tune.register_env` and `ray.tune.Tuner`, and pointed the "change
the source" link at the live `registry.py` on `master`.
- **Reconcile the Vale scope** (`docs.md`). It said Vale is enforced
only on the Ray Data docs; the CI lint
(`ci/lint/check-documentation-style.sh`) runs Vale on both
`doc/source/data` and `doc/source/ray-overview/examples`. Updated to
"the Ray Data documentation and the example gallery," matching
`writing-style.md`.
- **State the MyST-for-new-pages policy** (`docs.md`). It presented rST
and MyST as an equal free choice. Updated to state that new pages must
be MyST Markdown and that a lint check rejects newly added `.rst` files,
matching `writing-style.md`.
- **Drop the stale TravisCI reference** (`testing-tips.md`). Ray uses
Buildkite, not TravisCI. Generalized the "limited cores" example to a CI
environment and removed the dead TravisCI link.
- **De-pin two hard-coded commit SHAs** to `master` (`docs.md`): the
`WordList.yml` link and the API-reference source link, so they track
current content instead of rotting against a frozen commit.

## Not a duplicate

No open PR touches `doc/source/ray-contribute/docs.md` or
`testing-tips.md` (checked `gh pr list --search`). PR ray-project#64450 in the same
area is a separate topic (running the API consistency check locally).

## Testing

- Verified every referenced API against the source tree in this
checkout: `ray.tune.register_env` (`python/ray/tune/registry.py`,
exported in `ray.tune`), `ray.tune.Tuner`
(`@PublicAPI(stability="beta")`), and confirmed `ray.rllib.agents` /
`PPOTrainer` and `ray.tune.integration.docker` are gone.
- The changed RLlib snippet is illustrative MyST (a fenced example and a
rendered block), not a CI-executed code cell, so no automated test runs
it. It mirrors the tested canonical pattern in `getting-started.rst`.
- I did not run the full Sphinx docs build in this environment. These
are prose-only changes to two non-code pages with no new files or
cross-references, so build risk is minimal, but the docs build in CI
(and a local `make rtd-build`) is the authoritative check.

AI assistance (Claude Code) was used to prepare this change.

---------

Signed-off-by: Douglas Strodtman <[email protected]>
Signed-off-by: 400Ping <[email protected]>
400Ping pushed a commit to 400Ping/ray that referenced this pull request Aug 18, 2026
…cipe (ray-project#65285)

## Why this change

`doc/source/ray-contribute/ci.md` explains what CI runs on a PR, but
stops at `microcheck` and the `go` label. It says nothing about what
runs when the PR changes documentation, which is the case the page's
likely reader is in.

This adds that, and folds in a recipe for reproducing the API
consistency check locally.

### What's new

**"Documentation CI checks"** covers, in the order a contributor meets
them:

- The Read the Docs render gate, including that `fail_on_warning: true`
makes any Sphinx warning a build failure, and when the preview build
skips.
- The two API surface checks, and the `doc_api` tag that lets an API
reference page edit reach them even though it's a documentation change.
- The per-library `<library>: docs example tests` steps, with a table
mapping path to step to tag, plus the Ray Core fallback and the Ray LLM
exception.
- That a prose-only or image-only change runs no library test steps at
all.
- The `docs-go` label and the `lint: validate docs-go scope` guard that
bounds it.
- The two post-merge-only steps, `doc: build` and `doc: linkcheck`.

**"Running the API consistency check locally"** documents the three
phases of `api_policy_check`, what the `docbuild` image does and doesn't
install (the deep-learning backends are mocked even in CI), and a `uv`
recipe that gets close enough for iteration.

It also updates one example commit message under the `microcheck`
section that named the old `serve doc tests` step label.

**`doc/.claude/CLAUDE.md`** carried the same staleness, so it's fixed in
the same PR. It still said the `doc` tag "covers content under `doc/`",
which stopped being true when ray-project#64775 landed. It now describes the
three-way split (`doc` for build and validation infra, `<lib>_doc` for
executable doc assets, `doc_api` for the API reference surface), records
that prose and images trigger nothing, and documents the `docs-go` label
and its scope guard. Two smaller drifts are corrected alongside: the
docs deplock rule emits `doc_api` now too, and the "tag it `doc`" advice
pointed at a tag that no longer selects content steps.

This file is an agent instruction file rather than published
documentation, so it's worth saying why it rides along here instead of
going out separately. `AGENTS.md` requires a dedicated PR for changes to
itself, which this isn't. `doc/.claude/` is on the skip rule in
`test.rules.txt` and excluded from the Read the Docs build guard, so
including it changes this PR's trigger set by nothing. And it's the same
factual correction as the page, from the same source reading — splitting
them would mean verifying the same CI configuration twice and risking
the two descriptions drifting apart again.

## Not a duplicate

This supersedes two of my own open PRs and replaces both:

- ray-project#64842 added a documentation CI overview. It was written before ray-project#64775
landed and describes the pre-rework model, where a single `doc` tag
selected the per-team doc test steps. That's no longer how routing
works, so landing it as-is would have documented the wrong thing.
- ray-project#64450 added the local API-check section. Its content is carried over
here essentially unchanged.

Both branched from the same pre-ray-project#64775 commit and added an identically
titled section, so they also conflicted with each other. Combining them
is cheaper to review than rebasing two PRs that overlap.

I'm not aware of another open PR touching this page. Checked with `gh pr
list --repo ray-project/ray --state open --search "ray-contribute
ci.md"`.

## Verification

Every factual claim was checked against `master` at `695a8814ea` rather
than carried over from the superseded PRs:

- Step labels, tags, and `if:` guards read from
`.buildkite/doc.rayci.yml`, `core.rayci.yml`, `data.rayci.yml`,
`ml.rayci.yml`, `rllib.rayci.yml`, `serve.rayci.yml`, and
`lint.rayci.yml`.
- Path-to-tag routing read from `.buildkite/test.rules.txt`.
- The render gate behavior read from `.readthedocs.yaml`
(`fail_on_warning: true`, the `post_checkout` skip guard) and
`doc/Makefile`.
- The mocked-backend claim checked against
`ci/docker/doc.build.Dockerfile`, which stages the `ray-core` and
`ray-dashboard` artifacts and installs only the docs lock, and
`doc/source/api_mock_imports.py`, which lists `torch`, `transformers`,
and `tensorflow`. This corrects ray-project#64842, which claimed the base images
supply those libraries for real.
- `doc: build`'s upload behavior read from `ci/ray_ci/doc/cmd_build.py`
(postmerge, `master` only).
- The `docs/readthedocs.com:anyscale-ray` check name confirmed from the
status checks on an open PR.

Commands run:

```
vale --config=.vale.ini doc/source/ray-contribute/ci.md
python doc/test_no_new_rst.py
pre-commit run --files doc/source/ray-contribute/ci.md
```

`test_no_new_rst.py` passes. `pre-commit` reports no applicable hooks
for a Markdown file under `doc/source/`. Vale surfaces no new findings
in the added text beyond spelling hits on project vocabulary
(`Buildkite`, `premerge`, `docbuild`, `autodoc`, `autosummary`,
`toctree`); note that CI's `documentation_style` lint scopes Vale to
`doc/source/data` and `doc/source/ray-overview/examples`, so this page
isn't in its path set.

The same source reading backs the `doc/.claude/CLAUDE.md` edit; it
asserts nothing the page doesn't.

Rendering verified by parsing the page with `myst-parser` using the
repo's `myst_heading_anchors = 4`: the table, the `{warning}` directive,
and the heading hierarchy all parse, with no skipped heading levels.
Both cross-references (`writing-code-snippets.md`,
`docs.md#building-the-ray-documentation`) point at existing `.md`
sources and an existing heading. The Read the Docs preview on this PR is
the real render check.

## AI assistance

AI assistance (Claude Code) was used to draft this change and to
cross-check the claims against the CI configuration. I've reviewed every
line.

---------

Signed-off-by: Douglas Strodtman <[email protected]>
Signed-off-by: 400Ping <[email protected]>
nadongjun pushed a commit to nadongjun/ray that referenced this pull request Oct 6, 2026
…cipe (ray-project#65285)

## Why this change

`doc/source/ray-contribute/ci.md` explains what CI runs on a PR, but
stops at `microcheck` and the `go` label. It says nothing about what
runs when the PR changes documentation, which is the case the page's
likely reader is in.

This adds that, and folds in a recipe for reproducing the API
consistency check locally.

### What's new

**"Documentation CI checks"** covers, in the order a contributor meets
them:

- The Read the Docs render gate, including that `fail_on_warning: true`
makes any Sphinx warning a build failure, and when the preview build
skips.
- The two API surface checks, and the `doc_api` tag that lets an API
reference page edit reach them even though it's a documentation change.
- The per-library `<library>: docs example tests` steps, with a table
mapping path to step to tag, plus the Ray Core fallback and the Ray LLM
exception.
- That a prose-only or image-only change runs no library test steps at
all.
- The `docs-go` label and the `lint: validate docs-go scope` guard that
bounds it.
- The two post-merge-only steps, `doc: build` and `doc: linkcheck`.

**"Running the API consistency check locally"** documents the three
phases of `api_policy_check`, what the `docbuild` image does and doesn't
install (the deep-learning backends are mocked even in CI), and a `uv`
recipe that gets close enough for iteration.

It also updates one example commit message under the `microcheck`
section that named the old `serve doc tests` step label.

**`doc/.claude/CLAUDE.md`** carried the same staleness, so it's fixed in
the same PR. It still said the `doc` tag "covers content under `doc/`",
which stopped being true when ray-project#64775 landed. It now describes the
three-way split (`doc` for build and validation infra, `<lib>_doc` for
executable doc assets, `doc_api` for the API reference surface), records
that prose and images trigger nothing, and documents the `docs-go` label
and its scope guard. Two smaller drifts are corrected alongside: the
docs deplock rule emits `doc_api` now too, and the "tag it `doc`" advice
pointed at a tag that no longer selects content steps.

This file is an agent instruction file rather than published
documentation, so it's worth saying why it rides along here instead of
going out separately. `AGENTS.md` requires a dedicated PR for changes to
itself, which this isn't. `doc/.claude/` is on the skip rule in
`test.rules.txt` and excluded from the Read the Docs build guard, so
including it changes this PR's trigger set by nothing. And it's the same
factual correction as the page, from the same source reading — splitting
them would mean verifying the same CI configuration twice and risking
the two descriptions drifting apart again.

## Not a duplicate

This supersedes two of my own open PRs and replaces both:

- ray-project#64842 added a documentation CI overview. It was written before ray-project#64775
landed and describes the pre-rework model, where a single `doc` tag
selected the per-team doc test steps. That's no longer how routing
works, so landing it as-is would have documented the wrong thing.
- ray-project#64450 added the local API-check section. Its content is carried over
here essentially unchanged.

Both branched from the same pre-ray-project#64775 commit and added an identically
titled section, so they also conflicted with each other. Combining them
is cheaper to review than rebasing two PRs that overlap.

I'm not aware of another open PR touching this page. Checked with `gh pr
list --repo ray-project/ray --state open --search "ray-contribute
ci.md"`.

## Verification

Every factual claim was checked against `master` at `695a8814ea` rather
than carried over from the superseded PRs:

- Step labels, tags, and `if:` guards read from
`.buildkite/doc.rayci.yml`, `core.rayci.yml`, `data.rayci.yml`,
`ml.rayci.yml`, `rllib.rayci.yml`, `serve.rayci.yml`, and
`lint.rayci.yml`.
- Path-to-tag routing read from `.buildkite/test.rules.txt`.
- The render gate behavior read from `.readthedocs.yaml`
(`fail_on_warning: true`, the `post_checkout` skip guard) and
`doc/Makefile`.
- The mocked-backend claim checked against
`ci/docker/doc.build.Dockerfile`, which stages the `ray-core` and
`ray-dashboard` artifacts and installs only the docs lock, and
`doc/source/api_mock_imports.py`, which lists `torch`, `transformers`,
and `tensorflow`. This corrects ray-project#64842, which claimed the base images
supply those libraries for real.
- `doc: build`'s upload behavior read from `ci/ray_ci/doc/cmd_build.py`
(postmerge, `master` only).
- The `docs/readthedocs.com:anyscale-ray` check name confirmed from the
status checks on an open PR.

Commands run:

```
vale --config=.vale.ini doc/source/ray-contribute/ci.md
python doc/test_no_new_rst.py
pre-commit run --files doc/source/ray-contribute/ci.md
```

`test_no_new_rst.py` passes. `pre-commit` reports no applicable hooks
for a Markdown file under `doc/source/`. Vale surfaces no new findings
in the added text beyond spelling hits on project vocabulary
(`Buildkite`, `premerge`, `docbuild`, `autodoc`, `autosummary`,
`toctree`); note that CI's `documentation_style` lint scopes Vale to
`doc/source/data` and `doc/source/ray-overview/examples`, so this page
isn't in its path set.

The same source reading backs the `doc/.claude/CLAUDE.md` edit; it
asserts nothing the page doesn't.

Rendering verified by parsing the page with `myst-parser` using the
repo's `myst_heading_anchors = 4`: the table, the `{warning}` directive,
and the heading hierarchy all parse, with no skipped heading levels.
Both cross-references (`writing-code-snippets.md`,
`docs.md#building-the-ray-documentation`) point at existing `.md`
sources and an existing heading. The Read the Docs preview on this PR is
the real render check.

## AI assistance

AI assistance (Claude Code) was used to draft this change and to
cross-check the claims against the CI configuration. I've reviewed every
line.

---------

Signed-off-by: Douglas Strodtman <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core Issues that should be addressed in Ray Core devprod docs An issue or change related to documentation docs-go RtD-only checks for docs-only changes. Doesn't run full library doc-test suites. unstale A PR that has been marked unstale. It will not get marked stale again if this label is on it.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant