diff --git a/crates/pypi-types/src/metadata.rs b/crates/pypi-types/src/metadata.rs index eb2cd67c2562..753820e64e9e 100644 --- a/crates/pypi-types/src/metadata.rs +++ b/crates/pypi-types/src/metadata.rs @@ -61,7 +61,7 @@ pub enum MetadataError { #[error("The following field was marked as dynamic: {0}")] DynamicField(&'static str), #[error("The project uses Poetry's syntax to declare its dependencies, despite including a `project` table in `pyproject.toml`")] - Poetry, + PoetrySyntax, } impl From> for MetadataError { @@ -213,11 +213,12 @@ impl Metadata23 { } // If dependencies are declared with Poetry, and `project.dependencies` is omitted, treat - // the dependencies as dynamic. + // the dependencies as dynamic. The inclusion of a `project` table without defining + // `project.dependencies` is almost certainly an error. if project.dependencies.is_none() && pyproject_toml.tool.and_then(|tool| tool.poetry).is_some() { - return Err(MetadataError::Poetry); + return Err(MetadataError::PoetrySyntax); } let name = project.name; @@ -306,7 +307,7 @@ struct Tool { #[derive(Deserialize, Debug)] #[serde(rename_all = "kebab-case")] -struct ToolPoetry {} +struct ToolPoetry; /// Python Package Metadata 1.0 and later as specified in /// . @@ -390,11 +391,12 @@ impl RequiresDist { } // If dependencies are declared with Poetry, and `project.dependencies` is omitted, treat - // the dependencies as dynamic. + // the dependencies as dynamic. The inclusion of a `project` table without defining + // `project.dependencies` is almost certainly an error. if project.dependencies.is_none() && pyproject_toml.tool.and_then(|tool| tool.poetry).is_some() { - return Err(MetadataError::Poetry); + return Err(MetadataError::PoetrySyntax); } let name = project.name; diff --git a/crates/uv-distribution/src/source/mod.rs b/crates/uv-distribution/src/source/mod.rs index ae83ea797616..0730787b9d61 100644 --- a/crates/uv-distribution/src/source/mod.rs +++ b/crates/uv-distribution/src/source/mod.rs @@ -1418,7 +1418,7 @@ impl<'a, T: BuildContext> SourceDistributionBuilder<'a, T> { | pypi_types::MetadataError::DynamicField(_) | pypi_types::MetadataError::FieldNotFound(_) | pypi_types::MetadataError::UnsupportedMetadataVersion(_) - | pypi_types::MetadataError::Poetry, + | pypi_types::MetadataError::PoetrySyntax, )), ) => { debug!("No static `PKG-INFO` available for: {source} ({err:?})"); @@ -1443,7 +1443,7 @@ impl<'a, T: BuildContext> SourceDistributionBuilder<'a, T> { | pypi_types::MetadataError::DynamicField(_) | pypi_types::MetadataError::FieldNotFound(_) | pypi_types::MetadataError::UnsupportedMetadataVersion(_) - | pypi_types::MetadataError::Poetry, + | pypi_types::MetadataError::PoetrySyntax, )), ) => { debug!("No static `pyproject.toml` available for: {source} ({err:?})");