Skip to content

[Data] Expose logical rules via package exports#60296

Merged
bveeramani merged 5 commits intoray-project:masterfrom
400Ping:pr/rules
Jan 23, 2026
Merged

[Data] Expose logical rules via package exports#60296
bveeramani merged 5 commits intoray-project:masterfrom
400Ping:pr/rules

Conversation

@400Ping
Copy link
Contributor

@400Ping 400Ping commented Jan 19, 2026

Description

Goal

Make ray.data._internal.logical.rules a proper package entry point with short imports and alphabetized __all__.

Changes

Add/complete __all__ in rule modules and re-export via __init__.py.
Update imports to from ray.data._internal.logical.rules import ....
Keep helper imports module-scoped to avoid circular dependencies.

Related issues

Related to #60204

Additional information

@400Ping 400Ping requested a review from a team as a code owner January 19, 2026 12:01
@400Ping 400Ping marked this pull request as draft January 19, 2026 12:01
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 refactors the ray.data._internal.logical.rules package to provide a single entry point for importing logical rules, which improves code organization and maintainability. The changes involve dynamically exporting symbols from submodules via __init__.py, adding __all__ to the respective rule modules, and updating import statements in consumers.

The implementation is clean and achieves the stated goal. I have one suggestion to make the dynamic exporting in __init__.py more robust by handling potential name collisions between modules.

@400Ping 400Ping force-pushed the pr/rules branch 4 times, most recently from 55c601d to 366d2ca Compare January 19, 2026 15:53
@400Ping 400Ping marked this pull request as ready for review January 21, 2026 04:37
@gemini-code-assist
Copy link
Contributor

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

Comment on lines +3 to +22
This module dynamically imports each submodule in the package and re-exports
names listed in the submodule's __all__ attribute. This allows callers to
import rules directly from ray.data._internal.logical.rules.
"""

from importlib import import_module
from pkgutil import iter_modules

__all__ = []

for _loader, _module_name, _is_pkg in iter_modules(__path__):
if _module_name.startswith("_"):
continue
_module = import_module(f"{__name__}.{_module_name}")
_exported_names = getattr(_module, "__all__", [])
for _name in _exported_names:
globals()[_name] = getattr(_module, _name)
__all__.extend(_exported_names)

__all__.sort()
Copy link
Member

Choose a reason for hiding this comment

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

Rather than using a script, can we explicitly list out the dependencies? e.g., from .inherit_batch_format import ...? I think it'll be easier to read and maintain

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done in 81215e3

@ray-gardener ray-gardener bot added data Ray Data-related issues community-contribution Contributed by the community labels Jan 21, 2026
@400Ping 400Ping requested a review from bveeramani January 21, 2026 08:28
400Ping and others added 4 commits January 21, 2026 16:31
Signed-off-by: 400Ping <jiekai.chang326@gmail.com>
Signed-off-by: 400Ping <fourhundredping@gmail.com>
Signed-off-by: 400Ping <fourhundredping@gmail.com>
Signed-off-by: 400Ping <fourhundredping@gmail.com>
Signed-off-by: 400Ping <fourhundredping@gmail.com>
@400Ping
Copy link
Contributor Author

400Ping commented Jan 21, 2026

Checked the microcheck error, doesn't seems to be related to this PR?

Copy link
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. LGTM

@bveeramani bveeramani enabled auto-merge (squash) January 22, 2026 19:36
@github-actions github-actions bot disabled auto-merge January 22, 2026 19:36
@github-actions github-actions bot added the go add ONLY when ready to merge, run all tests label Jan 22, 2026
@bveeramani bveeramani merged commit 1e4cb8c into ray-project:master Jan 23, 2026
8 checks passed
xinyuangui2 pushed a commit to xinyuangui2/ray that referenced this pull request Jan 26, 2026
## Description
### Goal
Make ray.data._internal.logical.rules a proper package entry point with
short imports and alphabetized `__all__`.
### Changes
Add/complete `__all__` in rule modules and re-export via `__init__.py`.
Update imports to `from ray.data._internal.logical.rules import ...`.
Keep helper imports module-scoped to avoid circular dependencies.

## Related issues
Related to ray-project#60204

## Additional information

---------

Signed-off-by: 400Ping <jiekai.chang326@gmail.com>
Signed-off-by: 400Ping <fourhundredping@gmail.com>
Co-authored-by: Balaji Veeramani <balaji@anyscale.com>
jinbum-kim pushed a commit to jinbum-kim/ray that referenced this pull request Jan 29, 2026
## Description
### Goal
Make ray.data._internal.logical.rules a proper package entry point with
short imports and alphabetized `__all__`.
### Changes
Add/complete `__all__` in rule modules and re-export via `__init__.py`.
Update imports to `from ray.data._internal.logical.rules import ...`.
Keep helper imports module-scoped to avoid circular dependencies.

## Related issues
Related to ray-project#60204

## Additional information

---------

Signed-off-by: 400Ping <jiekai.chang326@gmail.com>
Signed-off-by: 400Ping <fourhundredping@gmail.com>
Co-authored-by: Balaji Veeramani <balaji@anyscale.com>
Signed-off-by: jinbum-kim <jinbum9958@gmail.com>
peterxcli pushed a commit to peterxcli/ray that referenced this pull request Feb 25, 2026
## Description
### Goal
Make ray.data._internal.logical.rules a proper package entry point with
short imports and alphabetized `__all__`.
### Changes
Add/complete `__all__` in rule modules and re-export via `__init__.py`.
Update imports to `from ray.data._internal.logical.rules import ...`.
Keep helper imports module-scoped to avoid circular dependencies.

## Related issues
Related to ray-project#60204

## Additional information

---------

Signed-off-by: 400Ping <jiekai.chang326@gmail.com>
Signed-off-by: 400Ping <fourhundredping@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
## Description
### Goal
Make ray.data._internal.logical.rules a proper package entry point with
short imports and alphabetized `__all__`.
### Changes
Add/complete `__all__` in rule modules and re-export via `__init__.py`.
Update imports to `from ray.data._internal.logical.rules import ...`.
Keep helper imports module-scoped to avoid circular dependencies.

## Related issues
Related to ray-project#60204

## Additional information

---------

Signed-off-by: 400Ping <jiekai.chang326@gmail.com>
Signed-off-by: 400Ping <fourhundredping@gmail.com>
Co-authored-by: Balaji Veeramani <balaji@anyscale.com>
Signed-off-by: peterxcli <peterxcli@gmail.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.

2 participants