Skip to content

[Train] Fix all of Train's pydoclint issues - #63365

Merged
matthewdeng merged 3 commits into
ray-project:masterfrom
pseudo-rnd-thoughts:fix-train-docstrings
May 18, 2026
Merged

matthewdeng merged 3 commits into
ray-project:masterfrom
pseudo-rnd-thoughts:fix-train-docstrings

Conversation

@pseudo-rnd-thoughts

@pseudo-rnd-thoughts pseudo-rnd-thoughts commented May 15, 2026 •

Copy link
Copy Markdown
Member

Description

#52974 added pydoclint to pre-commit without fixing any issues through adding all the problematic docstrings to an ignore list.
However this means that all the docstrings that do have issues / problems with them that aren't raised or fixed.

This PR removes all of Train's ignores then uses Claude to fix all the docstrings / type hints (and reviewed by me to confirm implementations).

@pseudo-rnd-thoughts
pseudo-rnd-thoughts requested a review from a team as a code owner May 15, 2026 11:22
@pseudo-rnd-thoughts pseudo-rnd-thoughts added the train Ray Train Related Issue label May 15, 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 focuses on resolving a large number of pydoclint violations across the ray.train module by standardizing docstrings and type hints. Key improvements include adding missing Args, Returns, and Yields sections, reordering docstring parameters to match function signatures, and refining type annotations for clarity. A review comment correctly identifies a discrepancy in BackendExecutor._create_rank_world_size_mappings, where the docstring describes the return value as a tuple while the implementation and type hint specify a list.

@pseudo-rnd-thoughts pseudo-rnd-thoughts added the go add ONLY when ready to merge, run all tests label May 15, 2026

@matthewdeng matthewdeng 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.


@matthewdeng
matthewdeng merged commit a8d5df5 into ray-project:master May 18, 2026
4 checks passed
TruongQuangPhat pushed a commit to cyhapun/ray-fix-issue that referenced this pull request May 27, 2026
## Description
ray-project#52974 added pydoclint to
pre-commit without fixing any issues through adding all the problematic
docstrings to an ignore list.
However this means that all the docstrings that do have issues /
problems with them that aren't raised or fixed.

This PR removes all of Train's ignores then uses Claude to fix all the
docstrings / type hints (and reviewed by me to confirm implementations).

---------

Signed-off-by: Mark Towers <[email protected]>
Co-authored-by: Mark Towers <[email protected]>
Signed-off-by: phattruong <[email protected]>
alexandrplashchinsky pushed a commit to alexandrplashchinsky/ray-alex that referenced this pull request May 29, 2026
## Description
ray-project#52974 added pydoclint to
pre-commit without fixing any issues through adding all the problematic
docstrings to an ignore list.
However this means that all the docstrings that do have issues /
problems with them that aren't raised or fixed.

This PR removes all of Train's ignores then uses Claude to fix all the
docstrings / type hints (and reviewed by me to confirm implementations).

---------

Signed-off-by: Mark Towers <[email protected]>
Co-authored-by: Mark Towers <[email protected]>
Signed-off-by: Alexandr Plashchinsky <[email protected]>
400Ping pushed a commit to 400Ping/ray that referenced this pull request Aug 18, 2026
## Description
ray-project#52974 added pydoclint to
pre-commit without fixing any issues through adding all the problematic
docstrings to an ignore list.
However this means that all the docstrings that do have issues /
problems with them that aren't raised or fixed.

This PR removes all of Train's ignores then uses Claude to fix all the
docstrings / type hints (and reviewed by me to confirm implementations).

---------

Signed-off-by: Mark Towers <[email protected]>
Co-authored-by: Mark Towers <[email protected]>
Signed-off-by: 400Ping <[email protected]>
pseudo-rnd-thoughts pushed a commit that referenced this pull request Nov 16, 2026
…n legacy LightGBM/XGBoost trainers (#68145)

## Why are these changes needed?

In `_get_legacy_train_fn_per_worker` for both `LightGBMTrainer`
(`python/ray/train/lightgbm/lightgbm_trainer.py`) and `XGBoostTrainer`
(`python/ray/train/xgboost/xgboost_trainer.py`):

1. `num_boost_round = num_boost_round or DEFAULT_NUM_BOOST_ROUND` used
truthiness instead of an explicit `is None` check. When a caller
explicitly passed `num_boost_round=0` (for example in dry-run
initialization or checkpoint evaluation without additional boosting
rounds), `0 or 10` silently evaluated to `10`.
2. `callbacks = trainer_kwargs.get("callbacks", [])` retrieved the
caller's list reference directly and appended `default_callback_cls()`
in-place (`callbacks.append(...)`). Reusing the same configuration
dictionary across multiple `Trainer` instantiations mutated the caller's
`callbacks` list on each run, and passing `callbacks=None` or a tuple
raised an `AttributeError`.

This PR:
- Checks `if num_boost_round is None: num_boost_round =
DEFAULT_NUM_BOOST_ROUND` so explicit `0` is preserved.
- Copies `callbacks = list(trainer_kwargs.get("callbacks") or [])`
before appending the default `RayTrainReportCallback`.

## Related issue number

N/A

## Checks

- [x] I've signed off every commit(by using the -s flag, i.e., `git
commit -s`) in this PR.
- [x] I've run `scripts/format.sh` to lint the changes in this PR.
- [x] I've included any doc changes needed for
https://docs.ray.io/en/master/.
- [x] I've made sure the tests are passing. Note that there might be a
few flaky tests, see the recent failures at https://flakey-tests.ray.io/
- Testing Strategy
- [x] Unit tests (`python/ray/train/tests/test_lightgbm_trainer.py` and
`python/ray/train/tests/test_xgboost_trainer.py`)
   - [ ] Release tests
   - [ ] This PR is not tested :(

## Acknowledgements

Thanks to @dstrodtman (#67821, #67786, #67620), @pseudo-rnd-thoughts
(#63988, #63427, #63365), and @justinvyu (#57256, #50042) for their work
maintaining `LightGBMTrainer` and `XGBoostTrainer`.

---------

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

Labels

go add ONLY when ready to merge, run all tests train Ray Train Related Issue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants