Skip to content

Conversation

@aslonnie
Copy link
Collaborator

@aslonnie aslonnie commented Nov 7, 2025

getting ready to run things on python 3.10

@aslonnie aslonnie requested a review from a team November 7, 2025 17:31
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 correctly adds the Bazel configuration for a Python 3.10 toolchain by mirroring the existing setup for Python 3.9. The changes are straightforward and look good. I have included one suggestion to enhance maintainability by refactoring the duplicated toolchain definitions into a macro, which could be addressed in a follow-up. As a reminder, for this new toolchain to be active, it will need to be registered in the WORKSPACE file.

Comment on lines +87 to +106
py_runtime(
name = "py310_runtime",
interpreter = python310,
python_version = "PY3",
visibility = ["//visibility:private"],
)

py_runtime_pair(
name = "py310_runtime_pair",
py2_runtime = None,
py3_runtime = ":py310_runtime",
visibility = ["//visibility:private"],
)

toolchain(
name = "py310_toolchain",
exec_compatible_with = ["//:hermetic_python"],
toolchain = ":py310_runtime_pair",
toolchain_type = "@bazel_tools//tools/python:toolchain_type",
)
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

This block of code for Python 3.10 is a copy of the existing definitions for Python 3.9. While this is correct, it introduces code duplication. To improve maintainability and make it easier to add future Python versions, consider refactoring this into a macro.

For example, a macro could be defined in a .bzl file (e.g., bazel/python.bzl):

# In a .bzl file, e.g., bazel/python.bzl
def create_python_toolchain(version, interpreter):
    native.py_runtime(
        name = f"py{version}_runtime",
        interpreter = interpreter,
        python_version = "PY3",
        visibility = ["//visibility:private"],
    )

    native.py_runtime_pair(
        name = f"py{version}_runtime_pair",
        py2_runtime = None,
        py3_runtime = f":py{version}_runtime",
        visibility = ["//visibility:private"],
    )

    native.toolchain(
        name = f"py{version}_toolchain",
        exec_compatible_with = ["//:hermetic_python"],
        toolchain = f":py{version}_runtime_pair",
        toolchain_type = "@bazel_tools//tools/python:toolchain_type",
    )

Then in BUILD.bazel, you could replace the duplicated blocks for both Python 3.9 and 3.10 with calls to this macro. This could be a good follow-up improvement.

Signed-off-by: Lonnie Liu <lonnie@anyscale.com>
@aslonnie aslonnie force-pushed the lonnie-251107-py310runtime branch from 16b4972 to c5b5f28 Compare November 7, 2025 18:04
@aslonnie aslonnie added the go add ONLY when ready to merge, run all tests label Nov 7, 2025
@ray-gardener ray-gardener bot added the core Issues that should be addressed in Ray Core label Nov 7, 2025
@aslonnie aslonnie requested a review from elliot-barn November 7, 2025 20:52
@aslonnie aslonnie merged commit a70a1b1 into master Nov 7, 2025
7 checks passed
@aslonnie aslonnie deleted the lonnie-251107-py310runtime branch November 7, 2025 22:06
YoussefEssDS pushed a commit to YoussefEssDS/ray that referenced this pull request Nov 8, 2025
getting ready to run things on python 3.10

Signed-off-by: Lonnie Liu <lonnie@anyscale.com>
landscapepainter pushed a commit to landscapepainter/ray that referenced this pull request Nov 17, 2025
getting ready to run things on python 3.10

Signed-off-by: Lonnie Liu <lonnie@anyscale.com>
Aydin-ab pushed a commit to Aydin-ab/ray-aydin that referenced this pull request Nov 19, 2025
getting ready to run things on python 3.10

Signed-off-by: Lonnie Liu <lonnie@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
getting ready to run things on python 3.10

Signed-off-by: Lonnie Liu <lonnie@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
getting ready to run things on python 3.10

Signed-off-by: Lonnie Liu <lonnie@anyscale.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.

3 participants