Add --group support to uv add and uv remove (#8108)

Part of #8090

Adds the ability to add and remove dependencies from arbitrary groups
using `uv add` and `uv remove`. Does not include resolving with the new
dependencies — tackling that in #8110.

Additionally, this does not yet resolve interactions with the existing
`dev` group — we'll tackle that separately as well. I probably won't
merge the stack until that design is resolved.
This commit is contained in:
Zanie Blue 2024-10-16 16:38:11 -05:00
parent 3c9d783e09
commit 4c0590ff6f
22 changed files with 653 additions and 124 deletions

View file

@ -3,7 +3,7 @@ use std::fmt::{Display, Formatter};
use std::str::FromStr;
use std::sync::LazyLock;
use serde::{Deserialize, Deserializer};
use serde::{Deserialize, Deserializer, Serialize, Serializer};
use crate::{validate_and_normalize_owned, validate_and_normalize_ref, InvalidNameError};
@ -41,6 +41,15 @@ impl<'de> Deserialize<'de> for GroupName {
}
}
impl Serialize for GroupName {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: Serializer,
{
self.0.serialize(serializer)
}
}
impl Display for GroupName {
fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
self.0.fmt(f)