-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Optional pooch dependency #4666
Conversation
Hello @hmaarrfk! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:
Comment last updated at 2020-05-10 22:58:31 UTC |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@hmaarrfk I've suggested some typo fixes and some minor rephrasing. I also suggest keeping some of the tests I added recently, which still make sense even with pooch being optional. Otherwise this is good to go, approving so I don't hold this up for another round.
skimage/data/__init__.py
Outdated
"The requested file is part of the scikit-image distribution, " | ||
"but requries the installation of an optional dependency, pooch, " | ||
"to be used. To install pooch, use your preffered python " | ||
"package manager. Follow installation instruction found at " | ||
"https://scikit-image.org/docs/stable/install.html" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"The requested file is part of the scikit-image distribution, " | |
"but requries the installation of an optional dependency, pooch, " | |
"to be used. To install pooch, use your preffered python " | |
"package manager. Follow installation instruction found at " | |
"https://scikit-image.org/docs/stable/install.html" | |
"The requested file is part of the scikit-image distribution, " | |
"but requires the installation of an optional dependency, pooch. " | |
"To install pooch, use your preferred python package manager. " | |
"For example: `conda install -c conda-forge pooch`, or " | |
"`pip install -m pooch`." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I prefer not pointing to our instructions since they don't have any pooch-specific documentation. I would find this confusing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we think a little longer term about this? We can work on adding instructions, lets make sure that we are doing good by future generations of developers.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see two kinds of people:
- Advanced users: will use shortcuts to get to google, and to search
pooch python
which will give them a package, that they will know to use conda/pip automatically. These don't need any instructions. - Novice users, that will be tempted to use
sudo pip install pooch
.
I am trying to help the novice users by pointing them to more fleshed out instructions than a one liner (that will likely not work and ensure their frustration).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reading over this, I strongly disagree with the instructions provided.
For example, I strongly discourage
conda install -c conda-forge pooch
I really think there should be a single place where we provide install instructions, and not adhoc like an Error message.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I raised my concerns in:
#4672
|
||
|
||
@skipif(OFFLINE, reason='No internet connection') | ||
def test_download_all(): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a good reason to remove this test?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test really doen't play with parallel testing.... affecting the global filesystem state is not fun.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it also may induce a full download of all the files for the end users. not fun on our laptops when travelling with 4G connections.
def test_cells_3d(): | ||
"""Needs internet connection.""" | ||
path = fetch('data/cells.tif') | ||
image = io.imread(path) | ||
assert image.shape == (60, 256, 256) | ||
|
||
|
||
def test_data_dir(): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why remove this test? I feel like it's important.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, I added it back.
@hmaarrfk feel free to revert the last commit, I'm not super happy with it, but I think we should be able to make the initialisation lazy, and just fall back on our legacy dir in the meantime. |
I wanted to leave the laziness to an other PR for now. Seems hard to get right |
Super thanks for the rest! |
10ed769
to
26f5501
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One question related to pooch: I don't remember why we are deprecating |
Co-authored-by: Emmanuelle Gouillart <emma@plot.ly>
I'm not too sure I remember why we deprecated Having to use For certain datasets, they are more complicated than "just a single image" so having a function that could return more flexible formats, like tuples was preferred. |
@emmanuelle well I think the "new way" is supposed to be something like: data.download_all()
cells = io.imread(os.path.join(data.data_dir, 'data/cells.tif')) which is nice because it looks more like normal IO than |
@meeseeksdev backport to v0.17.x |
Owee, I'm MrMeeseeks, Look at me. There seem to be a conflict, please backport manually. Here are approximate instructions:
And apply the correct labels and milestones. Congratulation you did some good work ! Hopefully your backport PR will be tested by the continuous integration and merged soon! If these instruction are inaccurate, feel free to suggest an improvement. |
@jni thanks for the explanations. Yes, I agree that we should also have a way to download and open individual files. Probably not high priority since we indeed have |
i guess the easy way didn't work. |
* Revert "Forget legacy data dir (#4662)" This reverts commit 137f144. * Make pooch an optional requirement * Make pooch an optional dependency * Add Pooch to documentation requirements * Fixup add documentation to the docstring * Add cell.png to the legacy registry * Update datadir order * Try to avoid circular stuff * Split up the init pooch function * Refine error message when pooch not found * Remove unused imports * Add the os directory test again * Add a test for download all * Add an error for installing Pooch. * Crosslink to our installation instructions * Update skimage/data/__init__.py Co-authored-by: Emmanuelle Gouillart <emma@plot.ly> Co-authored-by: Juan Nunez-Iglesias <juan.nunez-iglesias@monash.edu> Co-authored-by: Emmanuelle Gouillart <emma@plot.ly>
Description
Makes pooch an optional dependency. This was at least in my original design plan. Not sure why it never got in, I'll sift through the comments again.
TODO: Pooch contribution guide.
When merged backport with:
Note that this does NOT address #4660 or #4664
Closes #4665
Checklist
./doc/examples
(new features only)./benchmarks
, if your changes aren't covered by anexisting benchmark
For reviewers
later.
__init__.py
.doc/release/release_dev.rst
.