Make repeated uv add operations simpler (#5922)

## Summary

Closes #5913.
This commit is contained in:
Charlie Marsh 2024-08-08 13:55:07 -04:00 committed by GitHub
parent 2789830ac2
commit dc3f498f58
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 102 additions and 13 deletions

View file

@ -30,7 +30,7 @@ pub struct PyProjectToml {
pub tool: Option<Tool>,
/// The raw unserialized document.
#[serde(skip)]
pub(crate) raw: String,
pub raw: String,
}
impl PyProjectToml {

View file

@ -55,11 +55,6 @@ impl PyProjectTomlMut {
})
}
/// Initialize a [`PyProjectToml`] from a [`PyProjectTomlMut`].
pub fn to_toml(&self) -> Result<PyProjectToml, Error> {
Ok(toml::from_str(&self.doc.to_string()).map_err(Box::new)?)
}
/// Adds a project to the workspace.
pub fn add_workspace(&mut self, path: impl AsRef<Path>) -> Result<(), Error> {
// Get or create `tool.uv.workspace.members`.