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

Global Config Discovery: use $XDG_CONFIG_HOME on macOS #10739

Open
SPiCaRiA opened this issue Apr 2, 2024 · 9 comments · May be fixed by #11115
Open

Global Config Discovery: use $XDG_CONFIG_HOME on macOS #10739

SPiCaRiA opened this issue Apr 2, 2024 · 9 comments · May be fixed by #11115
Assignees
Labels
configuration Related to settings and configuration

Comments

@SPiCaRiA
Copy link

SPiCaRiA commented Apr 2, 2024

Hi, I'm newly migrating to ruff and it works so far so good for me, thank you for making this great tool!

However, I noticed that ruff uses the config_dir in dirs crates, which goes to $HOME/Library/Application Support under macOS. Generally I believe that as a CLI tool (and like many others), ruff should probably stick with XDG config home under macOS. When I look into my $HOME/Library/Application Support, they're almost all GUI application stuffs. Also, I think it is expected & intuitional to read config from $XDG_CONFIG_HOME since macOS mostly behave in *nix way.

Please let me know what you think :)

@zanieb zanieb added the configuration Related to settings and configuration label Apr 2, 2024
@zanieb
Copy link
Member

zanieb commented Apr 2, 2024

This seems reasonable to me but I'd like to hear from someone else on our team first too.

@BurntSushi
Copy link
Member

We have a similar request in a comment for uv as well: astral-sh/uv#1511

I'm not a macOS user so I don't have a good sense of what the right choice is. But my understanding is that XDG_CONFIG_HOME is commonly used on macOS. I have a fair number of things in my ~/.config directory on my test mac mini for example.

@zanieb
Copy link
Member

zanieb commented Apr 2, 2024

I prefer Linux to macOS but use macOS as a daily driver and I would be very confused if ~/.config was not a valid configuration path.

@charliermarsh
Copy link
Member

I use macOS exclusively. Honestly, I wouldn't know where to expect the config to go. I'd have to look it up in the docs for any given tool. But looking at my machine, I do think ~/.config is more appropriate.

@baggiponte
Copy link

That was a matter of discussion for PDM too (which does not recognise the XDG_* vars for macOS). PDM does this because the underlying Python package platformdirs does this. As a mac user who versions their dotfiles, I spent a bit of time to make sure that as many projects as I use can save data under ~/.config. It makes the most sense, it's more portable.

@konstin
Copy link
Member

konstin commented Apr 17, 2024

Could you report this upstream at https://github.com/dirs-dev/dirs-rs? I'm not a mac user so i'm not qualified to weigh in on this, i just wouldn't want to diverge from the effective rust standard without an upstream discussion first

@BurntSushi
Copy link
Member

@konstin I think it's been discussed before upstream and they are pretty opposed: dirs-dev/directories-rs#47

I don't think I'd consider dirs-rs to be an effective Rust standard personally. But it is probably the most popular implementation of XDG.

There's also some other discussion that touches on this topic here: https://internals.rust-lang.org/t/pre-rfc-split-cargo-home/19747

@BurntSushi
Copy link
Member

And in particular, it looks like dirs won't respect XDG_CONFIG_HOME on macOS? dirs-dev/directories-rs#47 (comment)

@konstin
Copy link
Member

konstin commented Apr 17, 2024

If we want xdg over the platform default on mac, we should consider switching to something like etcetera's Xdg and etcetera::app_strategy::choose_app_strategy ("Returns the current OS’s default AppStrategy This uses the Windows strategy on Windows, and Xdg everywhere else.") over directories.

charliermarsh added a commit to astral-sh/uv that referenced this issue Apr 17, 2024
## Summary

Enables `uv` to read configuration from (e.g.)
`/Users/crmarsh/.config/uv/uv.toml` on macOS and Linux, and
`C:\Users\Charlie\AppData\Roaming\uv\uv.toml` on Windows.

This differs slightly from Ruff, which uses the `Application Support`
directory on macOS. But I've deviated here. based on the preferences
expressed in astral-sh/ruff#10739.
@charliermarsh charliermarsh self-assigned this Apr 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
configuration Related to settings and configuration
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants