Repository navigation
[doc] Convert the doctest-wired Ray Core, Data, RLlib, Train, and observability pages to MyST - #66461
Conversation
doctest[rllib2] was the only target over rllib/getting-started.rst. It's tagged manual, so no premerge or postmerge step has run it since the hang its TODO describes, and nothing else references it. Its 15 testcode blocks had no testoutput, so they asserted nothing. The 12 visible blocks become display-only python code blocks. The three :hide: blocks were ppo.stop()-style cleanups that never rendered, so they go. doctest[rllib] keeps excluding the page. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Signed-off-by: Douglas Strodtman <[email protected]>
Format-only conversion. doctest[core]'s exclude entry moves to the .md, so the page stays out of the target. It carries no testcode. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Signed-off-by: Douglas Strodtman <[email protected]>
Format-only conversion. doctest[core]'s exclude entry moves to the .md. pytest-sphinx builds the same 17 examples from the .md as from the .rst. Two text-less `<url>`_ links become autolinks. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Signed-off-by: Douglas Strodtman <[email protected]>
Format-only conversion. The doctest_each exclude and doctest[data-gpu]'s files entry move to the .md. pytest-sphinx builds the same 7 examples from both. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Signed-off-by: Douglas Strodtman <[email protected]>
Format-only conversion. The doctest_each exclude and doctest[data-gpu]'s files entry move to the .md. pytest-sphinx builds the same 24 examples from both. The "When using" list keeps its definition-list structure through the deflist extension, as /en/master renders it. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Signed-off-by: Douglas Strodtman <[email protected]>
Format-only conversion. A title and a toctree. No BUILD entry names it. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Signed-off-by: Douglas Strodtman <[email protected]>
Format-only conversion. doctest[rllib]'s exclude entry moves to the .md, so no target collects the page. The comment-only new_api_stack.rst include renders nothing and is dropped, and the scheme-less gymnasium.farama.org link gains https://. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Signed-off-by: Douglas Strodtman <[email protected]>
Format-only conversion. The top-level doctest exclude entry moves to the .md. pytest-sphinx builds the same 16 examples from both. configure-manage-dashboard.md's relative link to cli-sdk.rst now points at the .md. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Signed-off-by: Douglas Strodtman <[email protected]>
Format-only conversion. The top-level doctest exclude entry moves to the .md. pytest-sphinx builds the same 3 examples from both. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Signed-off-by: Douglas Strodtman <[email protected]>
Format-only conversion. doctest[train]'s exclude entry moves to the .md. pytest-sphinx builds the same 2 examples from both. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Signed-off-by: Douglas Strodtman <[email protected]>
Format-only conversion. doctest[train]'s exclude and doctest[train-gpu]'s files entry move to the .md. pytest-sphinx builds the same 6 examples from both. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Signed-off-by: Douglas Strodtman <[email protected]>
Format-only conversion. doctest[train]'s exclude and doctest[train-gpu]'s files entry move to the .md. pytest-sphinx builds the same 10 examples from both. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Signed-off-by: Douglas Strodtman <[email protected]>
Whitespace-only reflow to one line per paragraph and list item, done with ray-soft-wrap. verify.py confirms non-whitespace bytes, rendered HTML, and idempotence for all 11 files. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Signed-off-by: Douglas Strodtman <[email protected]>
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Signed-off-by: Douglas Strodtman <[email protected]>
…er exist A glob exclude naming a missing file is silently a no-op, so these entries stopped applying when their files moved: - doctest[serve] excluded deploy-many-models/multi-app.md and production-guide/deploy-vm.md. They now live at serve/multi-app.md and serve/advanced-guides/deploy-vm.md, inside the target's glob again. Neither has testcode or a >>> prompt, so nothing runs from them either way. - The serve doc_code test excluded doc_code/llm/llm_yaml_config_example.py and doc_code/llm/qwen_example.py, which moved to source/llm/doc_code/serve/qwen/, outside that target's include. No change to what any target runs. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Signed-off-by: Douglas Strodtman <[email protected]>
MyST's replacements extension turns "(c)" into a copyright sign and ".." into an ellipsis, which docutils doesn't. Escape the two "(c)" list markers in handling-dependencies and the "etc.." in getting-started, so they render as on /en/master. handling-dependencies' "can't import the packages" heading had no label, and MyST slugifies its apostrophe differently from docutils. Add a target with the old slug so existing links to the section keep working. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Signed-off-by: Douglas Strodtman <[email protected]>
There was a problem hiding this comment.
Code Review
This pull request migrates multiple documentation files from reStructuredText (.rst) to MyST Markdown (.md) format and updates their corresponding build targets and cross-references. Feedback on the changes highlights two issues in the code snippets of the newly converted transforming-data.md file: a NameError where polars is used instead of its imported alias pl, and several bugs in a pandas feature normalization snippet where group.drop("target") is incorrectly called on rows instead of columns and causes subsequent type errors.
|
|
||
| def udf(table: pa.Table): | ||
| import polars as pl | ||
| df = polars.from_pyarrow(table) |
There was a problem hiding this comment.
Thanks. This is a real bug, but it predates this PR: the block has read polars.from_pyarrow since #58971 added it, and it isn't caught because the example never consumes ds, so the UDF never runs. This PR only converts the page from RST to MyST, so I'm leaving the code as it is on master and will get it fixed in a separate PR.
| def normalize_features(group: pd.DataFrame) -> pd.DataFrame: | ||
| target = group.drop("target") | ||
| group = (group - group.min()) / group.std() | ||
| group["target"] = target | ||
| return group |
There was a problem hiding this comment.
This pandas code block has several issues:
group.drop("target")defaults toaxis=0(rows), which will raise aKeyErrorsince "target" is a column. It should begroup.drop(columns=["target"])..drop()is not in-place, sogroupstill contains the non-numeric "target" column, which will cause aTypeErrorduring subtraction/division on the next line.- The variable
targetis assigned the features DataFrame, and then assigned back togroup["target"], which is incorrect.
Here is the corrected implementation.
| def normalize_features(group: pd.DataFrame) -> pd.DataFrame: | |
| target = group.drop("target") | |
| group = (group - group.min()) / group.std() | |
| group["target"] = target | |
| return group | |
| def normalize_features(group: pd.DataFrame) -> pd.DataFrame: | |
| target = group["target"] | |
| features = group.drop(columns=["target"]) | |
| normalized = (features - features.min()) / features.std() | |
| normalized["target"] = target | |
| return normalized |
There was a problem hiding this comment.
Thanks. The KeyError from group.drop("target") is real, but it predates this PR: the tab has read this way since #36162, and the doc test doesn't catch it because the example never consumes ds. This PR only converts the page from RST to MyST, so I'm leaving the code as it is on master and will get it fixed in a separate PR. (The target column in iris.csv is numeric, so the TypeError point doesn't apply.)
## Why are these changes needed? A style pass over the Ray Data guides ([#66418](#66418), [#66419](#66419), [#66420](#66420), [#66422](#66422), [#66461](#66461)) turned up code examples that are broken as written. They raise if you copy them, or they don't match what the surrounding text says. This PR fixes only those examples. It doesn't convert untested blocks to tests. | Page | Problem | Fix | |---|---|---| | `loading-data.md` | GCS example uses `gcsfs` without importing it. | Import it. | | `loading-data.md` | Azure example passes `filesystem` positionally, but it's keyword-only in `read_parquet` (`TypeError`). | Pass it by keyword. | | `loading-data.md` | BigQuery `dataset="bigquery-public-data.ml_datasets.iris"`. `BigQueryDatasource` reads `dataset` as `dataset_id.table_id` under `project_id`, so this resolves to dataset `bigquery-public-data`, table `ml_datasets`. | Use a `my_dataset.my_table` placeholder, and say the format in the comment. | | `loading-data.md` | `write_mongo` example passes an undefined `MongoDatasource()`, and `write_mongo` has no such parameter. | Remove it. | | `saving-data.md` | GCS and Azure examples use `gcsfs` and `adlfs` without importing them. | Import them. | | `inspecting-data.md` | Output shows `Image shape:`, but the print has no colon. | Add the colon to the print. | | `shuffling-data.md` | Key-based repartition on `id`, but `ds` is a `read_images` dataset with only `image`. It passed only because nothing consumed the dataset. Consumed, it raises `KeyError: Field "id" does not exist`. | Use `ray.data.range(1000)` and materialize. | | `key-concepts.md` | Streaming example uses undefined UDF names and `read_parquet(...)`, under a "1K rows" comment. | Define placeholder UDFs and use `ray.data.range(1000)`. | | `scaling-collation-functions.md` | Example reassigns `dataset` but passes `train_dataset` to the trainer. | Use `train_dataset` throughout. | | `transforming-data.md` | Polars example: imports `pl` but calls `polars.` (`NameError`). `from_pyarrow` and `DataFrame.summary` don't exist in Polars. The block never consumed `ds`, so the UDF never ran. | `pl.from_arrow`, `describe()`, and materialize. | | `transforming-data.md` | pandas `map_groups` example calls `group.drop("target")`, which drops rows by label and raises `KeyError`. | `group.pop("target")`, which sets the column aside as the code intends. Materialize. | ## Duplicate check Searched open PRs for each affected API and page (`polars from_pyarrow`, `map_groups`, `gcsfs`, `read_bigquery`, `write_mongo`, `repartition`, collation). Nothing open addresses these examples. [#66614](#66614) and [#66615](#66615) edited some of the same pages, but not these examples. Both have merged, and this branch is rebased on them. ## Testing Ran against the Ray nightly wheel (`3.0.0.dev0`, `674900c91fa`) on macOS arm64, using the same pytest arguments and Data doctest plugin as the `doctest_each` targets in `doc/BUILD.bazel`, with `pytest==7.4.4` and Ray's `pytest-sphinx` fork: ```bash python -m pytest --doctest-modules --doctest-glob='*.md' --disable-warnings -c NO_PYTEST_CONFIG \ -p doctest_pytest_plugin doc/source/data/<page>.md ``` - `loading-data.md`, `saving-data.md`, `inspecting-data.md`, `shuffling-data.md`, and `key-concepts.md` pass, before and after the change. - `transforming-data.md` is in `doctest[data-gpu]` and stops at a CUDA block on a host without a GPU, before and after. So I ran its Iris setup block and the two changed blocks as a standalone doctest file, and it passes. Before the fix, those blocks raise `NameError` and `KeyError` once the dataset is consumed. - `key-concepts.md` streaming and `scaling-collation-functions.md` are untested `python` blocks. I ran the streaming block with `num_gpus=1` removed, and it runs. The collation change is a rename, checked by reading. - The `:skipif: True` GCS, Azure, BigQuery, and MongoDB blocks need credentials, so I checked them against the current signatures in `read_api.py` and `dataset.py` and `bigquery_datasource.py`. - `pre-commit run` passes on the changed files. This change touches only `.md` files, so premerge doesn't run the Data doc example tests. ## AI assistance Claude Code helped find the source for each fix, apply the edits, and run the tests. I reviewed every changed line. 🤖 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]>
…m RST to MyST (#66673) ## Why are these changes needed? This PR converts the remaining prose pages under `ray-observability/`, `ray-more-libs/`, `ray-references/`, and `ray-air/` from reStructuredText to MyST Markdown. It continues the RST-to-MyST conversion that already landed for `ray-core/` (#66430), `data/` (#66375), and the doctest-wired pages (#66461). The conversion is format only: the goal is for each page's rendered HTML to match `/en/master`. There are five commits: 1. **Conversion.** This commit converts 25 pages, `git rm`s the `.rst` sources, and adds one `doc/BUILD.bazel` exclude, which commit 5 reverts. Prose keeps its source line wrapping, so the diff lines up with the `.rst` line by line. 2. **Soft-wrap.** This commit reflows whitespace only, to one line per paragraph and list item. `verify.py` from `ray-soft-wrap` confirms that the non-whitespace bytes and the rendered HTML don't change on all 25 files. 3. **Render fixes.** This commit fixes six regressions that the render diff against `/en/master` caught, even though the build was green. In `modin`, two bare-word RST link references (`Modin_`, `documentation_`) rendered as literal text. In `getting-started`, a bold URL was autolinked. In `system-metrics`, a URL in a table cell lost its link. In `dask-on-ray`, `_not_` rendered as italics. In `glossary`, the inline `.. TODO: RLlib` text, which `/en/master` shows, had become a comment. The commit also adds compat anchors to five headings with apostrophes (see below). 4. **Pseudo-lists.** This commit restores three pseudo-lists that the soft-wrap merged into one line. 5. **Review feedback.** This commit removes the glossary's placeholder TODO entries, reverts the `doc/BUILD.bazel` change so the PR stays docs-only, and fixes defects that the review flagged in the `.rst` sources: a stray definition list in `dask-on-ray`, an unconverted link in `system-metrics`, an extra parenthesis in `debug-failures`, typos in `debug-hangs` and `optimize-performance`, a grammar slip in `ray-debugging`, and em-dash pseudo-list items in `general-debugging`, which are now a bulleted list. ### Scope - `ray-air/`: `getting-started` and `deployment`, converted together. `getting-started` includes `deployment`, and the include now points at `deployment.md`. - `ray-observability/`: 14 pages, including `user-guides/debug-apps/` and `reference/system-metrics`. - `ray-more-libs/`: 9 pages. - `ray-references/`: `glossary` and `faq`. **Left as RST:** `ray-observability/reference/api.rst` (`autosummary`) and `ray-observability/reference/cli.rst` (`click`). They're API reference pages, so they stay RST along with the other `*/api/` reference trees. ### Construct notes for reviewers - **Glossary.** The glossary is a native MyST `{glossary}` directive, not RST wrapped in `{eval-rst}`. Sphinx's `glossary` directive parses each definition with the host parser, so the definitions are Markdown now. The glossary's placeholder `.. TODO:` entries are removed. Missing terms can be identified separately. - **Glossary doctest.** Nothing ran the glossary's `.. doctest::` block as `.rst`: `pytest-sphinx` doesn't execute `doctest` sections, and `--doctest-glob='*.md'` doesn't match `.rst`. As `.md`, the stock doctest parser would start running its five `>>>` prompts, and the `[[0],[1],...,[3],[4]]` output can't pass without `ELLIPSIS`. Each prompt now carries `# doctest: +SKIP`, which keeps coverage the same as master without a `doc/BUILD.bazel` change. Sphinx's default `trim_doctest_flags` strips the flag from the rendered page, as in `data/working-with-tensors.md`. If you'd rather fix the expected output and start testing it, I can do that in a follow-up. - **FAQ.** `faq.md` includes `_includes/_help-links.md`, the Markdown copy of `_help.rst` that #66417 added. `_help.rst` stays, because `cluster/vms/user-guides/community/yarn.rst` and `tune/key-concepts.rst` still include it. - **Comparison table.** The grid table in `ray-collective-custom-backend` is now a native `{list-table}`. - **Line blocks.** The line blocks in `dask-on-ray`'s version table are now Markdown hard line breaks. This is an expected render difference: `<p>` with `<br>` instead of `div.line-block`. ### Dead links fixed on the way These links were broken on `/en/master` and fail `fail_on_warning` when they're transcribed into MyST: - `joblib` and `multiprocessing` linked to relative `actors.html` and `installation.html`, which resolve under `ray-more-libs/` and return 404. They now link to `{doc}` `/ray-core/actors` and `/ray-overview/installation`. - `ray-collective` linked to `#api-reference`, but the heading's anchor is `#api-references`. ### Open PRs that edit these pages Each of these PRs needs to move its change onto the `.md` file: #66363 (`ray-event-export`), #65693 and #65583 (`system-metrics`), and #64957 (`joblib`, `multiprocessing`). #65321 edits `reference/cli.rst`, which this PR doesn't convert. ## Related issue number None. ## Checks - [x] I've signed off every commit (`git commit -s`). - [x] Duplicate check: no open PR converts these pages. I searched open PRs for MyST, observability, glossary, and more-libs, and for open PRs that edit these files. - **Doctest parity:** `doctest_parity.py` (the `pytest-sphinx` parser, run against `upstream/master`) reports the same sections and examples on all 25 pages, before and after the soft-wrap: 12 examples before, 12 after. - **Local doctest:** `pytest --doctest-modules --doctest-glob='*.md' -c NO_PYTEST_CONFIG -p doctest_pytest_plugin` on the 24 converted pages in the main target, with Ray nightly `bc900c2` on Python 3.10: 5 passed. Those are the 5 files with examples. The glossary, now in the target too, reports 1 skipped: the stock parser finds 5 examples and all 5 carry `+SKIP`. - **Static checks:** frontmatter parses, fences balance, every label is preserved, and there's no leftover RST outside fences or directives. - **RtD preview:** green under `fail_on_warning` on all three commits. - **Render diff** (`render_diff.py`, preview against `/en/master`, filtering the two class-only differences every MyST page shows): 11 of 25 pages are identical. Every difference on the other 14 is one of these: - RST comments now emit `<!-- ... -->` HTML comments, which readers don't see. Pages: `ray-air/*`, `ray-more-libs/index`, `ray-collective`, `getting-started`, `general-debugging`, `glossary`. - The `dask-on-ray` version table: Markdown hard line breaks (`<p>` with `<br>`) replace RST line blocks (`div.line-block`). - The `dask-on-ray` "Why use Dask on Ray?" item keeps its definition-list structure. MyST adds a `myst` class to the `<dl>`, and the class has no styling. - Same-page fragment and `{doc}` links render as `reference internal` instead of `reference external`. Pages: `ray-collective`, `joblib`, `multiprocessing`. This list also includes the dead links fixed above. - Headings with an apostrophe get a new anchor, because MyST drops the apostrophe where docutils turned it into a hyphen. For example, `#what-s-the-out-of-memory-error` becomes `#whats-the-out-of-memory-error`. Five of these headings had no label, so each gets a compat target with the old slug, which keeps existing links working. The sixth, in `optimize-performance`, already carries the `dashboard-cprofile` label. This PR was written with AI assistance (Claude Code). I reviewed the changes and ran the checks above. 🤖 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]>
…ervability pages to MyST (ray-project#66461) ## Why are these changes needed? Converts the last non-API-reference RST pages under `ray-core/`, `data/`, and `rllib/` to MyST Markdown, plus the `train/` and `ray-observability/` pages that `doc/BUILD.bazel` names by path. The API reference trees (`*/api/`, `rllib/package_ref/`, and `ray-core/compiled-graph/compiled-graph-api`) stay RST for now. Each page gets its own commit, so you can review one file at a time. Every commit renames the page's literal `.rst` paths in `doc/BUILD.bazel` to `.md`. These paths are in `exclude` lists and in the explicit `files` lists of `doctest[data-gpu]` and `doctest[train-gpu]`, and they don't glob. Without the edit, an excluded page would silently join its target once it's `.md`, and an included page would silently drop out of it. Conversions are format-only: labels, headings, and prose are unchanged. A final whitespace-only commit soft-wraps the prose. `ray-soft-wrap`'s `verify.py` confirms non-whitespace bytes, rendered HTML, and idempotence for all 11 files. ### `rllib/getting-started`: doctest target removed The first commit deletes `doctest[rllib2]`, the only target over `rllib/getting-started.rst`, before the page converts. The target is tagged `manual` with a hang TODO, so no premerge or postmerge step has run it, and nothing else references it (`git grep rllib2` is empty). Its 15 `testcode` blocks had no `testoutput`, so they asserted nothing. The 12 visible blocks become display-only `python` code blocks. The three `:hide:` blocks held `.stop()` cleanups that never rendered, so they're deleted. `doctest[rllib]` still excludes the page. If these examples should be validated later, a `doc_code/` script is the better route than reviving the hanging target. cc @elliot-barn, who owns the TODO. This commit isn't buildable on its own. It turns a `.. testcode::` that had no blank line before its body into a `.. code-block:: python`, still with no blank line, and docutils reads the body as extra arguments to the directive. The later conversion commit fixes it in the `.md`, and a squash merge never puts the intermediate commit on master. ### Doctest coverage Docs-only PRs don't run doctests premerge. This PR edits `doc/BUILD.bazel`, so every library's docs example step runs, but premerge can't show the conversion kept the same blocks. For that, I parsed each `.md` and the `.rst` it replaced with Ray's `pytest-sphinx` fork, the same parser the doctest macro runs, and asserted identical sections (directive, body, `:options:`, `:skipif:`) and examples. | Page | BUILD role | Examples before → after | | --- | --- | --- | | `ray-core/handling-dependencies` | `doctest[core]` exclude | 17 → 17 | | `ray-core/tasks/nested-tasks` | `doctest[core]` exclude | 0 → 0 (`literalinclude` of a tested `doc_code/` file) | | `data/batch-inference` | `doctest_each` exclude, `doctest[data-gpu]` files | 7 → 7 | | `data/transforming-data` | `doctest_each` exclude, `doctest[data-gpu]` files | 24 → 24 | | `data/contributing/contributing` | `doctest_each` glob | 0 → 0 (toctree only) | | `rllib/getting-started` | `doctest[rllib]` exclude, `doctest[rllib2]` removed | 15 → 0, by the removal commit | | `ray-observability/user-guides/cli-sdk` | top-level exclude | 16 → 16 | | `ray-observability/user-guides/ray-tracing` | top-level exclude | 3 → 3 | | `train/horovod` | `doctest[train]` exclude | 2 → 2 | | `train/user-guides/data-loading-preprocessing` | `doctest[train]` exclude, `doctest[train-gpu]` files | 6 → 6 | | `train/user-guides/using-accelerators` | `doctest[train]` exclude, `doctest[train-gpu]` files | 10 → 10 | To show the check would catch a broken conversion, I mutated each page with examples three ways: dropping a `testcode` block, altering a line in one, and turning one into a four-backtick fence. The last renders fine but is never collected. The check failed on all 24 mutations. ### Rendering changes I ran `render_diff.py` on all 11 pages against `/en/master`. Six render identically: `nested-tasks`, `data/contributing/contributing`, `cli-sdk`, `ray-tracing`, `horovod`, and `using-accelerators`. Every difference on the other five is listed here. - `rllib/getting-started`: on master, one `.. testcode::` line had no blank line after it. docutils read the block's first six lines, the `best_result = results.get_best_result(...)` call, as the directive's argument and dropped them. So master shows code that uses `best_result` without showing where it comes from. The converted page renders all six lines. This is the one place the conversion deliberately doesn't reproduce master. - `rllib/getting-started`: the "Farama gymnasium" link now has `https://`. On master it's a relative link to `gymnasium.farama.org` that 404s. - `ray-core/handling-dependencies`: MyST drops the apostrophe when it slugifies the "can't import the packages" heading, so the section id changes. That heading had no label, so the page adds a target carrying the old docutils slug, and existing `#...-can-t-import-...` links still resolve. An auto-numbered span id, which nothing links to, also changes from `id4` to `id2`. - `data/batch-inference` and `train/user-guides/data-loading-preprocessing`: each renders an RST comment as an HTML comment, which readers never see. - `data/transforming-data`: the "When using" definition list's `<dl>` gains the unstyled `myst` class. The first preview diff also caught three regressions that the green build didn't. MyST's `replacements` extension turned two `(c)` list markers into `©` and an `etc..` into `etc…`. The anchor above had changed too. A follow-up commit fixes all three. A sweep of the 11 pages found no other text that extension rewrites. ### Dead `doc/BUILD.bazel` excludes A final commit drops four `exclude` entries that name files that have moved: two in `doctest[serve]` and two in the serve `doc_code` test. A glob exclude naming a missing file excludes nothing, so these had silently stopped applying. This doesn't change what any target runs. ray-project#66462 carries the same commit, along with a lint check that fails on this class of stale path, so the two PRs merge cleanly in either order. ### Open PRs that edit these files Each of these open PRs edits one of the converted `.rst` files, so each will need to move its change to the `.md`: ray-project#66279, ray-project#66191, ray-project#65956, ray-project#65933, and ray-project#65830 (`handling-dependencies`), ray-project#65693 (`cli-sdk`), and ray-project#66419, ray-project#66420, ray-project#66422, and ray-project#66423 (`data/batch-inference`, `train/user-guides/data-loading-preprocessing`). ray-project#66096, ray-project#64053, and ray-project#63881 also edit `doc/BUILD.bazel`, and only ray-project#66096 edits nearby lines. ## Related issue number None. No open PR converts these pages. I checked `gh pr list` for open PRs touching each file. ## Checks - [x] I've signed off every commit (`git commit -s`). - [x] Pre-commit hooks passed on every commit. - Doctest parity: `python3 doctest_parity.py <the 11 .md files>` with `pytest==7.4.4` and `pytest-sphinx @ git+https://github.com/ray-project/pytest-sphinx`. All OK, run again after the soft-wrap commit. - Static checks on every `.md`: fences balance, no leftover RST roles or directives, every label from the `.rst` is present, and directive counts match. - Read the Docs preview builds green under `fail_on_warning`, and the render diff against `/en/master` is in Rendering changes. The first build hit the known autosummary-import segfault and passed on rebuild. - Local doctest run: not done. The GPU targets need hardware, and the CPU targets run in this PR's premerge because of the `BUILD.bazel` change. AI assistance (Claude Code) was used for the conversion and the verification scripts. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Signed-off-by: Douglas Strodtman <[email protected]> Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
…ect#66636) ## Why are these changes needed? A style pass over the Ray Data guides ([ray-project#66418](ray-project#66418), [ray-project#66419](ray-project#66419), [ray-project#66420](ray-project#66420), [ray-project#66422](ray-project#66422), [ray-project#66461](ray-project#66461)) turned up code examples that are broken as written. They raise if you copy them, or they don't match what the surrounding text says. This PR fixes only those examples. It doesn't convert untested blocks to tests. | Page | Problem | Fix | |---|---|---| | `loading-data.md` | GCS example uses `gcsfs` without importing it. | Import it. | | `loading-data.md` | Azure example passes `filesystem` positionally, but it's keyword-only in `read_parquet` (`TypeError`). | Pass it by keyword. | | `loading-data.md` | BigQuery `dataset="bigquery-public-data.ml_datasets.iris"`. `BigQueryDatasource` reads `dataset` as `dataset_id.table_id` under `project_id`, so this resolves to dataset `bigquery-public-data`, table `ml_datasets`. | Use a `my_dataset.my_table` placeholder, and say the format in the comment. | | `loading-data.md` | `write_mongo` example passes an undefined `MongoDatasource()`, and `write_mongo` has no such parameter. | Remove it. | | `saving-data.md` | GCS and Azure examples use `gcsfs` and `adlfs` without importing them. | Import them. | | `inspecting-data.md` | Output shows `Image shape:`, but the print has no colon. | Add the colon to the print. | | `shuffling-data.md` | Key-based repartition on `id`, but `ds` is a `read_images` dataset with only `image`. It passed only because nothing consumed the dataset. Consumed, it raises `KeyError: Field "id" does not exist`. | Use `ray.data.range(1000)` and materialize. | | `key-concepts.md` | Streaming example uses undefined UDF names and `read_parquet(...)`, under a "1K rows" comment. | Define placeholder UDFs and use `ray.data.range(1000)`. | | `scaling-collation-functions.md` | Example reassigns `dataset` but passes `train_dataset` to the trainer. | Use `train_dataset` throughout. | | `transforming-data.md` | Polars example: imports `pl` but calls `polars.` (`NameError`). `from_pyarrow` and `DataFrame.summary` don't exist in Polars. The block never consumed `ds`, so the UDF never ran. | `pl.from_arrow`, `describe()`, and materialize. | | `transforming-data.md` | pandas `map_groups` example calls `group.drop("target")`, which drops rows by label and raises `KeyError`. | `group.pop("target")`, which sets the column aside as the code intends. Materialize. | ## Duplicate check Searched open PRs for each affected API and page (`polars from_pyarrow`, `map_groups`, `gcsfs`, `read_bigquery`, `write_mongo`, `repartition`, collation). Nothing open addresses these examples. [ray-project#66614](ray-project#66614) and [ray-project#66615](ray-project#66615) edited some of the same pages, but not these examples. Both have merged, and this branch is rebased on them. ## Testing Ran against the Ray nightly wheel (`3.0.0.dev0`, `674900c91fa`) on macOS arm64, using the same pytest arguments and Data doctest plugin as the `doctest_each` targets in `doc/BUILD.bazel`, with `pytest==7.4.4` and Ray's `pytest-sphinx` fork: ```bash python -m pytest --doctest-modules --doctest-glob='*.md' --disable-warnings -c NO_PYTEST_CONFIG \ -p doctest_pytest_plugin doc/source/data/<page>.md ``` - `loading-data.md`, `saving-data.md`, `inspecting-data.md`, `shuffling-data.md`, and `key-concepts.md` pass, before and after the change. - `transforming-data.md` is in `doctest[data-gpu]` and stops at a CUDA block on a host without a GPU, before and after. So I ran its Iris setup block and the two changed blocks as a standalone doctest file, and it passes. Before the fix, those blocks raise `NameError` and `KeyError` once the dataset is consumed. - `key-concepts.md` streaming and `scaling-collation-functions.md` are untested `python` blocks. I ran the streaming block with `num_gpus=1` removed, and it runs. The collation change is a rename, checked by reading. - The `:skipif: True` GCS, Azure, BigQuery, and MongoDB blocks need credentials, so I checked them against the current signatures in `read_api.py` and `dataset.py` and `bigquery_datasource.py`. - `pre-commit run` passes on the changed files. This change touches only `.md` files, so premerge doesn't run the Data doc example tests. ## AI assistance Claude Code helped find the source for each fix, apply the edits, and run the tests. I reviewed every changed line. 🤖 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]>
…m RST to MyST (ray-project#66673) ## Why are these changes needed? This PR converts the remaining prose pages under `ray-observability/`, `ray-more-libs/`, `ray-references/`, and `ray-air/` from reStructuredText to MyST Markdown. It continues the RST-to-MyST conversion that already landed for `ray-core/` (ray-project#66430), `data/` (ray-project#66375), and the doctest-wired pages (ray-project#66461). The conversion is format only: the goal is for each page's rendered HTML to match `/en/master`. There are five commits: 1. **Conversion.** This commit converts 25 pages, `git rm`s the `.rst` sources, and adds one `doc/BUILD.bazel` exclude, which commit 5 reverts. Prose keeps its source line wrapping, so the diff lines up with the `.rst` line by line. 2. **Soft-wrap.** This commit reflows whitespace only, to one line per paragraph and list item. `verify.py` from `ray-soft-wrap` confirms that the non-whitespace bytes and the rendered HTML don't change on all 25 files. 3. **Render fixes.** This commit fixes six regressions that the render diff against `/en/master` caught, even though the build was green. In `modin`, two bare-word RST link references (`Modin_`, `documentation_`) rendered as literal text. In `getting-started`, a bold URL was autolinked. In `system-metrics`, a URL in a table cell lost its link. In `dask-on-ray`, `_not_` rendered as italics. In `glossary`, the inline `.. TODO: RLlib` text, which `/en/master` shows, had become a comment. The commit also adds compat anchors to five headings with apostrophes (see below). 4. **Pseudo-lists.** This commit restores three pseudo-lists that the soft-wrap merged into one line. 5. **Review feedback.** This commit removes the glossary's placeholder TODO entries, reverts the `doc/BUILD.bazel` change so the PR stays docs-only, and fixes defects that the review flagged in the `.rst` sources: a stray definition list in `dask-on-ray`, an unconverted link in `system-metrics`, an extra parenthesis in `debug-failures`, typos in `debug-hangs` and `optimize-performance`, a grammar slip in `ray-debugging`, and em-dash pseudo-list items in `general-debugging`, which are now a bulleted list. ### Scope - `ray-air/`: `getting-started` and `deployment`, converted together. `getting-started` includes `deployment`, and the include now points at `deployment.md`. - `ray-observability/`: 14 pages, including `user-guides/debug-apps/` and `reference/system-metrics`. - `ray-more-libs/`: 9 pages. - `ray-references/`: `glossary` and `faq`. **Left as RST:** `ray-observability/reference/api.rst` (`autosummary`) and `ray-observability/reference/cli.rst` (`click`). They're API reference pages, so they stay RST along with the other `*/api/` reference trees. ### Construct notes for reviewers - **Glossary.** The glossary is a native MyST `{glossary}` directive, not RST wrapped in `{eval-rst}`. Sphinx's `glossary` directive parses each definition with the host parser, so the definitions are Markdown now. The glossary's placeholder `.. TODO:` entries are removed. Missing terms can be identified separately. - **Glossary doctest.** Nothing ran the glossary's `.. doctest::` block as `.rst`: `pytest-sphinx` doesn't execute `doctest` sections, and `--doctest-glob='*.md'` doesn't match `.rst`. As `.md`, the stock doctest parser would start running its five `>>>` prompts, and the `[[0],[1],...,[3],[4]]` output can't pass without `ELLIPSIS`. Each prompt now carries `# doctest: +SKIP`, which keeps coverage the same as master without a `doc/BUILD.bazel` change. Sphinx's default `trim_doctest_flags` strips the flag from the rendered page, as in `data/working-with-tensors.md`. If you'd rather fix the expected output and start testing it, I can do that in a follow-up. - **FAQ.** `faq.md` includes `_includes/_help-links.md`, the Markdown copy of `_help.rst` that ray-project#66417 added. `_help.rst` stays, because `cluster/vms/user-guides/community/yarn.rst` and `tune/key-concepts.rst` still include it. - **Comparison table.** The grid table in `ray-collective-custom-backend` is now a native `{list-table}`. - **Line blocks.** The line blocks in `dask-on-ray`'s version table are now Markdown hard line breaks. This is an expected render difference: `<p>` with `<br>` instead of `div.line-block`. ### Dead links fixed on the way These links were broken on `/en/master` and fail `fail_on_warning` when they're transcribed into MyST: - `joblib` and `multiprocessing` linked to relative `actors.html` and `installation.html`, which resolve under `ray-more-libs/` and return 404. They now link to `{doc}` `/ray-core/actors` and `/ray-overview/installation`. - `ray-collective` linked to `#api-reference`, but the heading's anchor is `#api-references`. ### Open PRs that edit these pages Each of these PRs needs to move its change onto the `.md` file: ray-project#66363 (`ray-event-export`), ray-project#65693 and ray-project#65583 (`system-metrics`), and ray-project#64957 (`joblib`, `multiprocessing`). ray-project#65321 edits `reference/cli.rst`, which this PR doesn't convert. ## Related issue number None. ## Checks - [x] I've signed off every commit (`git commit -s`). - [x] Duplicate check: no open PR converts these pages. I searched open PRs for MyST, observability, glossary, and more-libs, and for open PRs that edit these files. - **Doctest parity:** `doctest_parity.py` (the `pytest-sphinx` parser, run against `upstream/master`) reports the same sections and examples on all 25 pages, before and after the soft-wrap: 12 examples before, 12 after. - **Local doctest:** `pytest --doctest-modules --doctest-glob='*.md' -c NO_PYTEST_CONFIG -p doctest_pytest_plugin` on the 24 converted pages in the main target, with Ray nightly `bc900c2` on Python 3.10: 5 passed. Those are the 5 files with examples. The glossary, now in the target too, reports 1 skipped: the stock parser finds 5 examples and all 5 carry `+SKIP`. - **Static checks:** frontmatter parses, fences balance, every label is preserved, and there's no leftover RST outside fences or directives. - **RtD preview:** green under `fail_on_warning` on all three commits. - **Render diff** (`render_diff.py`, preview against `/en/master`, filtering the two class-only differences every MyST page shows): 11 of 25 pages are identical. Every difference on the other 14 is one of these: - RST comments now emit `<!-- ... -->` HTML comments, which readers don't see. Pages: `ray-air/*`, `ray-more-libs/index`, `ray-collective`, `getting-started`, `general-debugging`, `glossary`. - The `dask-on-ray` version table: Markdown hard line breaks (`<p>` with `<br>`) replace RST line blocks (`div.line-block`). - The `dask-on-ray` "Why use Dask on Ray?" item keeps its definition-list structure. MyST adds a `myst` class to the `<dl>`, and the class has no styling. - Same-page fragment and `{doc}` links render as `reference internal` instead of `reference external`. Pages: `ray-collective`, `joblib`, `multiprocessing`. This list also includes the dead links fixed above. - Headings with an apostrophe get a new anchor, because MyST drops the apostrophe where docutils turned it into a hyphen. For example, `#what-s-the-out-of-memory-error` becomes `#whats-the-out-of-memory-error`. Five of these headings had no label, so each gets a compat target with the old slug, which keeps existing links working. The sixth, in `optimize-performance`, already carries the `dashboard-cprofile` label. This PR was written with AI assistance (Claude Code). I reviewed the changes and ran the checks above. 🤖 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 Adds a caution to the `uv run` section of the runtime environments page: don't set `py_executable` to a bare `uv run` to enable the uv integration. When the driver is launched with `uv run`, Ray sets `py_executable` itself. A bare `uv run` starts workers in whatever environment uv resolves from the worker's starting directory, and if that environment lacks Ray, workers crash on startup and jobs hang without a clear error. @martinlhw, this is a docs-only alternative to #66191, which you're assigned to. Your question on that PR, whether bare `uv run` always fails, turned out to be the deciding one: it doesn't. Results on Ray 2.59.0 with uv 0.11.14, macOS, local cluster: | Setup | Result | |---|---| | Plain `python` driver outside any uv project, `py_executable="uv run"` | Workers crash with `ModuleNotFoundError: No module named 'ray'`; `ray.get` times out | | Plain `python` driver inside a uv project that depends on Ray | Works | | Driver launched with `uv run` | Works, because the uv hook overwrites `py_executable` | | `JobSubmissionClient.submit_job` with `py_executable="uv run"`, cluster started inside a uv project | `SUCCEEDED`, with and without `working_dir` | | Same submission, cluster started outside a uv project | Stuck in `PENDING` (reproduces #54275) | Because the bare value works in some setups, rejecting it with a `ValueError` as #66191 does would break working configurations, including per-task `runtime_env` usage that the uv hook never rewrites. The failure is also the same one any `py_executable` pointing at a Python without Ray produces, so a string match on `uv run` covers only one case of it. A docs caution addresses what the issue reporter asked for at minimum, "noting in the docs specifically that `py_executable` shouldn't be provided." If Core wants a runtime guard too, a warning rather than an error seems like the safer shape, and it can land separately. ## Related issues Addresses #54275. Supersedes #66191, which conflicts with master: its `local://` changes landed separately in #65245, and the page it edits moved to MyST in #66461. ## Additional information - Duplicate check: #66191 is the only open PR referencing #54275, and none of the open `py_executable` or uv PRs touch this guidance. - Tests: prose-only change. Vale reports no findings on the added lines, and pre-commit passes. The behavior described is from the local runs in the table above. - AI assistance: Claude Code drafted this change and ran the tests above. I reviewed every line. 🤖 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]>
Why are these changes needed?
Converts the last non-API-reference RST pages under
ray-core/,data/, andrllib/to MyST Markdown, plus thetrain/andray-observability/pages thatdoc/BUILD.bazelnames by path. The API reference trees (*/api/,rllib/package_ref/, andray-core/compiled-graph/compiled-graph-api) stay RST for now.Each page gets its own commit, so you can review one file at a time. Every commit renames the page's literal
.rstpaths indoc/BUILD.bazelto.md. These paths are inexcludelists and in the explicitfileslists ofdoctest[data-gpu]anddoctest[train-gpu], and they don't glob. Without the edit, an excluded page would silently join its target once it's.md, and an included page would silently drop out of it.Conversions are format-only: labels, headings, and prose are unchanged. A final whitespace-only commit soft-wraps the prose.
ray-soft-wrap'sverify.pyconfirms non-whitespace bytes, rendered HTML, and idempotence for all 11 files.rllib/getting-started: doctest target removedThe first commit deletes
doctest[rllib2], the only target overrllib/getting-started.rst, before the page converts. The target is taggedmanualwith a hang TODO, so no premerge or postmerge step has run it, and nothing else references it (git grep rllib2is empty). Its 15testcodeblocks had notestoutput, so they asserted nothing. The 12 visible blocks become display-onlypythoncode blocks. The three:hide:blocks held.stop()cleanups that never rendered, so they're deleted.doctest[rllib]still excludes the page. If these examples should be validated later, adoc_code/script is the better route than reviving the hanging target. cc @elliot-barn, who owns the TODO.This commit isn't buildable on its own. It turns a
.. testcode::that had no blank line before its body into a.. code-block:: python, still with no blank line, and docutils reads the body as extra arguments to the directive. The later conversion commit fixes it in the.md, and a squash merge never puts the intermediate commit on master.Doctest coverage
Docs-only PRs don't run doctests premerge. This PR edits
doc/BUILD.bazel, so every library's docs example step runs, but premerge can't show the conversion kept the same blocks. For that, I parsed each.mdand the.rstit replaced with Ray'spytest-sphinxfork, the same parser the doctest macro runs, and asserted identical sections (directive, body,:options:,:skipif:) and examples.ray-core/handling-dependenciesdoctest[core]excluderay-core/tasks/nested-tasksdoctest[core]excludeliteralincludeof a testeddoc_code/file)data/batch-inferencedoctest_eachexclude,doctest[data-gpu]filesdata/transforming-datadoctest_eachexclude,doctest[data-gpu]filesdata/contributing/contributingdoctest_eachglobrllib/getting-starteddoctest[rllib]exclude,doctest[rllib2]removedray-observability/user-guides/cli-sdkray-observability/user-guides/ray-tracingtrain/horovoddoctest[train]excludetrain/user-guides/data-loading-preprocessingdoctest[train]exclude,doctest[train-gpu]filestrain/user-guides/using-acceleratorsdoctest[train]exclude,doctest[train-gpu]filesTo show the check would catch a broken conversion, I mutated each page with examples three ways: dropping a
testcodeblock, altering a line in one, and turning one into a four-backtick fence. The last renders fine but is never collected. The check failed on all 24 mutations.Rendering changes
I ran
render_diff.pyon all 11 pages against/en/master. Six render identically:nested-tasks,data/contributing/contributing,cli-sdk,ray-tracing,horovod, andusing-accelerators. Every difference on the other five is listed here.rllib/getting-started: on master, one.. testcode::line had no blank line after it. docutils read the block's first six lines, thebest_result = results.get_best_result(...)call, as the directive's argument and dropped them. So master shows code that usesbest_resultwithout showing where it comes from. The converted page renders all six lines. This is the one place the conversion deliberately doesn't reproduce master.rllib/getting-started: the "Farama gymnasium" link now hashttps://. On master it's a relative link togymnasium.farama.orgthat 404s.ray-core/handling-dependencies: MyST drops the apostrophe when it slugifies the "can't import the packages" heading, so the section id changes. That heading had no label, so the page adds a target carrying the old docutils slug, and existing#...-can-t-import-...links still resolve. An auto-numbered span id, which nothing links to, also changes fromid4toid2.data/batch-inferenceandtrain/user-guides/data-loading-preprocessing: each renders an RST comment as an HTML comment, which readers never see.data/transforming-data: the "When using" definition list's<dl>gains the unstyledmystclass.The first preview diff also caught three regressions that the green build didn't. MyST's
replacementsextension turned two(c)list markers into©and anetc..intoetc…. The anchor above had changed too. A follow-up commit fixes all three. A sweep of the 11 pages found no other text that extension rewrites.Dead
doc/BUILD.bazelexcludesA final commit drops four
excludeentries that name files that have moved: two indoctest[serve]and two in the servedoc_codetest. A glob exclude naming a missing file excludes nothing, so these had silently stopped applying. This doesn't change what any target runs. #66462 carries the same commit, along with a lint check that fails on this class of stale path, so the two PRs merge cleanly in either order.Open PRs that edit these files
Each of these open PRs edits one of the converted
.rstfiles, so each will need to move its change to the.md: #66279, #66191, #65956, #65933, and #65830 (handling-dependencies), #65693 (cli-sdk), and #66419, #66420, #66422, and #66423 (data/batch-inference,train/user-guides/data-loading-preprocessing). #66096, #64053, and #63881 also editdoc/BUILD.bazel, and only #66096 edits nearby lines.Related issue number
None. No open PR converts these pages. I checked
gh pr listfor open PRs touching each file.Checks
git commit -s).python3 doctest_parity.py <the 11 .md files>withpytest==7.4.4andpytest-sphinx @ git+https://github.com/ray-project/pytest-sphinx. All OK, run again after the soft-wrap commit..md: fences balance, no leftover RST roles or directives, every label from the.rstis present, and directive counts match.fail_on_warning, and the render diff against/en/masteris in Rendering changes. The first build hit the known autosummary-import segfault and passed on rebuild.BUILD.bazelchange.AI assistance (Claude Code) was used for the conversion and the verification scripts.
🤖 Generated with Claude Code