sopel
sopel copied to clipboard
Use XDG Base Directory Specification
The problem
Sopel currently places its configuration, data, and cache in ~/.sopel
. This clutters up users' home directories.
The solution
Follow the XDG Base Directory Specification, at minimum defaulting to $XDG_CONFIG_HOME (e.g. ~/.config/sopel
), and ideally using $XDG_DATA_HOME (e.g. ~/.local/share/sopel
) and $XDG_CACHE_HOME (e.g. ~/.cache/sopel
) as appropriate.
The specification can be quite tricky to follow with a DIY approach, but I can speak very highly for the single-file (i.e. easy to vendor) library appdirs
for this purpose. It also has reasonable behaviors on MacOS and Windows where the spec makes a bit less sense. There's also platformdirs
which is a fork with more activity, although it is a little harder to vendor.
I had a quick poke around in Sopel's guts for where the current default configuration comes from but came away a little cross-eyed, so I'm not sure exactly where the relevant changes would go.
I really like the idea of following XDG specification. However, with more than 160 PRs already merged for the 8.0.0 milestone, I don't think it's a good idea to implement that change in this version.
Maybe we can think about it in 8.1.0 with an initial approach that is fully backward compatible, and start a full migration y Sopel 9?
Might get bumped again to 9.0, but yeah. You had the same thought as I did last time I went through the issue list for 8.0 so let's delay it.