mirror of
https://github.com/astral-sh/uv.git
synced 2025-07-07 21:35:00 +00:00
Warn when unused pyproject.toml
configuration is detected (#5025)
## Summary Closes https://github.com/astral-sh/uv/issues/5022.
This commit is contained in:
parent
6a6168ec78
commit
5f851d1d19
3 changed files with 188 additions and 6 deletions
|
@ -92,6 +92,20 @@ impl FilesystemOptions {
|
|||
let options: Options = toml::from_str(&content)
|
||||
.map_err(|err| Error::UvToml(path.user_display().to_string(), err))?;
|
||||
|
||||
// If the directory also contains a `[tool.uv]` table in a `pyproject.toml` file,
|
||||
// warn.
|
||||
let pyproject = dir.as_ref().join("pyproject.toml");
|
||||
if let Some(pyproject) = fs_err::read_to_string(pyproject)
|
||||
.ok()
|
||||
.and_then(|content| toml::from_str::<PyProjectToml>(&content).ok())
|
||||
{
|
||||
if pyproject.tool.is_some_and(|tool| tool.uv.is_some()) {
|
||||
warn_user!(
|
||||
"Found both a `uv.toml` file and a `[tool.uv]` section in an adjacent `pyproject.toml`. The `[tool.uv]` section will be ignored in favor of the `uv.toml` file."
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
debug!("Found workspace configuration at `{}`", path.display());
|
||||
return Ok(Some(Self(options)));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue