You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Why doesn't astropy use ~/.config/astropy by default (on Unix-like systems)? #6803
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.
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 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?
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.
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)?[/+]on Dec 6, 2018
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.
And just in case anyone is getting shaky legs from the current size of my PR, just a note that I already worked out a spec for how to fix this issue as well and I don't expect it to be significantly more complicated than what I already have. It is a different spec though.
Activity
saimn commentedon Nov 6, 2017
Because XDG_CONFIG_HOME and XDG_CACHE_HOME are Linux standards for config and cache (usually
~/.configand~/.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 anASTROPY_CONFIG_DIRvariable instead to customize the$HOME/.astropy/paths directly, instead of trying to follow the xdg spec.weaverba137 commentedon Nov 17, 2017
OK, maybe I should rephrase this: Why doesn't astropy use
~/.config/astropyby default (on Unix-like systems)?Cadair commentedon Dec 6, 2018
@weaverba137 I came here because I wanted to know the answer to "Why doesn't astropy use
~/.config/astropyby default (on Unix-like systems)?" Should we make this the title of the issue or something?weaverba137 commentedon Dec 6, 2018
I would be happy to change the title.
Cadair commentedon Dec 6, 2018
So from
get_config_dirdocstring:This is not the "correct" behaviour on a linux system as far as I am aware.
Cadair commentedon Dec 6, 2018
ping @eteq as he wrote it apparently.
[-]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)?[/+]pllim commentedon 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 commentedon Mar 30, 2020
OK, but as @Cadair said:
Can we at least document that we are aware that this is not correct behavior?
Cadair commentedon Mar 30, 2020
We should absolutely do #8245 and I am -1 on closing this as wont-fix.
pllim commentedon 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 commentedon 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. 😄
neutrinoceros commentedon Apr 21, 2026
#19575 might be our only chance to close this, but it currently does not. Please let me know it should.
Cadair commentedon Apr 21, 2026
I'd vote a strong yes to fixing it if there's an opportunity
neutrinoceros commentedon Apr 21, 2026
And just in case anyone is getting shaky legs from the current size of my PR, just a note that I already worked out a spec for how to fix this issue as well and I don't expect it to be significantly more complicated than what I already have. It is a different spec though.
neutrinoceros commentedon Apr 22, 2026
and I think I just convinced myself of the overall superiority of this new spec while toying with it so the work is now actively underway in #19575