Fix cloudpathlib error when package not available#62
Merged
Conversation
- Use _pathlib.CloudPath instead of cloudpathlib.CloudPath. The import here already has a bunch of logic baked in to check and fallback the pathtype if cloudpathlib isn't available. - For the conditional logic, make use of the cloudpathlib_is_available function to step into check - TODO: Add tests to make sure cloudpathlib functionality is working as expected
- Mark additional s3 test with to skip
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #62 +/- ##
==========================================
- Coverage 95.15% 95.14% -0.01%
==========================================
Files 7 7
Lines 495 494 -1
==========================================
- Hits 471 470 -1
Misses 24 24 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
nx10
approved these changes
Sep 10, 2025
Contributor
Author
Yeah, when I was first looking at this, I was thinking that the overlap probably covers it all, but on second thought, it probably doesn't catch some of the branching so would be good to combine test reports. I'll leave that for a separate PR. Going to merge this one in to patch import issue. |
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.
Resolves #61.
Uses
CloudPathas defined in_pathlib.py. Also checks forcloudpathlibavailability in first condition (potential definition ofCloudPathif library isn't defined).Additionally adds a test run to the CI without
cloudpathlibinstalled. Note, only the run withcloudpathlibinstalled generates a coverage report (there is overlap here anyways, aside from the 2 additional tests for cloud datasets). The additional test is more to catch any issues that may crop up without the additional package.