mirror of
https://github.com/astral-sh/uv.git
synced 2025-08-04 19:08:04 +00:00
Add override namespace to pyproject.toml/uv.toml (#3839)
<!-- Thank you for contributing to uv! To help us out with reviewing, please consider the following: - Does this pull request include a summary of the change? (See below.) - Does this pull request include a descriptive title? - Does this pull request include references to any relevant issues? --> ## Summary See #3834 . This PR adds a new namespace, `override-dependencies`, to pyproject.toml/uv.toml. This namespace assumes that the dependencies you want to override are written in the form of `requirements.txt`. a example of pyproject.toml ```toml [project] name = "example" version = "0.0.0" dependencies = [ "flask==3.0.0" ] [tool.uv] override-dependencies = [ "werkzeug==2.3.0" ] ``` This will improve usability by allowing you to override dependencies without having to specify the --override option when running `uv pip compile/install`. ## Test Plan added test to `crates/uv/tests/pip_compile.rs`. --------- Co-authored-by: konstin <konstin@mailbox.org>
This commit is contained in:
parent
1b769b054c
commit
5c776939d2
13 changed files with 293 additions and 8 deletions
|
@ -9,6 +9,8 @@ pub enum RequirementOrigin {
|
|||
File(PathBuf),
|
||||
/// The requirement was provided via a local project (e.g., a `pyproject.toml` file).
|
||||
Project(PathBuf, PackageName),
|
||||
/// The requirement was provided via a workspace.
|
||||
Workspace,
|
||||
}
|
||||
|
||||
impl RequirementOrigin {
|
||||
|
@ -17,6 +19,8 @@ impl RequirementOrigin {
|
|||
match self {
|
||||
RequirementOrigin::File(path) => path.as_path(),
|
||||
RequirementOrigin::Project(path, _) => path.as_path(),
|
||||
// Multiple toml are merged and difficult to track files where Requirement is defined. Returns a dummy path instead.
|
||||
RequirementOrigin::Workspace => Path::new("(workspace)"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue