Skip to content

[doc] Render API type hints in both the signature and the Parameters list - #64778

Merged
dstrodtman merged 2 commits into
ray-project:masterfrom
dstrodtman:doc-1078-autodoc-typehints-both
Aug 6, 2026
Merged

dstrodtman merged 2 commits into
ray-project:masterfrom
dstrodtman:doc-1078-autodoc-typehints-both

Conversation

@dstrodtman

Copy link
Copy Markdown
Contributor

Why this change

API reference pages set autodoc_typehints = "signature", so each parameter's
type appeared only in the signature. The Parameters description list showed
just a name and prose. Surfacing the type alongside each description makes the
reference easier to scan, and easier for tools that read the description list.

What changed

doc/source/conf.py: autodoc_typehints = "both" plus
autodoc_typehints_description_target = "documented". The signature keeps its
existing short type names; the Parameters list now shows
name (ShortType) - description.

The "documented" target is load-bearing: with the default "all" target,
"both" drops the parameter descriptions and renders verbose Optional[...]/
Union[...] spellings instead of the short PEP 604 names.

Not a duplicate

No open PR or issue touches autodoc_typehints /
autodoc_typehints_description_target (checked gh pr list / gh issue list
on ray-project/ray).

Testing

Full RtD-faithful clean build with warnings-as-errors:
make rtd-build (Sphinx 8.2.3, -a -E -W --keep-going, 3970 docs) ->
build succeeded, exit 0, zero Sphinx warnings. Since the docs build runs
fail_on_warning: true, a clean -W build here means clean on RtD.

Rendered-output spot checks in the built HTML:

  • TorchTrainer (class): signature short types unchanged; Parameters list now
    train_loop_config (Dict | None) - ....
  • ScalingConfig (dataclass): num_workers (int | Tuple[int, int]) - ....
  • read_parquet (function): Parameters gain short types; Return type: Dataset
    unchanged.
  • AutoscalingConfig (pydantic model): rendered by autodoc_pydantic, unaffected.

AI assistance

This change was prepared with AI assistance (Claude Code). The change and its
verification were reviewed by the submitter.

…list

`autodoc_typehints` was set to "signature", so the description-side
Parameters list showed only a name and prose for each parameter, with the
types available solely in the class or function signature above. Surfacing
the type alongside each parameter description makes the reference easier to
scan and easier for tools that read the description list to parse.

Switch `autodoc_typehints` to "both" and add
`autodoc_typehints_description_target = "documented"`. The signature keeps
its short type names unchanged; the Parameters list now shows
`name (ShortType) - description`. The "documented" target is required: with
the default "all" target, "both" mode drops the parameter descriptions and
renders verbose typing spellings (Optional[...], Union[...]) instead of the
short PEP 604 names.

Signed-off-by: Douglas Strodtman <[email protected]>
@dstrodtman
dstrodtman requested review from a team as code owners July 15, 2026 16:35

@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 updates the Sphinx configuration in doc/source/conf.py to display type hints in both the signature and the parameters description list by setting autodoc_typehints to 'both' and autodoc_typehints_description_target to 'documented'. I have no feedback to provide.

@dstrodtman dstrodtman added the docs-go RtD-only checks for docs-only changes. Doesn't run full library doc-test suites. label Jul 15, 2026
@dstrodtman

Copy link
Copy Markdown
Contributor Author

Companion proposal: #64779 takes the alternative "move information" approach — it removes types from the signature and shows them only in the Parameters list (autodoc_typehints = "description"), matching the pandas-style clean signature. This PR is the "add information" approach (keep types in the signature and also add them to the Parameters list). The two are mutually exclusive; opening both so the rendered results can be compared side by side.

@dstrodtman dstrodtman added the do-not-merge Do not merge this PR! label Jul 15, 2026
@dstrodtman

Copy link
Copy Markdown
Contributor Author

Planning to close as superseded by #64779; will wait on final decision.

@ronny-anyscale ronny-anyscale 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.

pow pow

@dstrodtman dstrodtman added go add ONLY when ready to merge, run all tests and removed do-not-merge Do not merge this PR! labels Jul 15, 2026
@ray-gardener ray-gardener Bot added docs An issue or change related to documentation core Issues that should be addressed in Ray Core labels Jul 15, 2026
@github-actions

Copy link
Copy Markdown

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

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

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

@github-actions github-actions Bot added the stale The issue is stale. It will be closed within 7 days unless there are further conversation label Jul 30, 2026
@dstrodtman dstrodtman added unstale A PR that has been marked unstale. It will not get marked stale again if this label is on it. and removed stale The issue is stale. It will be closed within 7 days unless there are further conversation labels Aug 3, 2026
@dstrodtman
dstrodtman merged commit babd566 into ray-project:master Aug 6, 2026
5 checks passed
Artimislyy pushed a commit to Artimislyy/ray that referenced this pull request Aug 11, 2026
…list (ray-project#64778)

## Why this change

API reference pages set `autodoc_typehints = "signature"`, so each
parameter's
type appeared only in the signature. The Parameters description list
showed
just a name and prose. Surfacing the type alongside each description
makes the
reference easier to scan, and easier for tools that read the description
list.

## What changed

`doc/source/conf.py`: `autodoc_typehints = "both"` plus
`autodoc_typehints_description_target = "documented"`. The signature
keeps its
existing short type names; the Parameters list now shows
`name (ShortType) - description`.

The `"documented"` target is load-bearing: with the default `"all"`
target,
`"both"` drops the parameter descriptions and renders verbose
`Optional[...]`/
`Union[...]` spellings instead of the short PEP 604 names.

## Not a duplicate

No open PR or issue touches `autodoc_typehints` /
`autodoc_typehints_description_target` (checked `gh pr list` / `gh issue
list`
on ray-project/ray).

## Testing

Full RtD-faithful clean build with warnings-as-errors:
`make rtd-build` (Sphinx 8.2.3, `-a -E -W --keep-going`, 3970 docs) ->
`build succeeded`, exit 0, zero Sphinx warnings. Since the docs build
runs
`fail_on_warning: true`, a clean `-W` build here means clean on RtD.

Rendered-output spot checks in the built HTML:

- `TorchTrainer` (class): signature short types unchanged; Parameters
list now
  `train_loop_config (Dict | None) - ...`.
- `ScalingConfig` (dataclass): `num_workers (int | Tuple[int, int]) -
...`.
- `read_parquet` (function): Parameters gain short types; `Return type:
Dataset`
  unchanged.
- `AutoscalingConfig` (pydantic model): rendered by autodoc_pydantic,
unaffected.

## AI assistance

This change was prepared with AI assistance (Claude Code). The change
and its
verification were reviewed by the submitter.

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

## Why this change

API reference pages set `autodoc_typehints = "signature"`, so each
parameter's
type appeared only in the signature. The Parameters description list
showed
just a name and prose. Surfacing the type alongside each description
makes the
reference easier to scan, and easier for tools that read the description
list.

## What changed

`doc/source/conf.py`: `autodoc_typehints = "both"` plus
`autodoc_typehints_description_target = "documented"`. The signature
keeps its
existing short type names; the Parameters list now shows
`name (ShortType) - description`.

The `"documented"` target is load-bearing: with the default `"all"`
target,
`"both"` drops the parameter descriptions and renders verbose
`Optional[...]`/
`Union[...]` spellings instead of the short PEP 604 names.

## Not a duplicate

No open PR or issue touches `autodoc_typehints` /
`autodoc_typehints_description_target` (checked `gh pr list` / `gh issue
list`
on ray-project/ray).

## Testing

Full RtD-faithful clean build with warnings-as-errors:
`make rtd-build` (Sphinx 8.2.3, `-a -E -W --keep-going`, 3970 docs) ->
`build succeeded`, exit 0, zero Sphinx warnings. Since the docs build
runs
`fail_on_warning: true`, a clean `-W` build here means clean on RtD.

Rendered-output spot checks in the built HTML:

- `TorchTrainer` (class): signature short types unchanged; Parameters
list now
  `train_loop_config (Dict | None) - ...`.
- `ScalingConfig` (dataclass): `num_workers (int | Tuple[int, int]) -
...`.
- `read_parquet` (function): Parameters gain short types; `Return type:
Dataset`
  unchanged.
- `AutoscalingConfig` (pydantic model): rendered by autodoc_pydantic,
unaffected.

## AI assistance

This change was prepared with AI assistance (Claude Code). The change
and its
verification were reviewed by the submitter.

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

## Why this change

API reference pages set `autodoc_typehints = "signature"`, so each
parameter's
type appeared only in the signature. The Parameters description list
showed
just a name and prose. Surfacing the type alongside each description
makes the
reference easier to scan, and easier for tools that read the description
list.

## What changed

`doc/source/conf.py`: `autodoc_typehints = "both"` plus
`autodoc_typehints_description_target = "documented"`. The signature
keeps its
existing short type names; the Parameters list now shows
`name (ShortType) - description`.

The `"documented"` target is load-bearing: with the default `"all"`
target,
`"both"` drops the parameter descriptions and renders verbose
`Optional[...]`/
`Union[...]` spellings instead of the short PEP 604 names.

## Not a duplicate

No open PR or issue touches `autodoc_typehints` /
`autodoc_typehints_description_target` (checked `gh pr list` / `gh issue
list`
on ray-project/ray).

## Testing

Full RtD-faithful clean build with warnings-as-errors:
`make rtd-build` (Sphinx 8.2.3, `-a -E -W --keep-going`, 3970 docs) ->
`build succeeded`, exit 0, zero Sphinx warnings. Since the docs build
runs
`fail_on_warning: true`, a clean `-W` build here means clean on RtD.

Rendered-output spot checks in the built HTML:

- `TorchTrainer` (class): signature short types unchanged; Parameters
list now
  `train_loop_config (Dict | None) - ...`.
- `ScalingConfig` (dataclass): `num_workers (int | Tuple[int, int]) -
...`.
- `read_parquet` (function): Parameters gain short types; `Return type:
Dataset`
  unchanged.
- `AutoscalingConfig` (pydantic model): rendered by autodoc_pydantic,
unaffected.

## AI assistance

This change was prepared with AI assistance (Claude Code). The change
and its
verification were reviewed by the submitter.

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

Labels

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants