Skip to content
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

Use informative error message for optional dependency imports #118

Merged
merged 2 commits into from
Oct 26, 2022

Conversation

maxrjones
Copy link
Member

Description of proposed changes

This PR adds information about optional dependencies to the installation instructions and improves the ImportError message when trying to use the data loaders without having PyTorch and/or TensorFlow installed.

Open to opinions about whether these error messages should also be used for the torch and tf xarray accessors and if it's necessary to add tests for this case. This drops code coverage to 99%.

Fixes #

Co-authored-by: Anderson Banihirwe <axbanihirwe@gmail.com>
@maxrjones maxrjones added the maintenance Maintenance tasks label Oct 26, 2022
@codecov-commenter
Copy link

codecov-commenter commented Oct 26, 2022

Codecov Report

Merging #118 (b971122) into main (77c470b) will decrease coverage by 2.02%.
The diff coverage is 50.00%.

@@             Coverage Diff             @@
##              main     #118      +/-   ##
===========================================
- Coverage   100.00%   97.97%   -2.03%     
===========================================
  Files            5        5              
  Lines          192      198       +6     
  Branches        35       35              
===========================================
+ Hits           192      194       +2     
- Misses           0        4       +4     
Impacted Files Coverage Δ
xbatcher/loaders/keras.py 90.47% <50.00%> (-9.53%) ⬇️
xbatcher/loaders/torch.py 93.93% <50.00%> (-6.07%) ⬇️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

Copy link
Member

@andersy005 andersy005 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me 👍🏽. Thank you, @maxrjones

@maxrjones maxrjones merged commit 5558310 into xarray-contrib:main Oct 26, 2022
@maxrjones maxrjones deleted the informative-import-errors branch October 26, 2022 19:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
maintenance Maintenance tasks
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants