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

IO import issues #787

Merged
merged 10 commits into from
Jun 14, 2021
Merged

IO import issues #787

merged 10 commits into from
Jun 14, 2021

Conversation

mtar
Copy link
Collaborator

@mtar mtar commented Jun 8, 2021

Description

Fixes an import error in io.py when optional dependencies are not available and changes error message when saving or loading a file that requires an optional dependency.

Issue resolved: #786
Issue resolved: #697

Changes proposed:

  • remove save_hdf5 from general all
  • skip tests using optional dependencies if not available
  • more descriptive error message for files that need an optional dependency.

Type of change

  • Bug fix (non-breaking change which fixes an issue)

Due Diligence

  • All split configurations tested
  • Multiple dtypes tested in relevant functions
  • Documentation updated (if needed)
  • Updated changelog.md under the title "Pending Additions"

Does this change modify the behaviour of other functions? If so, which?

no

@mtar mtar added the bug Something isn't working label Jun 8, 2021
@mtar mtar changed the title Bug/786 io depends Bug io import issues Jun 8, 2021
@mtar mtar changed the title Bug io import issues IO import issues Jun 8, 2021
@codecov
Copy link

codecov bot commented Jun 8, 2021

Codecov Report

Merging #787 (0c83a39) into master (e3ac1c1) will decrease coverage by 0.02%.
The diff coverage is 76.47%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #787      +/-   ##
==========================================
- Coverage   95.29%   95.26%   -0.03%     
==========================================
  Files          64       64              
  Lines        8944     8952       +8     
==========================================
+ Hits         8523     8528       +5     
- Misses        421      424       +3     
Flag Coverage Δ
gpu 94.39% <76.47%> (-0.03%) ⬇️
unit 90.82% <76.47%> (-0.03%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
heat/core/io.py 88.46% <76.47%> (-0.55%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e3ac1c1...0c83a39. Read the comment docs.

@mtar mtar requested review from Markus-Goetz and ClaudiaComito and removed request for Markus-Goetz June 8, 2021 09:10
@Markus-Goetz
Copy link
Member

I think I might have accidentally introduced this regression during the documentation overhaul. One problem remains with the current form, the conditionally defined functions, e.g. save_hdf5, are not included in the documentation. Do you see a way of fixing this?

@coquelin77
Copy link
Member

could we append the function name to __all__ in the case that it is defined? is that allowed?

@coquelin77
Copy link
Member

also i am fine with the PR not hitting the coverage target. this a fix that simply wont unless we test it with multiple venvs on the system, which seems like overkill

@mtar mtar force-pushed the bug/786-io-depends branch from 87d44c7 to 8344d89 Compare June 9, 2021 10:51
@mtar mtar changed the base branch from release/1.0.x to master June 9, 2021 10:52
Copy link
Member

@coquelin77 coquelin77 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, except that i dont think that it should be an ImportError

heat/core/io.py Outdated
if supports_hdf5():
return load_hdf5(path, *args, **kwargs)
else:
raise ImportError("hdf5 is required for file extension {}".format(extension))
Copy link
Member

Choose a reason for hiding this comment

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

i think that these should be either RunTimeErrors or TypeErrors. the issue that this is talking about is that the package is not installed.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I was using ImportError because it's an external package that needs to be imported.
I don't know if TypeError is good here as the function gets the right argument types. ValueError maybe.
A general RuntimeError might be the best here.

@mtar mtar merged commit cb468c0 into master Jun 14, 2021
@mtar mtar deleted the bug/786-io-depends branch June 14, 2021 13:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

import error not using hdf5 Output a more descriptive error when file format dependencies are not installed
4 participants