-
Notifications
You must be signed in to change notification settings - Fork 983
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 --workspace
option to uv add
#4362
Conversation
acd8695
to
eec7bd7
Compare
source: Option<&Source>, | ||
) -> Result<(), Error> { | ||
// Get or create `project.dependencies`. | ||
let dependencies = self |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
toml_edit
does some implicit conversions/insertion when indexing directly on an Item
which makes this form a lot better.. but very verbose. Maybe an extension trait could help for some of the common conversions.
74637e7
to
d714a7f
Compare
d714a7f
to
dc9e675
Compare
crates/uv/tests/edit.rs
Outdated
+ project==0.1.0 (from file://[TEMP_DIR]/) | ||
+ sniffio==1.3.1 | ||
warning: `uv remove` is experimental and may change without warning. | ||
warning: `anyio` is a development dependency; try calling `uv add --dev` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be uv remove --dev
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great catch, thanks.
/// Add the requirements as workspace dependencies. | ||
#[arg(long)] | ||
pub(crate) workspace: bool, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm on the fence whether we need an explicit argument for this, we could also do workspace discovery and know that it has to be a workspace dep, otoh it's consistent with us requiring workspace = true
in pyproject.toml
(it's something we took from cargo, it's helpful to make we don't accidentally flip between workspace and index and to keep the information about the package source local)
It was becoming problematic that the virtual environment test context diverged from the other one i.e. we had to implement filtering twice. This combines the contexts and tweaks the `TestContext` API and filtering mechanisms for Python versions. Combined with my previous changes to the test context at #4364 and #4368 this finally unblocks the snapshots for test cases in #4360 and #4362.
c553fdb
to
8f103b3
Compare
Summary
Implements
uv add foo --workspace
, which addsfoo
as a workspace dependency with the correspondingtool.uv.sources
entry.Part of #3959.