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

Allow uv add to specify optional dependency groups #4607

Merged
merged 2 commits into from
Jun 28, 2024
Merged

Conversation

ibraheemdev
Copy link
Member

Summary

Implements uv add --optional <group>, which adds a dependency to project.optional-dependency.<group>.

Resolves #4585.

@@ -143,3 +136,22 @@ pub(crate) async fn remove(

Ok(ExitStatus::Success)
}

/// Emit a warning if a dependency with the given name is present as any dependency type.
fn warn_dependency_types(name: &PackageName, pyproject: &PyProjectTomlMut) {
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 just be part of the anyhow::bail!? It took me a sec to realize that this running after we've been unable to find the dependency in some other group. I wonder if there's a way to structure the code such that the data flow is clearer. Maybe just a matter of expanding the documentation.

Copy link
Member Author

Choose a reason for hiding this comment

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

Renamed to warn_if_present and updated the docs.

@charliermarsh charliermarsh added the preview Experimental behavior label Jun 28, 2024
@ibraheemdev ibraheemdev enabled auto-merge (squash) June 28, 2024 01:17
@ibraheemdev ibraheemdev merged commit bbd59ff into main Jun 28, 2024
40 of 47 checks passed
@ibraheemdev ibraheemdev deleted the uv-add-optional branch June 28, 2024 01:24
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.

Allow uv add to specify optional dependency groups
2 participants