Skip to content

[doc][data] Clean up markup, links, and structure in the Ray Data docs - #66615

Merged
dstrodtman merged 2 commits into
masterfrom
doc-1717-ray-data-cleanup
Oct 1, 2026
Merged

dstrodtman merged 2 commits into
masterfrom
doc-1717-ray-data-cleanup

Conversation

@dstrodtman

Copy link
Copy Markdown
Contributor

Why are these changes needed?

The Ray Data style-pass PRs (#66413, #66418, #66419, #66420, #66422, #66423) left a set of mechanical and structural items open. This PR clears them. None of the edits changes a technical claim, so it needs a style review rather than an SME review.

Markup and links

  • key-concepts.md: tags the two logical-plan output blocks as text, and adds alt text to the three diagrams.
  • index.md, shuffling-data.md: removes $ prompts from shell blocks.
  • aggregating-data.md, iterating-over-data.md: uses {meth} instead of {class} for Dataset.max, min, sum, and random_shuffle.
  • aggregating-data.md: drops the trailing slash from the blog link fragment #performance-benchmarks/.
  • train/getting-started-lightgbm.rst, train/getting-started-xgboost.rst, and two Lightning example notebooks: replaces the hard-coded "Ray Data Quickstart" link text with a bare reference, so the link renders the page title.
  • loading-data.md: moves the (reading_kafka)= label above the Kafka heading, stacked with (reading-from-kafka)=.

Structure and wording

  • quickstart.md: replaces the opening bullet list, which restated the section headings, with one sentence that keeps the section links.
  • custom-datasource-example.md: renames the two "Implement the constructor" headings to "Implement the datasource constructor" and "Implement the datasink constructor". Nothing links to the old anchors.
  • loading-data.md: moves the Iceberg tab from the distributed DataFrame libraries tab set to the "Read files" tab set, since Iceberg is a data format rather than a DataFrame library. The tab content is unchanged.
  • loading-data.md: drops the unsourced "most popular PostgreSQL database connector" claim.
  • loading-data.md: the Hugging Face paragraph now leads with the token, which the example uses, and presents HfFileSystem() without a token as the fallback for public datasets. See the #66419 review thread.
  • working-with-llms.md: moves the usage-data note out from under the NIXL troubleshooting heading into its own closing section.
  • working-with-pytorch.md: drops the torchaudio mention, since the section has no torchaudio example.
  • index.md: "what Datasets are" becomes "what a Dataset is", matching the class that the linked key-concepts page defines.

For reviewers

  • Please confirm the diagram alt text in key-concepts.md. I wrote it from what each diagram shows.
  • [Data] Document how to configure an Iceberg REST catalog #66192 adds a REST-catalog example inside the Iceberg tab that this PR moves. Whichever PR merges second needs a small rebase: the added content moves with the tab, and its ::: fences become ::::.

Related issue number

None. This isn't a duplicate: the items come from reviewing the merged style-pass PRs above, and I searched open PRs touching doc/source/data/ for overlap. The only overlap is #66192, noted above.

Checks

  • I've signed off every commit (DCO).
  • pre-commit run --files <changed files> passes. No hook covers doc/source Markdown or notebooks, so every content hook skipped.
  • Checked that both edited notebooks still parse as JSON.
  • Sphinx build: not run locally. Relying on the Read the Docs preview for directive nesting and cross-reference resolution.

AI assistance (Claude Code) was used to make these edits. I reviewed every changed line.

🤖 Generated with Claude Code

@dstrodtman
dstrodtman requested review from a team as code owners September 30, 2026 19:48
@dstrodtman dstrodtman added the docs An issue or change related to documentation label Sep 30, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request makes various documentation improvements across Ray Data and Ray Train, including formatting fixes, updating roles (such as using {meth} instead of {class} for methods), adding image alt texts, reorganizing sections, and updating references to use the {ref} role. The reviewer feedback suggests further improving consistency by also updating 'Ray Train Key Concepts' links to use the {ref} role in the Lightning examples, and clarifying that setting the HF_TOKEN environment variable allows HfFileSystem to automatically detect the token rather than passing it directly.

"We load the pre-trained model from the HuggingFace model hub into a LightningModule and launch an FSDP fine-tuning job across 16 T4 GPUs with the help of {class}`Ray TorchTrainer <ray.train.torch.TorchTrainer>`. It is also straightforward to fine-tune other similar large language models in a similar manner as shown in this example.\n",
"\n",
"Before starting this example, we highly recommend reading [Ray Train Key Concepts](train-key-concepts) and [Ray Data Quickstart](data_quickstart)."
"Before starting this example, we highly recommend reading [Ray Train Key Concepts](train-key-concepts) and {ref}`data_quickstart`."

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

For consistency with the change to {ref}data_quickstart``, consider also updating the "Ray Train Key Concepts" link to use the {ref} role. This ensures both links automatically render their respective page titles and stay up-to-date if the titles change.

Example:

"Before starting this example, we highly recommend reading {ref}`train-key-concepts` and {ref}`data_quickstart`."

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.

Not applying. The train-key-concepts label targets the page titled "Ray Train Overview", so a bare {ref} would change the rendered link text from "Ray Train Key Concepts" to "Ray Train Overview". The "Ray Data Quickstart" change was different: that text differed from the page title only in case. Leaving this link as is.

"We load the pre-trained model from the HuggingFace model hub into a LightningModule and launch an FSDP fine-tuning job across 16 T4 GPUs with the help of {class}`Ray TorchTrainer <ray.train.torch.TorchTrainer>`. It is also straightforward to fine-tune other similar large language models in a similar manner as shown in this example.\n",
"\n",
"Before starting this example, we highly recommend reading [Ray Train Key Concepts](train-key-concepts) and [Ray Data Quickstart](data_quickstart)."
"Before starting this example, we highly recommend reading [Ray Train Key Concepts](train-key-concepts) and {ref}`data_quickstart`."

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

For consistency with the change to {ref}data_quickstart``, consider also updating the "Ray Train Key Concepts" link to use the {ref} role. This ensures both links automatically render their respective page titles and stay up-to-date if the titles change.

Example:

"Before starting this example, we highly recommend reading {ref}`train-key-concepts` and {ref}`data_quickstart`."

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.

Not applying. The train-key-concepts label targets the page titled "Ray Train Overview", so a bare {ref} would change the rendered link text from "Ray Train Key Concepts" to "Ray Train Overview". The "Ray Data Quickstart" change was different: that text differed from the page title only in case. Leaving this link as is.

"This is an advanced example of Large Language Model fine-tuning with Ray Train. If you're a beginner or new to the concepts of Ray Train and our Lightning integrations, it would be beneficial to first explore the introductory documentation below to build a foundational understanding. \n",
"- [Ray Train Key Concepts](train-key-concepts) \n",
"- [Ray Data Quickstart](data_quickstart)\n",
"- {ref}`data_quickstart`\n",

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

For consistency with the change to {ref}data_quickstart``, consider also updating the "Ray Train Key Concepts" link on the preceding line to use the {ref} role:

"- {ref}`train-key-concepts` \n"

This ensures both links in the list automatically render their respective page titles and maintain a consistent style.

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.

Not applying. The train-key-concepts label targets the page titled "Ray Train Overview", so a bare {ref} would change the rendered link text from "Ray Train Key Concepts" to "Ray Train Overview". The "Ray Data Quickstart" change was different: that text differed from the page title only in case. Leaving this link as is.

Comment thread doc/source/data/loading-data.md Outdated
```

Set your Hugging Face token to authenticate. You can read public datasets without a token, but Hugging Face rate limits are more aggressive without one. To read Hugging Face datasets without a token, set the filesystem argument to `HfFileSystem()`.
Set your Hugging Face token to authenticate. The following example passes the token to `HfFileSystem`.

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

The phrasing "The following example passes the token to HfFileSystem" is slightly inaccurate because the shell command below sets the HF_TOKEN environment variable rather than passing it directly to HfFileSystem in Python code.

Consider rephrasing to clarify that setting the environment variable allows HfFileSystem to automatically detect and use the token.

Suggested change
Set your Hugging Face token to authenticate. The following example passes the token to `HfFileSystem`.
Set your Hugging Face token to authenticate by setting the HF_TOKEN environment variable, which is automatically detected by HfFileSystem.

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.

Good catch on the ambiguity: "the following example" read as the shell command. Reworded in 9114818 to name the variable and point at the Parquet example, which passes the token to HfFileSystem explicitly. I didn't adopt the auto-detection wording, since the example doesn't rely on it.

@dstrodtman dstrodtman added the go add ONLY when ready to merge, run all tests label Oct 1, 2026
dstrodtman and others added 2 commits October 1, 2026 11:58
Clear the mechanical and structural items the Ray Data style-pass PRs
left open: untagged output blocks, shell prompts, wrong roles on
methods, a malformed link fragment, a misplaced label, duplicate
headings, missing alt text, and misplaced tabs and notes.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Douglas Strodtman <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Douglas Strodtman <[email protected]>
@dstrodtman
dstrodtman force-pushed the doc-1717-ray-data-cleanup branch from 9114818 to 9da9bfd Compare October 1, 2026 15:58
@dstrodtman
dstrodtman enabled auto-merge (squash) October 1, 2026 16:15
@dstrodtman
dstrodtman merged commit f3b333e into master Oct 1, 2026
7 checks passed
@dstrodtman
dstrodtman deleted the doc-1717-ray-data-cleanup branch October 1, 2026 16:43
dstrodtman added a commit that referenced this pull request Oct 2, 2026
## 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]>
nadongjun pushed a commit to nadongjun/ray that referenced this pull request Oct 6, 2026
ray-project#66615)

## Why are these changes needed?

The Ray Data style-pass PRs (ray-project#66413, ray-project#66418, ray-project#66419, ray-project#66420, ray-project#66422,
ray-project#66423) left a set of mechanical and structural items open. This PR
clears them. None of the edits changes a technical claim, so it needs a
style review rather than an SME review.

**Markup and links**

- `key-concepts.md`: tags the two logical-plan output blocks as `text`,
and adds alt text to the three diagrams.
- `index.md`, `shuffling-data.md`: removes `$` prompts from shell
blocks.
- `aggregating-data.md`, `iterating-over-data.md`: uses `{meth}` instead
of `{class}` for `Dataset.max`, `min`, `sum`, and `random_shuffle`.
- `aggregating-data.md`: drops the trailing slash from the blog link
fragment `#performance-benchmarks/`.
- `train/getting-started-lightgbm.rst`,
`train/getting-started-xgboost.rst`, and two Lightning example
notebooks: replaces the hard-coded "Ray Data Quickstart" link text with
a bare reference, so the link renders the page title.
- `loading-data.md`: moves the `(reading_kafka)=` label above the Kafka
heading, stacked with `(reading-from-kafka)=`.

**Structure and wording**

- `quickstart.md`: replaces the opening bullet list, which restated the
section headings, with one sentence that keeps the section links.
- `custom-datasource-example.md`: renames the two "Implement the
constructor" headings to "Implement the datasource constructor" and
"Implement the datasink constructor". Nothing links to the old anchors.
- `loading-data.md`: moves the Iceberg tab from the distributed
DataFrame libraries tab set to the "Read files" tab set, since Iceberg
is a data format rather than a DataFrame library. The tab content is
unchanged.
- `loading-data.md`: drops the unsourced "most popular PostgreSQL
database connector" claim.
- `loading-data.md`: the Hugging Face paragraph now leads with the
token, which the example uses, and presents `HfFileSystem()` without a
token as the fallback for public datasets. See the [ray-project#66419 review
thread](ray-project#66419 (comment)).
- `working-with-llms.md`: moves the usage-data note out from under the
NIXL troubleshooting heading into its own closing section.
- `working-with-pytorch.md`: drops the `torchaudio` mention, since the
section has no `torchaudio` example.
- `index.md`: "what Datasets are" becomes "what a `Dataset` is",
matching the class that the linked key-concepts page defines.

**For reviewers**

- Please confirm the diagram alt text in `key-concepts.md`. I wrote it
from what each diagram shows.
- ray-project#66192 adds a REST-catalog example inside the Iceberg tab that this PR
moves. Whichever PR merges second needs a small rebase: the added
content moves with the tab, and its `:::` fences become `::::`.

## Related issue number

None. This isn't a duplicate: the items come from reviewing the merged
style-pass PRs above, and I searched open PRs touching
`doc/source/data/` for overlap. The only overlap is ray-project#66192, noted above.

## Checks

- [x] I've signed off every commit (DCO).
- [x] `pre-commit run --files <changed files>` passes. No hook covers
`doc/source` Markdown or notebooks, so every content hook skipped.
- [x] Checked that both edited notebooks still parse as JSON.
- [ ] Sphinx build: not run locally. Relying on the Read the Docs
preview for directive nesting and cross-reference resolution.

AI assistance (Claude Code) was used to make these edits. 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]>
nadongjun pushed a commit to nadongjun/ray that referenced this pull request Oct 6, 2026
…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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs An issue or change related to documentation go add ONLY when ready to merge, run all tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants