From 93c815bdd57f3137d4e85e62d279ace17ea5d01b Mon Sep 17 00:00:00 2001 From: soffer-anyscale Date: Tue, 21 Oct 2025 15:28:49 -0600 Subject: [PATCH] Fix MCAP datasource import for better compatibility Change from 'import mcap' followed by 'mcap.reader.make_reader(f)' to 'from mcap.reader import make_reader' for cleaner, more explicit import. This follows Python best practices for explicit imports and improves compatibility with different mcap package versions. Signed-off-by: soffer-anyscale --- python/ray/data/_internal/datasource/mcap_datasource.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/python/ray/data/_internal/datasource/mcap_datasource.py b/python/ray/data/_internal/datasource/mcap_datasource.py index 29995cf78ba4..b4ae4fdf90a5 100644 --- a/python/ray/data/_internal/datasource/mcap_datasource.py +++ b/python/ray/data/_internal/datasource/mcap_datasource.py @@ -139,9 +139,9 @@ def _read_stream(self, f: "pyarrow.NativeFile", path: str) -> Iterator[Block]: Raises: ValueError: If the MCAP file cannot be read or has invalid format. """ - import mcap + from mcap.reader import make_reader - reader = mcap.reader.make_reader(f) + reader = make_reader(f) # Note: MCAP summaries are optional and iter_messages works without them # We don't need to validate the summary since it's not required