Support extras in editable requirements (#1113)

## Summary

This PR adds support for requirements like `-e .[d]`.

Closes #1091.
This commit is contained in:
Charlie Marsh 2024-01-26 04:07:51 -08:00 committed by GitHub
parent f593b65447
commit 7755f986c3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
13 changed files with 248 additions and 37 deletions

View file

@ -407,6 +407,22 @@ impl Requirement {
}
}
/// A list of [`ExtraName`] that can be attached to a [`Requirement`].
#[derive(Debug, Clone, Eq, Hash, PartialEq)]
pub struct Extras(Vec<ExtraName>);
impl Extras {
/// Parse a list of extras.
pub fn parse(input: &str) -> Result<Self, Pep508Error> {
Ok(Self(parse_extras(&mut Cursor::new(input))?))
}
/// Convert the [`Extras`] into a [`Vec`] of [`ExtraName`].
pub fn into_vec(self) -> Vec<ExtraName> {
self.0
}
}
/// The actual version specifier or url to install
#[derive(Debug, Clone, Eq, Hash, PartialEq)]
pub enum VersionOrUrl {