Repository navigation
[RLlib] Convert rllib.algorithms docstring examples to stock doctests - #67774
Conversation
Convert the `.. testcode::` examples in the rllib/algorithms config class docstrings to `>>>` examples under an `Examples:` header, so they render in both Sphinx and griffe/MkDocs. Seven runnable blocks become runnable doctests, five `:skipif: True` blocks become `+SKIP_EXAMPLE` docstrings, and five blocks that need an output or code change stay `testcode` for a separate PR. @rtd-build Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Douglas Strodtman <[email protected]>
There was a problem hiding this comment.
Code Review
This pull request converts Sphinx .. testcode:: blocks into standard doctest Examples: across several RLlib algorithm configuration files (including APPO, BC, CQL, DQN, DreamerV3, IMPALA, IQL, MARWIL, PPO, and SAC) and adds docstrings to their __init__ methods. The review feedback points out that several of these newly converted doctests (specifically in BCConfig, CQLConfig, and IQLConfig) contain unhandled return values, print statements without expected outputs, or merged examples that would cause doctest failures if unskipped. The reviewer suggests properly discarding or capturing these return values and separating distinct examples for better clarity and compatibility.
| Examples: | ||
| >>> from ray.rllib.algorithms.bc import BCConfig # doctest: +SKIP_EXAMPLE | ||
| >>> # Run this from the ray directory root. | ||
| >>> config = BCConfig().training(lr=0.00001, gamma=0.99) | ||
| >>> config = config.offline_data( | ||
| ... input_="./rllib/offline/tests/data/cartpole/large.json") | ||
| >>> # Build an Algorithm object from the config and run 1 training iteration. | ||
| >>> algo = config.build() | ||
| >>> algo.train() | ||
| >>> from ray.rllib.algorithms.bc import BCConfig | ||
| >>> from ray import tune | ||
| >>> config = BCConfig() | ||
| >>> # Print out some default values. | ||
| >>> print(config.beta) | ||
| >>> # Update the config object. | ||
| >>> config.training( | ||
| ... lr=tune.grid_search([0.001, 0.0001]), beta=0.75 | ||
| ... ) | ||
| >>> # Set the config object's data path. | ||
| >>> # Run this from the ray directory root. | ||
| >>> config.offline_data( | ||
| ... input_="./rllib/offline/tests/data/cartpole/large.json" | ||
| ... ) | ||
| >>> # Set the config object's env, used for evaluation. | ||
| >>> config.environment(env="CartPole-v1") | ||
| >>> # Use to_dict() to get the old-style python config dict | ||
| >>> # when running with tune. | ||
| >>> tune.Tuner( | ||
| ... "BC", | ||
| ... param_space=config.to_dict(), | ||
| ... ).fit() |
There was a problem hiding this comment.
The converted doctest examples for BCConfig contain several unhandled return values and print statements that would cause doctest failures if they were ever unskipped. Specifically:
- algo.train() returns a dictionary, which must be discarded (e.g., _ = algo.train()) to prevent doctest from expecting its output.
- print(config.beta) has no expected output value on the following line.
- config.training(...), config.offline_data(...), and config.environment(...) all return the config object, which must be assigned or discarded.
- Merging two completely separate examples into a single continuous block under Examples: is confusing and lacks clear separation.
We should separate them into distinct blocks and properly handle all return values.
Examples:
>>> from ray.rllib.algorithms.bc import BCConfig # doctest: +SKIP_EXAMPLE
>>> # Run this from the ray directory root.
>>> config = BCConfig().training(lr=0.00001, gamma=0.99)
>>> config = config.offline_data(
... input_="./rllib/offline/tests/data/cartpole/large.json")
>>> # Build an Algorithm object from the config and run 1 training iteration.
>>> algo = config.build()
>>> _ = algo.train()
Using Ray Tune:
>>> from ray.rllib.algorithms.bc import BCConfig # doctest: +SKIP_EXAMPLE
>>> from ray import tune
>>> config = BCConfig()
>>> # Print out some default values.
>>> config.beta
0.0
>>> # Update the config object.
>>> config = config.training(
... lr=tune.grid_search([0.001, 0.0001]), beta=0.75
... )
>>> # Set the config object's data path.
>>> # Run this from the ray directory root.
>>> config = config.offline_data(
... input_="./rllib/offline/tests/data/cartpole/large.json"
... )
>>> # Set the config object's env, used for evaluation.
>>> config = config.environment(env="CartPole-v1")
>>> # Use to_dict() to get the old-style python config dict
>>> # when running with tune.
>>> _ = tune.Tuner(
... "BC",
... param_space=config.to_dict(),
... ).fit()There was a problem hiding this comment.
| Examples: | ||
| >>> from ray.rllib.algorithms.cql import CQLConfig # doctest: +SKIP_EXAMPLE | ||
| >>> config = CQLConfig().training(gamma=0.9, lr=0.01) | ||
| >>> config = config.resources(num_gpus=0) | ||
| >>> config = config.env_runners(num_env_runners=4) | ||
| >>> print(config.to_dict()) | ||
| >>> # Build a Algorithm object from the config and run 1 training iteration. | ||
| >>> algo = config.build(env="CartPole-v1") | ||
| >>> algo.train() |
There was a problem hiding this comment.
The converted doctest example for CQLConfig contains unhandled return values that would cause doctest failures if unskipped:
- print(config.to_dict()) prints a dictionary but has no expected output specified on the following line. We can assign it to a dummy variable or discard it.
- algo.train() returns a dictionary, which must be discarded (e.g., _ = algo.train()) to prevent doctest from expecting its output.
| Examples: | |
| >>> from ray.rllib.algorithms.cql import CQLConfig # doctest: +SKIP_EXAMPLE | |
| >>> config = CQLConfig().training(gamma=0.9, lr=0.01) | |
| >>> config = config.resources(num_gpus=0) | |
| >>> config = config.env_runners(num_env_runners=4) | |
| >>> print(config.to_dict()) | |
| >>> # Build a Algorithm object from the config and run 1 training iteration. | |
| >>> algo = config.build(env="CartPole-v1") | |
| >>> algo.train() | |
| Examples: | |
| >>> from ray.rllib.algorithms.cql import CQLConfig # doctest: +SKIP_EXAMPLE | |
| >>> config = CQLConfig().training(gamma=0.9, lr=0.01) | |
| >>> config = config.resources(num_gpus=0) | |
| >>> config = config.env_runners(num_env_runners=4) | |
| >>> _ = config.to_dict() | |
| >>> # Build a Algorithm object from the config and run 1 training iteration. | |
| >>> algo = config.build(env="CartPole-v1") | |
| >>> _ = algo.train() |
There was a problem hiding this comment.
Thanks, that's right. This PR is syntax-only on purpose, so it leaves example code unchanged. #67775, stacked on this PR, fixes this. It also rebuilds the example on Pendulum with offline data, because CQL learns continuous actions.
| Examples: | ||
| >>> from ray.rllib.algorithms.iql import IQLConfig # doctest: +SKIP_EXAMPLE | ||
| >>> # Run this from the ray directory root. | ||
| >>> config = IQLConfig().training(actor_lr=0.00001, gamma=0.99) | ||
| >>> config = config.offline_data( | ||
| ... input_="./rllib/offline/tests/data/pendulum/pendulum-v1_enormous") | ||
| >>> # Build an Algorithm object from the config and run 1 training iteration. | ||
| >>> algo = config.build() | ||
| >>> algo.train() | ||
| >>> from ray.rllib.algorithms.iql import IQLConfig | ||
| >>> from ray import tune | ||
| >>> config = IQLConfig() | ||
| >>> # Print out some default values. | ||
| >>> print(config.beta) | ||
| >>> # Update the config object. | ||
| >>> config.training( | ||
| ... lr=tune.grid_search([0.001, 0.0001]), beta=0.75 | ||
| ... ) | ||
| >>> # Set the config object's data path. | ||
| >>> # Run this from the ray directory root. | ||
| >>> config.offline_data( | ||
| ... input_="./rllib/offline/tests/data/pendulum/pendulum-v1_enormous" | ||
| ... ) | ||
| >>> # Set the config object's env, used for evaluation. | ||
| >>> config.environment(env="Pendulum-v1") | ||
| >>> # Use to_dict() to get the old-style python config dict | ||
| >>> # when running with tune. | ||
| >>> tune.Tuner( | ||
| ... "IQL", | ||
| ... param_space=config.to_dict(), | ||
| ... ).fit() | ||
| """ |
There was a problem hiding this comment.
The converted doctest examples for IQLConfig contain several unhandled return values and print statements that would cause doctest failures if they were ever unskipped. Specifically:
- algo.train() returns a dictionary, which must be discarded (e.g., _ = algo.train()) to prevent doctest from expecting its output.
- print(config.beta) has no expected output value on the following line.
- config.training(...), config.offline_data(...), and config.environment(...) all return the config object, which must be assigned or discarded.
- Merging two completely separate examples into a single continuous block under Examples: is confusing and lacks clear separation.
We should separate them into distinct blocks and properly handle all return values.
Examples:
>>> from ray.rllib.algorithms.iql import IQLConfig # doctest: +SKIP_EXAMPLE
>>> # Run this from the ray directory root.
>>> config = IQLConfig().training(actor_lr=0.00001, gamma=0.99)
>>> config = config.offline_data(
... input_="./rllib/offline/tests/data/pendulum/pendulum-v1_enormous")
>>> # Build an Algorithm object from the config and run 1 training iteration.
>>> algo = config.build()
>>> _ = algo.train()
Using Ray Tune:
>>> from ray.rllib.algorithms.iql import IQLConfig # doctest: +SKIP_EXAMPLE
>>> from ray import tune
>>> config = IQLConfig()
>>> # Print out some default values.
>>> config.beta
0.1
>>> # Update the config object.
>>> config = config.training(
... lr=tune.grid_search([0.001, 0.0001]), beta=0.75
... )
>>> # Set the config object's data path.
>>> # Run this from the ray directory root.
>>> config = config.offline_data(
... input_="./rllib/offline/tests/data/pendulum/pendulum-v1_enormous"
... )
>>> # Set the config object's env, used for evaluation.
>>> config = config.environment(env="Pendulum-v1")
>>> # Use to_dict() to get the old-style python config dict
>>> # when running with tune.
>>> _ = tune.Tuner(
... "IQL",
... param_space=config.to_dict(),
... ).fit()There was a problem hiding this comment.
…run (#67775) ## Description This is a correctness change for RLlib review. It fixes `rllib.algorithms` docstring examples that were wrong or couldn't run, and it converts the last `testcode` blocks in `rllib/algorithms`. Those blocks needed a change to code, output, or prose, so they stayed out of the syntax-only conversion in #67774. After this PR, no `testcode` or `testoutput` remains in `rllib/algorithms`. Stacked on #67774. Review that PR first. This diff is against its branch. ### Tune examples that now check their result The second example in each of `IMPALAConfig`, `MARWILConfig`, `DQNConfig`, `PPOConfig`, and `APPOConfig` runs `tune.Tuner(...).fit()`. Tune always prints its experiment table to stdout, even with `verbose=0`, so a doctest can't check the exact output. `fit()` doesn't raise when a trial fails, so the old `:hide:` output of `...` checked nothing. Each example now uses the convention from Ray Tune's own docstrings, such as `tune/stopper/stopper.py`: `print("[ignore]"); results = tune.Tuner(...).fit() # doctest: +ELLIPSIS`, with `[ignore]...` as the output. Each then shows `results.num_errors` as `0`, so a failed trial fails the doctest. In `MARWILConfig`, `print(f"beta: {config.beta}")` now shows `beta: 1.0`, and the bare config calls discard their return value. ### Examples that were broken and now run `BCConfig` had these problems: - The data path `./rllib/offline/tests/data/cartpole/large.json` no longer exists, because `rllib/` moved to `python/ray/rllib`. The example now reads `cartpole-v1_large` through `Path(__file__).parents[2]`, as `MARWILConfig` does. The `doctest()` target already ships that data. - `build()` failed, because an offline config without evaluation needs `observation_space` and `action_space`. Both now come from `gym.make("CartPole-v1")`. - The second example passed `beta=0.75`, which `BCConfig.validate` rejects, because BC requires `beta` to be 0.0. That argument is gone, and `print(config.beta)` shows `0.0`. - The `Tuner` had no stop condition. It now stops after one iteration. `+SKIP_EXAMPLE` is gone. ### Fixed but still render-only These examples read `offline/tests/data/pendulum/pendulum-v1_enormous`, which the `doctest()` target doesn't ship, so they keep `+SKIP_EXAMPLE`. Adding that data to the target's `data` would let them run. - `IQLConfig`: the same path, spaces, and stop-condition fixes as `BCConfig`, with Pendulum data and spaces. `print(config.beta)` shows `0.1`. It passes the strict check with `+SKIP_EXAMPLE` removed. - `CQLConfig`: the example built on CartPole with no offline data, and it failed on the replay buffer type. CQL learns continuous actions, so the example now uses `Pendulum-v1` and reads the Pendulum data. `lr=0.01` became `lr=None`, because CQL sets a learning rate per optimizer, and its validation rejects a base `lr`. `print(config.to_dict())` stays as-is. ### Possible RLlib bug, not fixed here In the `CQLConfig` example, `dataset_num_iters_per_learner=1` makes `algo.train()` fail every time, with `KeyError: 0` in `Learner._create_iterator_if_necessary`. It works with 2 or 5, and BC, IQL, and MARWIL work with 1. The example uses 5, as `examples/algorithms/cql/pendulum_cql.py` does. I didn't look into the cause. **CI time.** The six runnable docstrings build an algorithm and train it, and the five Tune examples each take 15 to 28 seconds on CPU. Together they add about 150 seconds to the RLlib `doctest()` target. If that's too much, a docstring-level `+SKIP_EXAMPLE` keeps any of them render-only. ### Review fixes - `BCConfig` and `IQLConfig`: each docstring holds two examples, and they ran together. A blank line now separates them. From gemini-code-assist comments on #67774. - `MARWILConfig`: fixed the typo "evalaution". From a gemini-code-assist comment. ## Related issues Stacked on #67774. Related to #66753. ## Additional information **Not a duplicate.** I searched open PRs for RLlib `testcode`, doctest, and docstring-example changes, and none touches these docstrings. **Tests run** These ran in a Python 3.12 virtualenv with `ray[rllib]==2.59.0`, `torch`, `tensorflow` 2.21, and `pillow`. For these runs, the `cartpole-v1_large` data was linked into the install, where the `doctest()` target's `data` puts it. - `ci/ray_ci/doc/run_docstring_examples.py` on all 8 changed files: "6 docstring(s) run, 0 failed, 2 skipped, in 8 file(s)." - A strict stdlib `doctest` pass over the same docstrings with `ELLIPSIS`. Unlike the runner above, it fails on unexpected output, the way the RLlib `doctest()` target does. All 6 runnable docstrings pass, and `IQLConfig` and `CQLConfig` carry `+SKIP_EXAMPLE`. - With `+SKIP_EXAMPLE` removed, `IQLConfig` passes the strict check. `CQLConfig` runs every statement, and only the `to_dict()` print has no expected output. - `ci/ray_ci/doc/check_docstring_only.py --base doc-1926-rllib-algorithms-doctests`: "8 file(s), docstrings only." - `pre-commit run --files` on all 8 files: all hooks pass. The PR carries the `docstring-only` label. 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](https://claude.com/claude-code) --------- Signed-off-by: Douglas Strodtman <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]>
…67834) ## Description `//python/ray/rllib:doctest` fails on master in the `APPOConfig` and `IMPALAConfig` examples. #67774 made these examples runnable. Each one builds an algorithm with `learners(num_learners=1)`, and the learner worker sets up a Gloo process group and prints this line: ``` (_WrappedExecutable pid=5360) [Gloo] Rank 0 is connected to 0 peer ranks. Expected number of connected peer ranks is : 0 ``` Ray forwards worker output to the driver's stdout asynchronously. Stock doctest compares the driver's stdout against each example's expected output, so the line fails `algo = config.build()`, which expects nothing. Both bazel attempts failed this way in [premerge build 76224](https://buildkite.com/ray-project/premerge/builds/76224) on #67627, which doesn't touch these files. Any RLlib PR that runs the full doctest target without the `docstring-only` label hits the same failure. #67774 passed premerge because it ran with `docstring-only`, which runs docstring examples in a light image without torch and skips these examples by name. This PR sets `RAY_LOG_TO_DRIVER=0` in the target's `env`. `ray.init()` reads that constant when it isn't passed `log_to_driver`, and these examples don't pass it. #67831 sets the same variable on the Train V2 doctest target for the same Gloo output from `TorchTrainer` workers. No RLlib docstring example expects worker output: a search of `python/ray/rllib` outside `examples/` and `tests/` for `pid=` and worker-actor prefixes finds none. The examples themselves don't change. **Not a duplicate.** I searched open PRs for `APPOConfig`, `IMPALAConfig`, doctest, and Gloo. #67775 is the only match. It changes the second, Tune-based example in each of these docstrings and doesn't touch the first example or `BUILD.bazel`. ## Testing - `pre-commit run --files python/ray/rllib/BUILD.bazel`: all hooks pass, including buildifier and buildifier-lint. - On macOS arm64 with a Ray nightly wheel, master's `appo.py` and `impala.py`, and Ray's default doctest plugin: `pytest -p default_doctest_pytest_plugin --doctest-modules --noconftest ray/rllib/algorithms/appo/appo.py ray/rllib/algorithms/impala/impala.py` passes with and without `RAY_LOG_TO_DRIVER=0` (2 passed each time). The Gloo line doesn't appear on macOS, so this run shows the change doesn't break the examples but doesn't reproduce the failure. This PR's premerge, which runs the full RLlib doctest target on Linux, is the real check. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Signed-off-by: Douglas Strodtman <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]>
…the rllib doctest target (#68242) ## Why are these changes needed? The scheduled postmerge step `:brain: rllib: docs example tests` has failed on every run since #67774 turned the `rllib.algorithms` docstring examples into doctests. The failing target is `//python/ray/rllib:doctest`. #67834 fixed the `APPOConfig` and `IMPALAConfig` failures, but `BCConfig` still fails, and the target runs out of time partway through `PPOConfig`. See, for example, [postmerge 21027](https://buildkite.com/ray-project/postmerge/builds/21027). The second `BCConfig` example deadlocks on CPUs. It runs a `tune.Tuner` with a `grid_search` over two learning rates, so Tune starts both trials at once. On the doctest cluster the two trials take every CPU. Each trial's offline data pipeline, a `MapBatches(OfflinePreLearner)` actor pool, then never gets a CPU to start. After 1800 seconds, Ray Data's no-progress timeout fails both trials with `ExecutionTimeoutError`. That lost half hour is also why the target runs out of time in `PPOConfig`. This PR passes `tune_config=tune.TuneConfig(max_concurrent_trials=1)` to the example's `Tuner`. The `grid_search` still runs both learning rates, one trial after the other, so the example teaches the same thing. ## Testing Run in a `python:3.12-slim` container (linux/aarch64) capped at 4 CPUs with `docker run --cpus 4`. The container installs the master wheel built at 456e286, the base of this branch, plus CPU torch, pytest, Pillow, and tensorboardX. The command matches what the Bazel target runs, with its env (`RAY_LOG_TO_DRIVER=0`, `TF_USE_LEGACY_KERAS=1`) and the default doctest plugin: ```bash python -m pytest --noconftest --doctest-modules -p default_doctest_pytest_plugin \ ray/rllib/algorithms/bc/bc.py ``` - Before this change: `1 failed in 1811.24s`. Both trials raise `ray.data.exceptions.ExecutionTimeoutError: Dataset execution made no progress for at least 1800s`. While it hung, `ray status` showed `4.0/4.0 CPU (2.0 used of 2.0 reserved in placement groups)` with `{'CPU': 1.0}: 4+ pending tasks/actors`. - After this change: `1 passed in 16.52s`. - `ray/rllib/algorithms/ppo/ppo.py` on its own: `1 passed in 12.84s`. `PPOConfig` doesn't hang. On CI it only ran out of time after the 30-minute `BCConfig` stall. Caveats: the 4-CPU cap is an estimate of what one doctest container gets on the `medium` instance with `--parallelism-per-worker 2`. I haven't confirmed CI's exact per-container CPU count. I also haven't run the full `//python/ray/rllib:doctest` target locally. A scheduled postmerge run will confirm the fix. I also tested adding `algo.stop()` after the first example, because that `Algorithm` stays alive until the module's `ray.shutdown()`. It didn't help, and the Tuner example deadlocked the same way, so this PR leaves it out. ## Duplicate check No open PR or issue touches `rllib/algorithms/bc/bc.py` or this target failure. Searched open PRs for `BCConfig`, `bc.py`, and `rllib doctest`. The open `rllib.core` doctest PRs (#67976, #67766) add examples to the same target but don't change `BCConfig`. ## AI assistance AI assistance (Claude Code) helped with diagnosis, the local reproduction, and drafting. I reviewed the change and the test results. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Signed-off-by: Douglas Strodtman <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]>
Description
Converts the
.. testcode::examples in thepython/ray/rllib/algorithmsconfig class docstrings to>>>examples under a pluralExamples:header. Sphinx renders.. testcode::, but griffe and MkDocs don't, and stock>>>examples render in both. This follows the RLlib conversions in #66749 and #67753.algorithm_config.pywas already converted in #66749.This PR covers 12 of the 17
testcodeblocks inrllib/algorithms, in 10 files:SACConfig,DreamerV3Config,IMPALAConfig,DQNConfig,PPOConfig,MARWILConfig, andAPPOConfig. None of these ran before, because the RLlibdoctest()target doesn't executetestcode. All seven pass now. TheMARWILConfigexample readsoffline/tests/data/cartpole/cartpole-v1_large, which thedoctest()target already lists indata.:skipif: True. Each now sits in a docstring that carries the# doctest: +SKIP_EXAMPLEflag ([core] Add a docstring-level +SKIP_EXAMPLE doctest flag for render-only examples #66753). They're inBCConfig(2),CQLConfig, andIQLConfig(2).CI time. The seven runnable examples build an algorithm and call
train(). Each takes 5 to 22 seconds on CPU, so together they add about 90 seconds to the RLlibdoctest()target, which issize = "enormous". If that's too much, a docstring-level+SKIP_EXAMPLEkeeps any of them render-only.This is a syntax-only change. The example code and the claims in each docstring are unchanged, with two exceptions that the format forces:
algo.train()returns a results dict, and calls such asconfig.environment()andconfig.training()return the config, so a doctest would echo them. In the seven runnable examples, these now read_ = algo.train()and so on.__init__methods gain a one-line docstring. AnExamples:section makes pydoclint check the class docstrings ofBCConfig,CQLConfig,IQLConfig, andSACConfigagainst__init__(self, algo_class=None), and the RLlib baseline is empty. AnArgsentry alone doesn't pass, because pydoclint also requires type hints in the signature, and adding them would change code. Each__init__now has the docstring"""Initializes a <X>Config instance.""", which matchesDQNConfig,PPOConfig,APPOConfig,IMPALAConfig, andMARWILConfig.Left for a separate correctness PR
The second example in each of
IMPALAConfig,MARWILConfig,DQNConfig,PPOConfig, andAPPOConfigrunstune.Tuner(...).fit(). Tune prints its progress tables to stdout, so a doctest fails on the unexpected output. TheDQNConfig,PPOConfig, andAPPOConfigblocks hide this with atestoutputwhose body is only..., which matches anything.fit()doesn't raise when a trial fails, so those examples check nothing. They staytestcodehere and go to RLlib review as a correctness change.Converting the never-run examples also showed that all three are broken:
BCConfigandIQLConfigdata paths start with./rllib/, which no longer exists. Their builds fail without observation and action spaces, and theirTunercalls have no stop condition.CQLConfigbuilds on CartPole with no offline data.Related issues
Related to #66749, #66753, and #67753.
Additional information
Not a duplicate. I searched open PRs for RLlib
testcodeand doctest conversions, and none touches these docstrings.Tests run
These ran in a Python 3.12 virtualenv with
ray[rllib]==2.59.0,torch,tensorflow2.21, andpillow. The installed wheel doesn't includeoffline/tests/data. For these runs, thecartpole-v1_largedirectory was linked into the install, where thedoctest()target'sdataputs it.ci/ray_ci/doc/run_docstring_examples.pyon all 10 files: "7 docstring(s) run, 0 failed, 3 skipped, in 10 file(s)." All three skips are+SKIP_EXAMPLE.doctestpass over the same docstrings withELLIPSIS. Unlike the runner above, it fails on unexpected output, the way the RLlibdoctest()target does. All 7 runnable docstrings pass.ci/ray_ci/doc/check_docstring_only.py --base upstream/master: "10 file(s), docstrings only."pre-commit run --fileson all 10 files: all hooks pass, including pydoclint.The PR carries the
docstring-onlylabel. Its commit carries an@rtd-buildline for the Read the Docs preview.AI assistance (Claude Code) was used for this PR.
🤖 Generated with Claude Code