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

Why doesn't astropy use ~/.config/astropy by default (on Unix-like systems)? #6803

Open
weaverba137 opened this issue Oct 31, 2017 · 11 comments

Comments

@weaverba137
Copy link
Member

If $XDG_CONFIG_HOME is set, astropy will look for configuration files in $XDG_CONFIG_HOME/astropy/. However, it will not look for configuration files in $XDG_CONFIG_HOME/astropy/config/. Similarly, if $XDG_CACHE_HOME is set, astropy will look for cache files in $XDG_CACHE_HOME/astropy/, not $XDG_CACHE_HOME/astropy/cache. Why does the layout of $XDG_CONFIG_HOME/astropy/ have to be different from the layout of $HOME/.astropy/, which contains config/ and cache/ directories? Unless one knows that the layout is different, one would expect that $XDG_CONFIG_HOME/astropy/config/ and $XDG_CACHE_HOME/astropy/cache/ would be the directories to contain configuration and cache files.

@pllim pllim added the config label Nov 1, 2017
@saimn
Copy link
Contributor

saimn commented Nov 6, 2017

Because XDG_CONFIG_HOME and XDG_CACHE_HOME are Linux standards for config and cache (usually ~/.config and ~/.cache). For me the current behavior makes perfect sense, if XDG_CONFIG_HOME is set it goes to ~/.config/astropy (typically**) otherwise it is ~/.astropy/config (and the same for cache).

** Actually if XDG_CONFIG_HOME is not set, it should default to $HOME/.config, so Astropy uses this in a diverted way, which is confusing, see also #6516 recently. Maybe it would have been better to have an ASTROPY_CONFIG_DIR variable instead to customize the $HOME/.astropy/ paths directly, instead of trying to follow the xdg spec.

@weaverba137
Copy link
Member Author

OK, maybe I should rephrase this: Why doesn't astropy use ~/.config/astropy by default (on Unix-like systems)?

@Cadair
Copy link
Member

Cadair commented Dec 6, 2018

@weaverba137 I came here because I wanted to know the answer to "Why doesn't astropy use ~/.config/astropy by default (on Unix-like systems)?" Should we make this the title of the issue or something?

@weaverba137
Copy link
Member Author

I would be happy to change the title.

@Cadair
Copy link
Member

Cadair commented Dec 6, 2018

So from get_config_dir docstring:

This directory is typically $HOME/.astropy/config, but if the XDG_CONFIG_HOME environment variable is set and the $XDG_CONFIG_HOME/astropy directory exists, it will be that directory. If neither exists, the former will be created and symlinked to the latter.

This is not the "correct" behaviour on a linux system as far as I am aware.

@Cadair
Copy link
Member

Cadair commented Dec 6, 2018

ping @eteq as he wrote it apparently.

@weaverba137 weaverba137 changed the title Why is the layout of $XDG_CONFIG_HOME/astropy different from $HOME/.astropy? Why doesn't astropy use ~/.config/astropy by default (on Unix-like systems)? Dec 6, 2018
@pllim
Copy link
Member

pllim commented Mar 30, 2020

I would say that this ship has sailed. Unless we do something drastic like #8245, too much overhead in refactoring (including answering issues from confused users on the behavior change) for little reward.

@weaverba137
Copy link
Member Author

OK, but as @Cadair said:

This is not the "correct" behaviour on a linux system as far as I am aware.

Can we at least document that we are aware that this is not correct behavior?

@Cadair
Copy link
Member

Cadair commented Mar 30, 2020

We should absolutely do #8245 and I am -1 on closing this as wont-fix.

@pllim
Copy link
Member

pllim commented Mar 30, 2020

Feel free to open a PR for the desired documentation, as you already have an idea anyway.

As for #8245, it is not trivial. Maybe for 5.0 if someone is willing to invest the time and energy, but not before.

@Cadair
Copy link
Member

Cadair commented Mar 30, 2020

I agree it's not easy, but this bug should be fixed which is why I don't want to close it. 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants