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

Respect XDG_DATA_HOME on macOS if set #4769

Closed
wants to merge 1 commit into from
Closed

Respect XDG_DATA_HOME on macOS if set #4769

wants to merge 1 commit into from

Conversation

zanieb
Copy link
Member

@zanieb zanieb commented Jul 3, 2024

Rather than using Application Support for state storage, we use XDG_DATA_HOME if it is set. This feels like a reasonable compromise respecting the OS defaults while allowing users to opt-in to XDG.

Closes #4411

e.g.

❯ export XDG_DATA_HOME="$HOME/.local/share"
❯ cargo run -- python install
Looking for installation Python 3.12.1 (any-3.12.1-any-any-any)
Looking for installation Python 3.11.7 (any-3.11.7-any-any-any)
Looking for installation Python 3.10.13 (any-3.10.13-any-any-any)
Looking for installation Python 3.9.18 (any-3.9.18-any-any-any)
Looking for installation Python 3.8.18 (any-3.8.18-any-any-any)
Looking for installation Python 3.8.12 (any-3.8.12-any-any-any)
Found 6/6 installations requiring installation
Downloading cpython-3.12.1-macos-aarch64-none
Downloading cpython-3.11.7-macos-aarch64-none
Downloading cpython-3.10.13-macos-aarch64-none
Downloading cpython-3.9.18-macos-aarch64-none
Installed Python 3.12.1 to /Users/zb/.local/share/uv/python/cpython-3.12.1-macos-aarch64-none
Installed Python 3.11.7 to /Users/zb/.local/share/uv/python/cpython-3.11.7-macos-aarch64-none
Installed Python 3.10.13 to /Users/zb/.local/share/uv/python/cpython-3.10.13-macos-aarch64-none
Installed Python 3.9.18 to /Users/zb/.local/share/uv/python/cpython-3.9.18-macos-aarch64-none
Downloading cpython-3.8.18-macos-aarch64-none
Downloading cpython-3.8.12-macos-aarch64-none
Installed Python 3.8.18 to /Users/zb/.local/share/uv/python/cpython-3.8.18-macos-aarch64-none
Installed Python 3.8.12 to /Users/zb/.local/share/uv/python/cpython-3.8.12-macos-aarch64-none
Installed 6 installations in 8s

@zanieb zanieb added configuration Settings and such preview Experimental behavior labels Jul 3, 2024
@konstin
Copy link
Member

konstin commented Jul 3, 2024

In ruff, we're using etcetera for xdg directories, is there a reason not to do this in uv, too?

@zanieb
Copy link
Member Author

zanieb commented Jul 3, 2024

I'm just following the patterns we're using in our other crates here. I don't have context on why not etcetera, cc @charliermarsh. We could change separately from this if we want.

@zanieb
Copy link
Member Author

zanieb commented Jul 3, 2024

Since we're not a GUI application I'm basically down to just move over to XDG entirely too btw.

@charliermarsh
Copy link
Member

I'm planning to move us to XDG entirely for macOS (maybe not for the cache for now, though). How much do we care about backwards-compatibility here given that it's preview-only?

If we make it backwards-compatible, we may need to "never upgrade" existing users (since we'd just detect if /Users/crmarsh/Library/Application Support/uv exists and use that). Or we could support both (read-only from /Users/crmarsh/Library/Application Support/uv, read/write to XDG), but it's more work of course.

@zanieb
Copy link
Member Author

zanieb commented Aug 5, 2024

You could just move it if we find it in the old location? That's what I did when I renamed the Python directory. We could make a link?

@charliermarsh
Copy link
Member

Hmm, will there be any absolute references to things in the existing folder? Like paths to interpreters? Not sure...

@zanieb
Copy link
Member Author

zanieb commented Aug 5, 2024

Fair, that could be problematic. I guess we "never upgrade" and provide instructions for manual migration?

@charliermarsh
Copy link
Member

Tragic!

@charliermarsh
Copy link
Member

Continuing on in #5806.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
configuration Settings and such preview Experimental behavior
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Store Python toolchains under XDG directory on macOS
3 participants