WIP: Started a data module, to eventually replace the data folder.#25
WIP: Started a data module, to eventually replace the data folder.#25arokem wants to merge 1 commit intouwescience:masterfrom
Conversation
| from urllib.request import urlopen, urljoin | ||
|
|
||
| # Set a user-writeable file-system location to put files: | ||
| SHABLONA_HOME = op.join(os.path.expanduser('~'), '.shablona') |
There was a problem hiding this comment.
How about pulling from an environment variable (SHABLONA_DATA_PATH), and defaulting to this?
There was a problem hiding this comment.
Also, I tend to avoid putting data in a hidden directory--I use those for settings only, in general. Just a note about my preference, no request for change :)
There was a problem hiding this comment.
Scikit-learn allows an optional environment variable; see https://github.com/scikit-learn/scikit-learn/blob/master/sklearn/datasets/base.py#L72
There was a problem hiding this comment.
If it's going to be hidden, please use an XDG-compliant directory instead of cluttering ~.
There was a problem hiding this comment.
Thanks for taking a look, and thanks for the comment. What is an XDG compliant directory?
From a brief look around, it seems that these are often directories like /usr/local/, which are not always user-writeable. This needs to be user-writeable! But if I got it all wrong, please educate me. Better yet, a proposal for what to replace this with would be much appreciated.
There was a problem hiding this comment.
Something that follows the XDG basedir standard.
Basically, if it's data, it goes in $XDG_DATA_HOME, if it's cache, it can go in $XDG_CACHE_HOME. If these variables are not defined, they default to $HOME/.local/share and $HOME/.cache, respectively. And then you'd place it in an application-defined subdirectory of those.
There's also the appdirs package that will find the correct location for these sorts of things on all platforms.
Should eventually deal with #16