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
Store Python toolchains under XDG directory on macOS #4411
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 does uv 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:
warning: `uv toolchain list` is experimental and may change without warning.
cpython-3.12.4-macos-aarch64-none /opt/homebrew/opt/python@3.12/bin/python3.12
cpython-3.12.3-macos-aarch64-none /Users/luca/Library/Application Support/uv/toolchains/cpython-3.12.3-macos-aarch64-none/install/bin/python3
cpython-3.11.9-macos-aarch64-none /Users/luca/Library/Application Support/uv/toolchains/cpython-3.11.9-macos-aarch64-none/install/bin/python3
cpython-3.10.14-macos-aarch64-none /Users/luca/Library/Application Support/uv/toolchains/cpython-3.10.14-macos-aarch64-none/install/bin/python3
cpython-3.9.19-macos-aarch64-none /Users/luca/Library/Application Support/uv/toolchains/cpython-3.9.19-macos-aarch64-none/install/bin/python3
cpython-3.9.6-macos-aarch64-none /Library/Developer/CommandLineTools/usr/bin/python3
cpython-3.8.19-macos-aarch64-none /Users/luca/Library/Application Support/uv/toolchains/cpython-3.8.19-macos-aarch64-none/install/bin/python3
i.e. also Homebrew Python.
(I guess a uv pin or uv local command is coming soon, looking forward to it.)
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.
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. #4198 will address your question about the system interpreters being listed.
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.
changed the title [-]Store Python toolchains under XDG directory on macOS (?)[/-][+]Store Python toolchains under XDG directory on macOS[/+]on Jun 23, 2024
Activity
zanieb commentedon Jun 19, 2024
We're talking about it e.g. #2236 and #3049 and astral-sh/ruff#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.
zanieb commentedon Jun 19, 2024
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.
baggiponte commentedon Jun 19, 2024
Thanks for the prompt reply! As far as Python interpreter discovery, what do you plan to support? Anyway, feel free to close this 😊
zanieb commentedon Jun 19, 2024
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. #4198 will address your question about the system interpreters being listed.
dsully commentedon Jun 20, 2024
+1 for
~/.local, etc. Effectively treating macOS like Linux in this regard.hoechenberger commentedon Jun 20, 2024
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.
baggiponte commentedon Jun 20, 2024
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
jetbrainsstuff under my~/.local/sharetoo.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.
hoechenberger commentedon Jun 20, 2024
@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
dsully commentedon Jun 20, 2024
To be clear - as long as the
$XDG_*variables are respected as @baggiponte says, I'm good with that approach.hoechenberger commentedon Jun 20, 2024
Ah! Got you! Yes this does make sense.
charliermarsh commentedon Jun 23, 2024
For context, we do use XDG for configuration file discovery so there's some precedent there.
[-]Follow XDG spec on macOS (?)[/-][+]Store Python toolchains under XDG directory on macOS (?)[/+][-]Store Python toolchains under XDG directory on macOS (?)[/-][+]Store Python toolchains under XDG directory on macOS[/+]4 remaining items
zanieb commentedon Jun 30, 2024
Yeah of course — that's described in #3560 but I'll create a specific issue.
edit: We should at least do #4671
zanieb commentedon Jul 3, 2024
I've opened a pull request to support the variable if set #4769
Migrate to XDG and Linux strategy for macOS directories (#5806)
Migrate to XDG and Linux strategy for macOS directories (#5806)
Migrate to XDG and Linux strategy for macOS directories (#5806)
Migrate to XDG and Linux strategy for macOS directories (astral-sh#5806)