Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add uv add --no-editable #5246

Merged
merged 1 commit into from
Jul 20, 2024
Merged

Add uv add --no-editable #5246

merged 1 commit into from
Jul 20, 2024

Conversation

j178
Copy link
Contributor

@j178 j178 commented Jul 20, 2024

Summary

Resolves #5241

Test Plan

# 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 }

Copy link
Member

@charliermarsh charliermarsh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@charliermarsh charliermarsh added cli Related to the command line interface preview Experimental behavior labels Jul 20, 2024
@charliermarsh charliermarsh merged commit 0611c7b into astral-sh:main Jul 20, 2024
54 checks passed
@zanieb
Copy link
Member

zanieb commented Jul 20, 2024

@charliermarsh this was implemented intentionally as --editable and --editable=true / --editable=false to match the syntax you'd use in the pyproject.toml. I don't prefer --no-editable.

cc @ibraheemdev

@charliermarsh
Copy link
Member

I don't understand why you would use --editable=true, that's so surprising!

@charliermarsh
Copy link
Member

Oh, you're saying --editable already worked, but it also supported --editable=true and --editable=false? I don't know, that's also not as intuitive to me given that we don't have that pattern anywhere else in the CLI.

@zanieb
Copy link
Member

zanieb commented Jul 20, 2024

Yeah because of default_missing_value = "true".

I know it's not aligned with the rest of the CLI — but it does directly match the sources definition. I don't know if I feel particularly strongly, but wanted to flag that this wasn't an oversight. I'm not sure why, but --no-editable doesn't feel like it encodes the meaning as clearly (although it is more intuitive given our existing patterns).

@charliermarsh
Copy link
Member

Ok I defer to others on this (you and @ibraheemdev). I also don't feel strongly. I thought the original report was that you had to do --editable=true which I knew every user would get wrong :)

@zanieb
Copy link
Member

zanieb commented Jul 20, 2024

Maybe the most user-friendly thing is to support --editable / --no-editable and --editable=true / --editable=false. It's not like there's something else we'll want the flag for.

Are there other booleans that would make sense as --<name>=false (instead of --no-<name>)?

I'll think on this. Unsure if we should revert in the meantime.

@j178 j178 deleted the editable branch July 22, 2024 14:21
@bluss
Copy link
Contributor

bluss commented Jul 22, 2024

Sorry for this one then.

I'll chime in and say the reason I reported the bug was this interaction (uv 0.2.24):

> uv add --editable ./sibling/
error: invalid value './sibling/' for '--editable [<EDITABLE>]'

So just --editable worked in some places but not before the name of the dependency.

@charliermarsh
Copy link
Member

Ahh yeah. That's actually a pretty big footgun in my opinion.

@zanieb
Copy link
Member

zanieb commented Jul 22, 2024

Ah okay sold. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cli Related to the command line interface preview Experimental behavior
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Should uv add have editable as a flag
4 participants