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 --workspace option to uv add #4362

Merged
merged 3 commits into from
Jun 18, 2024
Merged

Conversation

ibraheemdev
Copy link
Member

Summary

Implements uv add foo --workspace, which adds foo as a workspace dependency with the corresponding tool.uv.sources entry.

Part of #3959.

@ibraheemdev ibraheemdev added the preview Experimental behavior label Jun 17, 2024
source: Option<&Source>,
) -> Result<(), Error> {
// Get or create `project.dependencies`.
let dependencies = self
Copy link
Member Author

@ibraheemdev ibraheemdev Jun 17, 2024

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.

@ibraheemdev ibraheemdev force-pushed the ibraheem/uv-add-workspace branch 2 times, most recently from 74637e7 to d714a7f Compare June 17, 2024 20:24
+ 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`
Copy link
Member

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?

Copy link
Member Author

Choose a reason for hiding this comment

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

Great catch, thanks.

Comment on lines +1614 to +1616
/// Add the requirements as workspace dependencies.
#[arg(long)]
pub(crate) workspace: bool,
Copy link
Member

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)

zanieb added a commit that referenced this pull request Jun 18, 2024
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.
@ibraheemdev ibraheemdev enabled auto-merge (squash) June 18, 2024 15:57
@ibraheemdev ibraheemdev merged commit eefc8c6 into main Jun 18, 2024
47 checks passed
@ibraheemdev ibraheemdev deleted the ibraheem/uv-add-workspace branch June 18, 2024 16:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
preview Experimental behavior
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants