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

Enable global configuration files #3049

Merged
merged 1 commit into from
Apr 17, 2024
Merged

Enable global configuration files #3049

merged 1 commit into from
Apr 17, 2024

Conversation

charliermarsh
Copy link
Member

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.

@@ -75,6 +75,7 @@ dashmap = { version = "5.5.3" }
data-encoding = { version = "2.5.0" }
derivative = { version = "2.2.0" }
directories = { version = "5.0.1" }
dirs-sys = { version = "0.4.1" }
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is already a dependency because it powers directories under-the-hood, but exposes the low-level methods we need to use the custom XDG behavior.

@charliermarsh charliermarsh added the configuration Settings and such label Apr 16, 2024
@charliermarsh charliermarsh marked this pull request as ready for review April 16, 2024 00:22
Comment on lines 16 to 18
/// Load the global [`Workspace`].
pub fn global() -> Result<Option<Self>, WorkspaceError> {
Copy link
Member

@zanieb zanieb Apr 16, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we call this "user" instead? It's not the "global" or "system" workspace, it sounds like it should always be scoped to a user e.g. XDG_CONFIG_HOME is for user-specific configuration.

@@ -38,6 +51,27 @@ impl Workspace {
}
}

/// Returns the path to the global configuration directory.
///
/// This is similar to the `config_dir()` returned by the `dirs` crate, but it uses the
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm somewhat hesitant to diverge from the rust standard of using dirs here, can we file an upstream issue and link to the github discussion for this?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should chime in here: astral-sh/ruff#10739

Base automatically changed from charlie/workspace-iv to main April 17, 2024 17:32
@charliermarsh charliermarsh merged commit dfccdb0 into main Apr 17, 2024
38 checks passed
@charliermarsh charliermarsh deleted the charlie/workspace-v branch April 17, 2024 17:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
configuration Settings and such
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants