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

[ENH] File: explicit file format choice #5736

Merged
merged 7 commits into from
Jan 7, 2022

Conversation

markotoplak
Copy link
Member

Issue

Resolves #5724

Description of changes

image

For files, the reader used was already stored in .file_format, which could be either a reader's qualified name or None (which means that reader is detected depending on extension and priority).

All available readers are shown in a combo box.

For URLs, the reader selection is disabled. That part would have to be refactored a bit so that the chosen reader could be saved.

Includes
  • Code changes
  • Tests
  • Documentation

@markotoplak markotoplak marked this pull request as draft December 13, 2021 17:59
@codecov
Copy link

codecov bot commented Dec 13, 2021

Codecov Report

Merging #5736 (9586906) into master (06d7f24) will increase coverage by 0.00%.
The diff coverage is 98.78%.

@@           Coverage Diff           @@
##           master    #5736   +/-   ##
=======================================
  Coverage   86.16%   86.16%           
=======================================
  Files         315      315           
  Lines       66195    66258   +63     
=======================================
+ Hits        57035    57092   +57     
- Misses       9160     9166    +6     

@borondics
Copy link
Member

borondics commented Dec 14, 2021

I think this is great, but I have two comments:

The error message if the selected reader is not the right one is still not too informative:
image

Then, the widget forgets the selected reader for subsequent files. I think it would be nice to save this in the widget settings because one could expect that the same user works with the same type of TXT files. The best solution here would be to first try to autodetect and then fall back to the last selected for that file extension in my opinion. Might be difficult to store all this data though...

@markotoplak
Copy link
Member Author

@borondics, I do not want to do any application of the currently selected reader onto a new file into this PR. Added automatics like this can lead to confusion (remember disappearing settings is Select Columns or Feature Constructor) so I would not add it unless absolutely sure. Furthermore, your proposed change would change the current behavior, while this PR aims to keep it exactly as it was, it only introduces the possibility of explicit modifications.

The message is very precise (= not useful for non-developers), just click/mouseover on it. :)

@borondics
Copy link
Member

OK, I understand that this PR is aimed only for the new placement of the file loader selector. I hope though that in another PR the saving will be also possible.

For the error: yeah, I know that there is a longer message on moouse-over but something for the normal user wouldn't hurt either. I guess there are more users than developers, so it is not absurd to also let them clearly know what is happening. :)

@markotoplak markotoplak force-pushed the owfile-reader branch 2 times, most recently from bdf5087 to 48835e8 Compare December 16, 2021 12:28
@markotoplak
Copy link
Member Author

Pylint has a fun complaint: there are too many public methods (=tests) in the test class. :)

@markotoplak markotoplak changed the title [RFC][ENH] File: explicit file format choice [ENH] File: explicit file format choice Dec 16, 2021
@markotoplak markotoplak marked this pull request as ready for review December 16, 2021 13:51
@ajdapretnar
Copy link
Contributor

ajdapretnar commented Dec 17, 2021

I checked and this PR breaks nothing in Text. 👍

A small comment. It would be nice(r) if add-on readers would be listed separately. I.e.
.tab
.csv
.pkl
.basket (is this even core?)
-----
.HDF5
.dat
.gsf....

So readers from each add-on would be in a separate "category".

@VesnaT
Copy link
Contributor

VesnaT commented Dec 17, 2021

If I try to open the Iris dataset with an Excel reader, I get a wrong error message:

image

@markotoplak markotoplak force-pushed the owfile-reader branch 2 times, most recently from 4db93e4 to aea0835 Compare January 5, 2022 12:47
@markotoplak
Copy link
Member Author

I tried to address comments by @ajdapretnar and @VesnaT: error reporting is now fixed and the list is sorted per package name.

@markotoplak markotoplak force-pushed the owfile-reader branch 2 times, most recently from 9f35359 to 851b6a4 Compare January 5, 2022 13:52
@VesnaT VesnaT merged commit c82bde2 into biolab:master Jan 7, 2022
@markotoplak markotoplak deleted the owfile-reader branch February 28, 2022 11:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

File widget: make file readers expicit
4 participants