Skip to content

[Data] Move env_float, env_integer, and env_bool to ray._common#60642

Merged
bveeramani merged 3 commits intoray-project:masterfrom
DeborahOlaboye:move-env-utils-to-common
Feb 11, 2026
Merged

[Data] Move env_float, env_integer, and env_bool to ray._common#60642
bveeramani merged 3 commits intoray-project:masterfrom
DeborahOlaboye:move-env-utils-to-common

Conversation

@DeborahOlaboye
Copy link
Copy Markdown
Contributor

Description

Move env_integer, env_float, and env_bool utility functions from ray._private.ray_constants to ray._common.utils. Update all Ray Data imports to use the new location.

Related issues

Fixes #60516

@DeborahOlaboye DeborahOlaboye requested review from a team, edoakes and jjyao as code owners February 1, 2026 08:17
Copy link
Copy Markdown
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 refactors the env_integer, env_float, and env_bool utility functions by moving them from ray._private.ray_constants to ray._common.utils. The changes across the codebase correctly update the import paths to reflect this move.

My review focuses on the implementation of the moved functions. I've identified a correctness issue in env_integer where it fails to handle negative integer values from environment variables. I've also suggested a minor improvement to env_bool for better readability and to avoid redundant lookups. The implementation of env_float looks good.

Comment on lines +54 to +61
def env_bool(key, default):
if key in os.environ:
return (
True
if os.environ[key].lower() == "true" or os.environ[key] == "1"
else False
)
return default
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 current implementation accesses os.environ[key] multiple times within the conditional logic. This can be slightly improved for efficiency and readability by storing the value in a local variable before performing comparisons.

def env_bool(key, default):
    if key in os.environ:
        val = os.environ[key].lower()
        return val == "true" or val == "1"
    return default

@ray-gardener ray-gardener bot added data Ray Data-related issues community-contribution Contributed by the community labels Feb 1, 2026
@iamjustinhsu
Copy link
Copy Markdown
Contributor

Hi @DeborahOlaboye, can you rebase + fix the tests?

@DeborahOlaboye DeborahOlaboye force-pushed the move-env-utils-to-common branch from 9089e1c to a121905 Compare February 4, 2026 20:18
Copy link
Copy Markdown

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

@bveeramani bveeramani self-assigned this Feb 4, 2026
@DeborahOlaboye
Copy link
Copy Markdown
Contributor Author

Hi @DeborahOlaboye, can you rebase + fix the tests?

Thanks for the review. I've addressed the tests and also rebased the branch.

Copy link
Copy Markdown
Member

@bveeramani bveeramani left a comment

Choose a reason for hiding this comment

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

Nice, ty

@DeborahOlaboye DeborahOlaboye force-pushed the move-env-utils-to-common branch from a121905 to 700d1ff Compare February 10, 2026 07:00
Signed-off-by: DeborahOlaboye <deboraholaboye@gmail.com>
@DeborahOlaboye DeborahOlaboye force-pushed the move-env-utils-to-common branch from 700d1ff to ed1d2c9 Compare February 10, 2026 07:01
@edoakes edoakes added the go add ONLY when ready to merge, run all tests label Feb 10, 2026
Signed-off-by: Edward Oakes <ed.nmi.oakes@gmail.com>
@edoakes
Copy link
Copy Markdown
Collaborator

edoakes commented Feb 10, 2026

pushed a commit to fix linter

@edoakes edoakes enabled auto-merge (squash) February 10, 2026 14:21
@github-actions github-actions bot disabled auto-merge February 10, 2026 16:18
@bveeramani bveeramani enabled auto-merge (squash) February 10, 2026 18:28
@bveeramani bveeramani merged commit c08329b into ray-project:master Feb 11, 2026
7 checks passed
preneond pushed a commit to preneond/ray that referenced this pull request Feb 15, 2026
…project#60642)

## Description

Move `env_integer`, `env_float`, and `env_bool` utility functions from
`ray._private.ray_constants` to `ray._common.utils`. Update all Ray Data
imports to use the new location.

## Related issues

Fixes ray-project#60516

---------

Signed-off-by: DeborahOlaboye <deboraholaboye@gmail.com>
Signed-off-by: Edward Oakes <ed.nmi.oakes@gmail.com>
Co-authored-by: Edward Oakes <ed.nmi.oakes@gmail.com>
Co-authored-by: Balaji Veeramani <balaji@anyscale.com>
Signed-off-by: Ondrej Prenek <ondra.prenek@gmail.com>
limarkdcunha pushed a commit to limarkdcunha/ray that referenced this pull request Feb 17, 2026
…project#60642)

## Description

Move `env_integer`, `env_float`, and `env_bool` utility functions from
`ray._private.ray_constants` to `ray._common.utils`. Update all Ray Data
imports to use the new location.

## Related issues

Fixes ray-project#60516

---------

Signed-off-by: DeborahOlaboye <deboraholaboye@gmail.com>
Signed-off-by: Edward Oakes <ed.nmi.oakes@gmail.com>
Co-authored-by: Edward Oakes <ed.nmi.oakes@gmail.com>
Co-authored-by: Balaji Veeramani <balaji@anyscale.com>
preneond pushed a commit to preneond/ray that referenced this pull request Feb 17, 2026
…project#60642)

## Description

Move `env_integer`, `env_float`, and `env_bool` utility functions from
`ray._private.ray_constants` to `ray._common.utils`. Update all Ray Data
imports to use the new location.

## Related issues

Fixes ray-project#60516

---------

Signed-off-by: DeborahOlaboye <deboraholaboye@gmail.com>
Signed-off-by: Edward Oakes <ed.nmi.oakes@gmail.com>
Co-authored-by: Edward Oakes <ed.nmi.oakes@gmail.com>
Co-authored-by: Balaji Veeramani <balaji@anyscale.com>
MuhammadSaif700 pushed a commit to MuhammadSaif700/ray that referenced this pull request Feb 17, 2026
…project#60642)

## Description

Move `env_integer`, `env_float`, and `env_bool` utility functions from
`ray._private.ray_constants` to `ray._common.utils`. Update all Ray Data
imports to use the new location.

## Related issues

Fixes ray-project#60516

---------

Signed-off-by: DeborahOlaboye <deboraholaboye@gmail.com>
Signed-off-by: Edward Oakes <ed.nmi.oakes@gmail.com>
Co-authored-by: Edward Oakes <ed.nmi.oakes@gmail.com>
Co-authored-by: Balaji Veeramani <balaji@anyscale.com>
Signed-off-by: Muhammad Saif <2024BBIT200@student.Uet.edu.pk>
Kunchd pushed a commit to Kunchd/ray that referenced this pull request Feb 17, 2026
…project#60642)

Move `env_integer`, `env_float`, and `env_bool` utility functions from
`ray._private.ray_constants` to `ray._common.utils`. Update all Ray Data
imports to use the new location.

Fixes ray-project#60516

---------

Signed-off-by: DeborahOlaboye <deboraholaboye@gmail.com>
Signed-off-by: Edward Oakes <ed.nmi.oakes@gmail.com>
Co-authored-by: Edward Oakes <ed.nmi.oakes@gmail.com>
Co-authored-by: Balaji Veeramani <balaji@anyscale.com>
ans9868 pushed a commit to ans9868/ray that referenced this pull request Feb 18, 2026
…project#60642)

## Description

Move `env_integer`, `env_float`, and `env_bool` utility functions from
`ray._private.ray_constants` to `ray._common.utils`. Update all Ray Data
imports to use the new location.

## Related issues

Fixes ray-project#60516

---------

Signed-off-by: DeborahOlaboye <deboraholaboye@gmail.com>
Signed-off-by: Edward Oakes <ed.nmi.oakes@gmail.com>
Co-authored-by: Edward Oakes <ed.nmi.oakes@gmail.com>
Co-authored-by: Balaji Veeramani <balaji@anyscale.com>
Signed-off-by: Adel Nour <ans9868@nyu.edu>
Aydin-ab pushed a commit to kunling-anyscale/ray that referenced this pull request Feb 20, 2026
…project#60642)

## Description

Move `env_integer`, `env_float`, and `env_bool` utility functions from
`ray._private.ray_constants` to `ray._common.utils`. Update all Ray Data
imports to use the new location.

## Related issues

Fixes ray-project#60516

---------

Signed-off-by: DeborahOlaboye <deboraholaboye@gmail.com>
Signed-off-by: Edward Oakes <ed.nmi.oakes@gmail.com>
Co-authored-by: Edward Oakes <ed.nmi.oakes@gmail.com>
Co-authored-by: Balaji Veeramani <balaji@anyscale.com>
peterxcli pushed a commit to peterxcli/ray that referenced this pull request Feb 25, 2026
…project#60642)

## Description

Move `env_integer`, `env_float`, and `env_bool` utility functions from
`ray._private.ray_constants` to `ray._common.utils`. Update all Ray Data
imports to use the new location.

## Related issues

Fixes ray-project#60516

---------

Signed-off-by: DeborahOlaboye <deboraholaboye@gmail.com>
Signed-off-by: Edward Oakes <ed.nmi.oakes@gmail.com>
Co-authored-by: Edward Oakes <ed.nmi.oakes@gmail.com>
Co-authored-by: Balaji Veeramani <balaji@anyscale.com>
Signed-off-by: peterxcli <peterxcli@gmail.com>
peterxcli pushed a commit to peterxcli/ray that referenced this pull request Feb 25, 2026
…project#60642)

## Description

Move `env_integer`, `env_float`, and `env_bool` utility functions from
`ray._private.ray_constants` to `ray._common.utils`. Update all Ray Data
imports to use the new location.

## Related issues

Fixes ray-project#60516

---------

Signed-off-by: DeborahOlaboye <deboraholaboye@gmail.com>
Signed-off-by: Edward Oakes <ed.nmi.oakes@gmail.com>
Co-authored-by: Edward Oakes <ed.nmi.oakes@gmail.com>
Co-authored-by: Balaji Veeramani <balaji@anyscale.com>
Signed-off-by: peterxcli <peterxcli@gmail.com>
preneond pushed a commit to preneond/ray that referenced this pull request Mar 23, 2026
…project#60642)

## Description

Move `env_integer`, `env_float`, and `env_bool` utility functions from
`ray._private.ray_constants` to `ray._common.utils`. Update all Ray Data
imports to use the new location.

## Related issues

Fixes ray-project#60516

---------

Signed-off-by: DeborahOlaboye <deboraholaboye@gmail.com>
Signed-off-by: Edward Oakes <ed.nmi.oakes@gmail.com>
Co-authored-by: Edward Oakes <ed.nmi.oakes@gmail.com>
Co-authored-by: Balaji Veeramani <balaji@anyscale.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

community-contribution Contributed by the community data Ray Data-related issues go add ONLY when ready to merge, run all tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Data] Move env_float, env_int, and env_bool to ray._common

4 participants