-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
[WIP] Make Pooch lazily create directories for python 3.7+ #4670
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
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-11 13:37:23 UTC |
if sys.version_info < (3, 7): | ||
from .data import data_dir | ||
|
||
def __getattr__(name): |
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.
very nice use of py3.7+ lazy loading :-).
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.
Yeah, lets work on this in a bit. I want to get this PR to be really tiny, since it is hard to test in a pytest way.
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.
Honestly that was my quick and dirty attempt. I am convinced there is an elegant solution here without even global variables, but it's been a long week (gave a skimage+napari workshop today) and I'm just not seeing it. I'm happy to have another pass at this in a few days after recharging my batteries, but anyone should feel free to give it a go in the meantime!
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 think image_fetcher needs to be made a class.... Was thinking about this problem in the shower and you know that is where the best ideas come!
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.
You're right. The whole problem is that we have to keep track of a lot of state — that's what classes are for! I was stubbornly treating the whole module as a big class.
This commit attempts to make our pooch fetcher a singleton global to the data module.
ok i rebased, but i must admit it needs serious review in light of some organizational changes in the original branch. sorry about that one. I'm also still not convinced that |
@emmanuelle please do it! Optional pooch will already solve the problem for the OP of #4660 since they are not using the sample data at all. |
Definitely do it. This will help people building on automated machines for sure. Unless they use conda... |
THe issue #4660 is solved. Is this still useful in any sense? |
I think the correct solution is a two pronged approach: Leaving the Allowing users that have pooch installed use the newer, larger datasets. I'm not super convinced, I have all the use cases right, I'll try to write a spec. |
Description
@jni just opening this up as a potential solution for #4660
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
.