Add uv add --no-editable (#5246)

## Summary

Resolves #5241

## Test Plan

```sh
# create a workspace with sub-packages `pkg-a` and `pkg-b`

$ cd ./pkg-b
$ cargo run -- add ./pkg-a --no-editable

$ cat ./pyproject.toml
[project]
name = "pkg-b"
version = "0.1.0"
description = "Add your description here"
readme = "README.md"
dependencies = [
    "pkg-a",
]

[tool.uv]
dev-dependencies = []

[tool.uv.sources]
pkg-a = { workspace = true, editable = false }
```
This commit is contained in:
Jo 2024-07-20 21:11:34 +08:00 committed by GitHub
parent e809bc339b
commit 0611c7b59e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 8 additions and 4 deletions

View file

@ -1983,9 +1983,12 @@ pub struct AddArgs {
#[arg(long, conflicts_with("dev"))]
pub optional: Option<ExtraName>,
/// Add the requirements as editables.
#[arg(long, default_missing_value = "true", num_args(0..=1))]
pub editable: Option<bool>,
#[arg(long, overrides_with = "no_editable", hide = true)]
pub editable: bool,
/// Don't add the requirements as editables.
#[arg(long, overrides_with = "editable")]
pub no_editable: bool,
/// Add source requirements to the `project.dependencies` section of the `pyproject.toml`.
///

View file

@ -609,6 +609,7 @@ impl AddSettings {
dev,
optional,
editable,
no_editable,
extra,
raw_sources,
rev,
@ -641,13 +642,13 @@ impl AddSettings {
frozen,
requirements,
dependency_type,
editable,
raw_sources,
rev,
tag,
branch,
package,
python,
editable: flag(editable, no_editable),
extras: extra.unwrap_or_default(),
refresh: Refresh::from(refresh),
settings: ResolverInstallerSettings::combine(