Use PurePosixPath for cross-platform path handling - #15238
Merged
Conversation
yurekami
force-pushed
the
fix/cross-platform-path
branch
from
December 29, 2025 14:29
e453be5 to
0bee50a
Compare
Replace string split("/") with PurePosixPath().name for extracting
filenames from cloud storage paths, URLs, and HuggingFace repo names.
While these paths use forward slashes by convention (not affected by
the host OS), using PurePosixPath is more explicit, self-documenting,
and follows Python best practices for path manipulation.
Files modified:
- nemo/core/connectors/save_restore_connector.py (cloud storage paths)
- nemo/core/classes/common.py (cloud URLs and HuggingFace repo names)
Note: tarutils.py and nemo_file.py were NOT modified as they handle
tar archive internal paths (which mandate POSIX format) and dictionary
keys (not filesystem paths) respectively.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Signed-off-by: yurekami <yurekami@users.noreply.github.com>
yurekami
force-pushed
the
fix/cross-platform-path
branch
from
December 29, 2025 14:32
0bee50a to
3c2782d
Compare
Signed-off-by: Jason <jasoli@nvidia.com>
blisc
previously approved these changes
Jan 12, 2026
Signed-off-by: Jason <jasoli@nvidia.com>
Signed-off-by: blisc <blisc@users.noreply.github.com>
blisc
approved these changes
Jan 13, 2026
blisc
enabled auto-merge (squash)
January 13, 2026 16:56
AkCodes23
pushed a commit
to AkCodes23/NeMo
that referenced
this pull request
Jan 28, 2026
* Use PurePosixPath for cross-platform path handling (NVIDIA-NeMo#15113) Replace string split("/") with PurePosixPath().name for extracting filenames from cloud storage paths, URLs, and HuggingFace repo names. While these paths use forward slashes by convention (not affected by the host OS), using PurePosixPath is more explicit, self-documenting, and follows Python best practices for path manipulation. Files modified: - nemo/core/connectors/save_restore_connector.py (cloud storage paths) - nemo/core/classes/common.py (cloud URLs and HuggingFace repo names) Note: tarutils.py and nemo_file.py were NOT modified as they handle tar archive internal paths (which mandate POSIX format) and dictionary keys (not filesystem paths) respectively. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> Signed-off-by: yurekami <yurekami@users.noreply.github.com> * Update common.py Signed-off-by: Jason <jasoli@nvidia.com> * Apply isort and black reformatting Signed-off-by: blisc <blisc@users.noreply.github.com> --------- Signed-off-by: yurekami <yurekami@users.noreply.github.com> Signed-off-by: Jason <jasoli@nvidia.com> Signed-off-by: blisc <blisc@users.noreply.github.com> Co-authored-by: yurekami <yurekami@users.noreply.github.com> Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com> Co-authored-by: Jason <jasoli@nvidia.com> Co-authored-by: blisc <blisc@users.noreply.github.com> Signed-off-by: Akhil Varanasi <akhilvaranasi23@gmail.com>
nune-tadevosyan
pushed a commit
to nune-tadevosyan/NeMo
that referenced
this pull request
Mar 13, 2026
* Use PurePosixPath for cross-platform path handling (NVIDIA-NeMo#15113) Replace string split("/") with PurePosixPath().name for extracting filenames from cloud storage paths, URLs, and HuggingFace repo names. While these paths use forward slashes by convention (not affected by the host OS), using PurePosixPath is more explicit, self-documenting, and follows Python best practices for path manipulation. Files modified: - nemo/core/connectors/save_restore_connector.py (cloud storage paths) - nemo/core/classes/common.py (cloud URLs and HuggingFace repo names) Note: tarutils.py and nemo_file.py were NOT modified as they handle tar archive internal paths (which mandate POSIX format) and dictionary keys (not filesystem paths) respectively. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> Signed-off-by: yurekami <yurekami@users.noreply.github.com> * Update common.py Signed-off-by: Jason <jasoli@nvidia.com> * Apply isort and black reformatting Signed-off-by: blisc <blisc@users.noreply.github.com> --------- Signed-off-by: yurekami <yurekami@users.noreply.github.com> Signed-off-by: Jason <jasoli@nvidia.com> Signed-off-by: blisc <blisc@users.noreply.github.com> Co-authored-by: yurekami <yurekami@users.noreply.github.com> Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com> Co-authored-by: Jason <jasoli@nvidia.com> Co-authored-by: blisc <blisc@users.noreply.github.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.
Summary
Fixes #15113
Changed path parsing to use
PurePosixPathinstead ofstr.split("/")for extracting filenames from:This ensures consistent behavior across platforms and properly handles edge cases.
Files modified:
nemo/core/connectors/save_restore_connector.pynemo/core/classes/common.pyTest plan