Skip to content

Commit

Permalink
Add docs
Browse files Browse the repository at this point in the history
  • Loading branch information
charliermarsh committed Oct 21, 2024
1 parent fc36dbd commit 06bda56
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
1 change: 0 additions & 1 deletion crates/uv-settings/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,6 @@ fn locate_system_config_xdg(value: Option<&str>) -> Option<PathBuf> {
let config_dirs = value.filter(|s| !s.is_empty()).unwrap_or(default);

for dir in env::split_paths(config_dirs) {
println!("dir: {:?}", dir);
let uv_toml_path = dir.join("uv").join("uv.toml");
if uv_toml_path.is_file() {
return Some(uv_toml_path);
Expand Down
20 changes: 13 additions & 7 deletions docs/configuration/files.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ in the nearest parent directory.

For `tool` commands, which operate at the user level, local configuration
files will be ignored. Instead, uv will exclusively read from user-level configuration
(e.g., `~/.config/uv/uv.toml`).
(e.g., `~/.config/uv/uv.toml`) and system-level configuration (e.g., `/etc/uv/uv.toml`).

In workspaces, uv will begin its search at the workspace root, ignoring any configuration defined in
workspace members. Since the workspace is locked as a single unit, configuration is shared across
Expand Down Expand Up @@ -40,13 +40,19 @@ index-url = "https://test.pypi.org/simple"
`[tool.uv]` section in the accompanying `pyproject.toml` will be ignored.

uv will also discover user-level configuration at `~/.config/uv/uv.toml` (or
`$XDG_CONFIG_HOME/uv/uv.toml`) on macOS and Linux, or `%APPDATA%\uv\uv.toml` on Windows. User-level
configuration must use the `uv.toml` format, rather than the `pyproject.toml` format, as a
`pyproject.toml` is intended to define a Python _project_.
`$XDG_CONFIG_HOME/uv/uv.toml`) on macOS and Linux, or `%APPDATA%\uv\uv.toml` on Windows; and
system-level configuration at `/etc/uv/uv.toml` (or `$XDG_CONFIG_DIRS/uv/uv.toml`) on macOS and
Linux, or `%SYSTEMDRIVE%\ProgramData\uv\uv.toml` on Windows.

If both project- and user-level configuration are found, the settings will be merged, with the
project-level configuration taking precedence. Specifically, if a string, number, or boolean is
present in both tables, the project-level value will be used, and the user-level value will be
User-and system-level configuration must use the `uv.toml` format, rather than the `pyproject.toml`
format, as a `pyproject.toml` is intended to define a Python _project_.

If project-, user-, and system-level configuration files are found, the settings will be merged,
with project-level configuration taking precedence over the user-level configuration, and user-level
configuration taking precedence over the system-level configuration.

For example, if a string, number, or boolean is present in both the project- and user-level
configuration tables, the project-level value will be used, and the user-level value will be
ignored. If an array is present in both tables, the arrays will be concatenated, with the
project-level settings appearing earlier in the merged array.

Expand Down

0 comments on commit 06bda56

Please sign in to comment.