Skip to content

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

Closed

Description

@weaverba137

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.

Activity

  1. saimn commented on Nov 6, 2017

    @saimn
    Contributor

    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.

  2. weaverba137 commented on Nov 17, 2017

    @weaverba137
    MemberAuthor

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

  3. Cadair commented on Dec 6, 2018

    @Cadair
    Member

    @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?

  4. weaverba137 commented on Dec 6, 2018

    @weaverba137
    MemberAuthor

    I would be happy to change the title.

  5. Cadair commented on Dec 6, 2018

    @Cadair
    Member

    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.

  6. Cadair commented on Dec 6, 2018

    @Cadair
    Member

    ping @eteq as he wrote it apparently.

  7. 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
  8. pllim commented on Mar 30, 2020

    @pllim
    Member

    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.

  9. weaverba137 commented on Mar 30, 2020

    @weaverba137
    MemberAuthor

    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?

  10. Cadair commented on Mar 30, 2020

    @Cadair
    Member

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

  11. pllim commented on Mar 30, 2020

    @pllim
    Member

    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.

  12. Cadair commented on Mar 30, 2020

    @Cadair
    Member

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

  13. added and removed
    Close?Tell stale bot that this issue/PR is stale
    on Mar 30, 2020
  14. neutrinoceros commented on Apr 21, 2026

    @neutrinoceros
    Contributor

    #19575 might be our only chance to close this, but it currently does not. Please let me know it should.

  15. Cadair commented on Apr 21, 2026

    @Cadair
    Member

    I'd vote a strong yes to fixing it if there's an opportunity

  16. neutrinoceros commented on Apr 21, 2026

    @neutrinoceros
    Contributor

    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.

  17. neutrinoceros commented on Apr 22, 2026

    @neutrinoceros
    Contributor

    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

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions