Skip to content

Conversation

@SolitaryThinker
Copy link
Contributor

Description

Fixes static type hints for ActorClass when setting options through ray.remote
Currently:
image

After this PR:
image

Related issues

Closes #58401 and #58402

cc @richardliaw @edoakes @pcmoritz

Additional information

@SolitaryThinker SolitaryThinker requested a review from a team as a code owner November 6, 2025 22:57
Signed-off-by: will.lin <will.lin@anyscale.com>
@SolitaryThinker SolitaryThinker force-pushed the will/fix_remote_options_typing branch from 787887b to 6d2c5aa Compare November 6, 2025 22:58
Copy link
Contributor

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

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 effectively addresses the issue of incorrect static type hints for ActorClass when using ray.remote. The added overloads in python/ray/_private/worker.py correctly type hint ray.remote(Actor) and ray.remote(**options)(Actor) to return a generic ActorClass[T], which is a great improvement for static analysis. The reordering of @overload decorators for ray.method in python/ray/actor.py also appears to be a good change to handle methods with default arguments more robustly. The changes are clean and well-targeted. One minor point is that a comment in python/ray/_private/worker.py (lines 3465-3466 on the right side of the diff) is now outdated due to the typing improvements in this PR, and could be removed to avoid confusion.

Signed-off-by: will.lin <will.lin@anyscale.com>
Signed-off-by: will.lin <will.lin@anyscale.com>
@ray-gardener ray-gardener bot added the core Issues that should be addressed in Ray Core label Nov 7, 2025
@edoakes edoakes added the go add ONLY when ready to merge, run all tests label Nov 7, 2025
@edoakes edoakes enabled auto-merge (squash) November 7, 2025 15:15
@edoakes edoakes merged commit fd62152 into ray-project:master Nov 7, 2025
8 checks passed
YoussefEssDS pushed a commit to YoussefEssDS/ray that referenced this pull request Nov 8, 2025
…rough ray.remote (ray-project#58439)

Fixes static type hints for ActorClass when setting options through ray.remote
Closes ray-project#58401 and ray-project#58402

cc @richardliaw @edoakes @pcmoritz 

---------

Signed-off-by: will.lin <will.lin@anyscale.com>
@SolitaryThinker SolitaryThinker deleted the will/fix_remote_options_typing branch November 10, 2025 21:55
landscapepainter pushed a commit to landscapepainter/ray that referenced this pull request Nov 17, 2025
…rough ray.remote (ray-project#58439)

Fixes static type hints for ActorClass when setting options through ray.remote
Closes ray-project#58401 and ray-project#58402

cc @richardliaw @edoakes @pcmoritz 

---------

Signed-off-by: will.lin <will.lin@anyscale.com>
Aydin-ab pushed a commit to Aydin-ab/ray-aydin that referenced this pull request Nov 19, 2025
…rough ray.remote (ray-project#58439)

Fixes static type hints for ActorClass when setting options through ray.remote
Closes ray-project#58401 and ray-project#58402

cc @richardliaw @edoakes @pcmoritz

---------

Signed-off-by: will.lin <will.lin@anyscale.com>
Signed-off-by: Aydin Abiar <aydin@anyscale.com>
ykdojo pushed a commit to ykdojo/ray that referenced this pull request Nov 27, 2025
…rough ray.remote (ray-project#58439)

Fixes static type hints for ActorClass when setting options through ray.remote
Closes ray-project#58401 and ray-project#58402

cc @richardliaw @edoakes @pcmoritz

---------

Signed-off-by: will.lin <will.lin@anyscale.com>
Signed-off-by: YK <1811651+ykdojo@users.noreply.github.com>
SheldonTsen pushed a commit to SheldonTsen/ray that referenced this pull request Dec 1, 2025
…rough ray.remote (ray-project#58439)

Fixes static type hints for ActorClass when setting options through ray.remote
Closes ray-project#58401 and ray-project#58402

cc @richardliaw @edoakes @pcmoritz 

---------

Signed-off-by: will.lin <will.lin@anyscale.com>
Future-Outlier pushed a commit to Future-Outlier/ray that referenced this pull request Dec 7, 2025
…rough ray.remote (ray-project#58439)

Fixes static type hints for ActorClass when setting options through ray.remote
Closes ray-project#58401 and ray-project#58402

cc @richardliaw @edoakes @pcmoritz

---------

Signed-off-by: will.lin <will.lin@anyscale.com>
Signed-off-by: Future-Outlier <eric901201@gmail.com>
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 go add ONLY when ready to merge, run all tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Static Type Checking Bugs

2 participants