-
Notifications
You must be signed in to change notification settings - Fork 7k
[Data] Fix MCAP datasource import for better compatibility #57964
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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 <[email protected]>
There was a problem hiding this 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 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.
…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 <[email protected]> Signed-off-by: xgui <[email protected]>
…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 <[email protected]>
…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 <[email protected]> Signed-off-by: Aydin Abiar <[email protected]>
…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 <[email protected]> Signed-off-by: Future-Outlier <[email protected]>
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.