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

WIP: Started a data module, to eventually replace the data folder. #25

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

arokem
Copy link
Contributor

@arokem arokem commented Feb 22, 2016

Should eventually deal with #16

from urllib.request import urlopen, urljoin

# Set a user-writeable file-system location to put files:
SHABLONA_HOME = op.join(os.path.expanduser('~'), '.shablona')
Copy link
Contributor

Choose a reason for hiding this comment

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

How about pulling from an environment variable (SHABLONA_DATA_PATH), and defaulting to this?

Copy link
Contributor

Choose a reason for hiding this comment

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

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 :)

Copy link
Member

Choose a reason for hiding this comment

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

Scikit-learn allows an optional environment variable; see https://github.com/scikit-learn/scikit-learn/blob/master/sklearn/datasets/base.py#L72

Copy link

Choose a reason for hiding this comment

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

If it's going to be hidden, please use an XDG-compliant directory instead of cluttering ~.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

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.

Copy link

@QuLogic QuLogic Jun 16, 2016

Choose a reason for hiding this comment

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

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.

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.

None yet

4 participants