Closed baggiponte closed 1 month ago
We're talking about it e.g. https://github.com/astral-sh/uv/pull/2236 and https://github.com/astral-sh/uv/pull/3049 and https://github.com/astral-sh/ruff/issues/10739
I think it's fairly clear that people prefer the XDG directory for configuration on macOS but I'm not sure what to think of application "state" like this.
Personally I'm pretty interested it's just weird to go against the platform standard and notably our cache is also not using the XDG directory on macOS.
Thanks for the prompt reply! As far as Python interpreter discovery, what do you plan to support? Anyway, feel free to close this 😊
I'm happy to leave it open to gauge interest. Maybe we need a special toggle.
Python interpreter discovery is a whole thing :) I don't think we should chat about it in the issue, but you could take a look at the supported sources. https://github.com/astral-sh/uv/issues/4198 will address your question about the system interpreters being listed.
+1 for ~/.local
, etc. Effectively treating macOS like Linux in this regard.
Just chiming in here to say that I'd rather keep the current behavior. XDG is not relevant for macOS and I'd like uv to follow the platform's standards, not those of a Linux system. That said, I have not yet read any of the referenced issues / discussions.
Just chiming in here to say that I'd rather keep the current behavior. XDG is not relevant for macOS and I'd like uv to follow the platform's standards, not those of a Linux system. That said, I have not yet read any of the referenced issues / discussions.
I see your point, but there are already plenty of programs that, if XDG_* vars are set on macos, will comply with that. It's handy because as a developer it improves the way I manage things (dotfiles, knowing where to go when I need to free up ram...). I don't remember how it ended up there, but there are a bunch of jetbrains
stuff under my ~/.local/share
too.
It's also fair to say there are plenty of programs that don't care. VSCode, for example, slams everything under $HOME
, IIRC plugins included.
EDIT: My point is: it feels it's more of a standard for GUIs/Applications than programs.
@baggiponte I absolutely agree that many programs don't respect the OS conventions 😃 When developing Python packages, for example, I therefore make use of platformdirs
, which automatically does "the right thing" when it comes to figuring out where to store config files, temporary data etc. I'd argue it's good practice to follow this approach ... I'm not looking to start a fight over this :) just wanted to share my opinion.
best wishes! Richard
To be clear - as long as the $XDG_*
variables are respected as @baggiponte says, I'm good with that approach.
Ah! Got you! Yes this does make sense.
For context, we do use XDG for configuration file discovery so there's some precedent there.
Another datapoint is that pipx
uses the XDG spec for storing installed tools.
Another datapoint is that
pipx
uses the XDG spec for storing installed tools.
Speaking of, tools that are installed with uv tool install
will have to be added to $PATH
somehow. I don't think I ever saw adding $HOME/Library/Application Support/uv/
to $PATH
. IIRC, rye
prompts you to use shims.
Tool installation places binaries entry points according to the XDG specification on all platforms https://github.com/astral-sh/uv/blob/13b0beb56fdc607c1f38d820dbf8c95c8fd0ce84/crates/uv-tool/src/lib.rs#L264-L275
But that doesn't mean we need to place the virtual environment there.
Regardless, I'm leaning towards switching to XDG entirely on macOS.
@zanieb - We still may need something like pipx ensurepath
for all this stuff though -- it's not guaranteed that they're on the user PATH IIUC.
Yeah of course — that's described in #3560 but I'll create a specific issue.
edit: We should at least do #4671
I've opened a pull request to support the variable if set https://github.com/astral-sh/uv/pull/4769
Hey there! Thanks for the amazing work. Using
uv
preview features and love it.I noticed
uv toolchain
installs under$HOME/Library/Application Support
. How doesuv
feel about following XDG spec? I saw ruff is doing it. For example,rye
installs under$HOME/.local/share
.Also when I do
uv toolchain list
I get this result:i.e. also Homebrew Python.
(I guess a
uv pin
oruv local
command is coming soon, looking forward to it.)