[Data] Fix MCAP datasource import for better compatibility#57964
Merged
richardliaw merged 2 commits intomasterfrom Oct 23, 2025
Merged
[Data] Fix MCAP datasource import for better compatibility#57964richardliaw merged 2 commits intomasterfrom
richardliaw merged 2 commits intomasterfrom
Conversation
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 <stephen.offer@anyscale.com>
richardliaw
approved these changes
Oct 21, 2025
Contributor
There was a problem hiding this comment.
Code Review
This pull request refactors the import statement for the mcap library within the MCAPDatasource to use a more specific import. This is a good change that improves code clarity and explicitness, aligning with Python best practices. The change is well-contained, low-risk, and correctly implemented. I have no further suggestions.
xinyuangui2
pushed a commit
to xinyuangui2/ray
that referenced
this pull request
Oct 27, 2025
…ct#57964) ## Description This PR fixes the import statement in `MCAPDatasource` to follow Python best practices for explicit imports. **Change**: Updated from `import mcap` + `mcap.reader.make_reader(f)` to `from mcap.reader import make_reader` for cleaner, more explicit importing. **Why this is needed**: - Follows Python best practices for explicit imports (PEP 8) - Improves code readability by making it clear what's being used - Better compatibility with different mcap package versions - Reduces namespace pollution ## Related issues None - this is a code quality improvement. ## Additional information ### What changed **Before:** ```python import mcap reader = mcap.reader.make_reader(f) ``` **After:** ```python from mcap.reader import make_reader reader = make_reader(f) ``` ### Impact - **Minimal risk**: This is a refactoring of the import statement only - **No API changes**: The `MCAPDatasource` public API remains unchanged - **No behavioral changes**: The functionality is identical - **Tested**: All ruff lint checks pass ### File modified - `python/ray/data/_internal/datasource/mcap_datasource.py` (2 lines changed) This change makes the code more maintainable and follows modern Python conventions for explicit imports. Signed-off-by: soffer-anyscale <stephen.offer@anyscale.com> Signed-off-by: xgui <xgui@anyscale.com>
landscapepainter
pushed a commit
to landscapepainter/ray
that referenced
this pull request
Nov 17, 2025
…ct#57964) ## Description This PR fixes the import statement in `MCAPDatasource` to follow Python best practices for explicit imports. **Change**: Updated from `import mcap` + `mcap.reader.make_reader(f)` to `from mcap.reader import make_reader` for cleaner, more explicit importing. **Why this is needed**: - Follows Python best practices for explicit imports (PEP 8) - Improves code readability by making it clear what's being used - Better compatibility with different mcap package versions - Reduces namespace pollution ## Related issues None - this is a code quality improvement. ## Additional information ### What changed **Before:** ```python import mcap reader = mcap.reader.make_reader(f) ``` **After:** ```python from mcap.reader import make_reader reader = make_reader(f) ``` ### Impact - **Minimal risk**: This is a refactoring of the import statement only - **No API changes**: The `MCAPDatasource` public API remains unchanged - **No behavioral changes**: The functionality is identical - **Tested**: All ruff lint checks pass ### File modified - `python/ray/data/_internal/datasource/mcap_datasource.py` (2 lines changed) This change makes the code more maintainable and follows modern Python conventions for explicit imports. Signed-off-by: soffer-anyscale <stephen.offer@anyscale.com>
Aydin-ab
pushed a commit
to Aydin-ab/ray-aydin
that referenced
this pull request
Nov 19, 2025
…ct#57964) ## Description This PR fixes the import statement in `MCAPDatasource` to follow Python best practices for explicit imports. **Change**: Updated from `import mcap` + `mcap.reader.make_reader(f)` to `from mcap.reader import make_reader` for cleaner, more explicit importing. **Why this is needed**: - Follows Python best practices for explicit imports (PEP 8) - Improves code readability by making it clear what's being used - Better compatibility with different mcap package versions - Reduces namespace pollution ## Related issues None - this is a code quality improvement. ## Additional information ### What changed **Before:** ```python import mcap reader = mcap.reader.make_reader(f) ``` **After:** ```python from mcap.reader import make_reader reader = make_reader(f) ``` ### Impact - **Minimal risk**: This is a refactoring of the import statement only - **No API changes**: The `MCAPDatasource` public API remains unchanged - **No behavioral changes**: The functionality is identical - **Tested**: All ruff lint checks pass ### File modified - `python/ray/data/_internal/datasource/mcap_datasource.py` (2 lines changed) This change makes the code more maintainable and follows modern Python conventions for explicit imports. Signed-off-by: soffer-anyscale <stephen.offer@anyscale.com> Signed-off-by: Aydin Abiar <aydin@anyscale.com>
Future-Outlier
pushed a commit
to Future-Outlier/ray
that referenced
this pull request
Dec 7, 2025
…ct#57964) ## Description This PR fixes the import statement in `MCAPDatasource` to follow Python best practices for explicit imports. **Change**: Updated from `import mcap` + `mcap.reader.make_reader(f)` to `from mcap.reader import make_reader` for cleaner, more explicit importing. **Why this is needed**: - Follows Python best practices for explicit imports (PEP 8) - Improves code readability by making it clear what's being used - Better compatibility with different mcap package versions - Reduces namespace pollution ## Related issues None - this is a code quality improvement. ## Additional information ### What changed **Before:** ```python import mcap reader = mcap.reader.make_reader(f) ``` **After:** ```python from mcap.reader import make_reader reader = make_reader(f) ``` ### Impact - **Minimal risk**: This is a refactoring of the import statement only - **No API changes**: The `MCAPDatasource` public API remains unchanged - **No behavioral changes**: The functionality is identical - **Tested**: All ruff lint checks pass ### File modified - `python/ray/data/_internal/datasource/mcap_datasource.py` (2 lines changed) This change makes the code more maintainable and follows modern Python conventions for explicit imports. Signed-off-by: soffer-anyscale <stephen.offer@anyscale.com> Signed-off-by: Future-Outlier <eric901201@gmail.com>
Blaze-DSP
pushed a commit
to Blaze-DSP/ray
that referenced
this pull request
Dec 18, 2025
…ct#57964) ## Description This PR fixes the import statement in `MCAPDatasource` to follow Python best practices for explicit imports. **Change**: Updated from `import mcap` + `mcap.reader.make_reader(f)` to `from mcap.reader import make_reader` for cleaner, more explicit importing. **Why this is needed**: - Follows Python best practices for explicit imports (PEP 8) - Improves code readability by making it clear what's being used - Better compatibility with different mcap package versions - Reduces namespace pollution ## Related issues None - this is a code quality improvement. ## Additional information ### What changed **Before:** ```python import mcap reader = mcap.reader.make_reader(f) ``` **After:** ```python from mcap.reader import make_reader reader = make_reader(f) ``` ### Impact - **Minimal risk**: This is a refactoring of the import statement only - **No API changes**: The `MCAPDatasource` public API remains unchanged - **No behavioral changes**: The functionality is identical - **Tested**: All ruff lint checks pass ### File modified - `python/ray/data/_internal/datasource/mcap_datasource.py` (2 lines changed) This change makes the code more maintainable and follows modern Python conventions for explicit imports. Signed-off-by: soffer-anyscale <stephen.offer@anyscale.com>
peterxcli
pushed a commit
to peterxcli/ray
that referenced
this pull request
Feb 25, 2026
…ct#57964) ## Description This PR fixes the import statement in `MCAPDatasource` to follow Python best practices for explicit imports. **Change**: Updated from `import mcap` + `mcap.reader.make_reader(f)` to `from mcap.reader import make_reader` for cleaner, more explicit importing. **Why this is needed**: - Follows Python best practices for explicit imports (PEP 8) - Improves code readability by making it clear what's being used - Better compatibility with different mcap package versions - Reduces namespace pollution ## Related issues None - this is a code quality improvement. ## Additional information ### What changed **Before:** ```python import mcap reader = mcap.reader.make_reader(f) ``` **After:** ```python from mcap.reader import make_reader reader = make_reader(f) ``` ### Impact - **Minimal risk**: This is a refactoring of the import statement only - **No API changes**: The `MCAPDatasource` public API remains unchanged - **No behavioral changes**: The functionality is identical - **Tested**: All ruff lint checks pass ### File modified - `python/ray/data/_internal/datasource/mcap_datasource.py` (2 lines changed) This change makes the code more maintainable and follows modern Python conventions for explicit imports. Signed-off-by: soffer-anyscale <stephen.offer@anyscale.com> Signed-off-by: peterxcli <peterxcli@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR fixes the import statement in
MCAPDatasourceto follow Python best practices for explicit imports.Change: Updated from
import mcap+mcap.reader.make_reader(f)tofrom mcap.reader import make_readerfor cleaner, more explicit importing.Why this is needed:
Related issues
None - this is a code quality improvement.
Additional information
What changed
Before:
After:
Impact
MCAPDatasourcepublic API remains unchangedFile modified
python/ray/data/_internal/datasource/mcap_datasource.py(2 lines changed)This change makes the code more maintainable and follows modern Python conventions for explicit imports.