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"))] #[arg(long, conflicts_with("dev"))]
pub optional: Option<ExtraName>, pub optional: Option<ExtraName>,
/// Add the requirements as editables. #[arg(long, overrides_with = "no_editable", hide = true)]
#[arg(long, default_missing_value = "true", num_args(0..=1))] pub editable: bool,
pub editable: Option<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`. /// Add source requirements to the `project.dependencies` section of the `pyproject.toml`.
/// ///

View file

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