{"record":{"id":"22290c00609c619a","repo":"dbt-labs/dbt-core","slug":"filename-s-requires-dist-disagrees-with-the-sdis","errorCode":null,"errorMessage":"{filename}'s Requires-Dist disagrees with the sdist: sdist deps={:?}, wheel deps={:?}","messagePattern":"(.+?)'s Requires-Dist disagrees with the sdist: sdist deps=(.+?), wheel deps=(.+?)","errorType":"validation","errorClass":"anyhow","httpStatus":null,"severity":"error","filePath":"crates/dbt-ci/src/sdist.rs","lineNumber":165,"sourceCode":"\n    let expected_python = spec.requires_python.as_deref();\n    let actual_python = metadata.requires_python.as_deref();\n    if actual_python != expected_python {\n        bail!(\n            \"{filename} declares Requires-Python {actual:?} but the sdist says \\\n             {expected:?}; point `--pyproject-dir` at the pyproject that built \\\n             these wheels\",\n            actual = actual_python.unwrap_or(\"(absent)\"),\n            expected = expected_python.unwrap_or(\"(absent)\"),\n        );\n    }\n\n    let expected_deps: std::collections::BTreeSet<&str> =\n        spec.dependencies.iter().map(|d| d.trim()).collect();\n    let actual_deps: std::collections::BTreeSet<&str> =\n        metadata.requires_dist.iter().map(|d| d.trim()).collect();\n    if expected_deps != actual_deps {\n        bail!(\n            \"{filename}'s Requires-Dist disagrees with the sdist: sdist deps={:?}, \\\n             wheel deps={:?}\",\n            expected_deps,\n            actual_deps,\n        );\n    }\n    Ok(())\n}\n\n/// The `*.dist-info/METADATA` bytes from a wheel held in memory.\nfn wheel_metadata(wheel: &[u8]) -> Result<Option<Vec<u8>>> {\n    let mut archive = zip::ZipArchive::new(Cursor::new(wheel)).context(\"open wheel as zip\")?;\n    let name = archive\n        .file_names()\n        .find(|n| {\n            n.ends_with(\"/METADATA\")\n                && n.split('/')\n                    .next()","sourceCodeStart":147,"sourceCodeEnd":183,"githubUrl":"https://github.com/dbt-labs/dbt-core/blob/0267ce9170576975b76b64ce856b2e5848e96617/crates/dbt-ci/src/sdist.rs#L147-L183","documentation":"The wheel's METADATA Requires-Dist set must exactly equal the dependencies declared in the sdist's pyproject. This bail fires when the sets differ (added, removed, or differently-specified dependencies), catching wheels built from a different dependency set than the sdist.","triggerScenarios":"check_wheel_metadata_agrees normalizes both dependency lists into trimmed BTreeSets and bails when they are not equal — e.g. wheel built before a new dependency was added to pyproject, or wheel extras/markers formatted differently after trimming.","commonSituations":"Adding/removing a dependency and reusing stale wheels; --pyproject-dir pointing at an older/newer copy of the project; dependency strings differing only in whitespace is tolerated, but different version specifiers or markers are not.","solutions":["Rebuild the wheels from the same pyproject as the sdist so Requires-Dist matches exactly.","Point --pyproject-dir at the pyproject that actually built these wheels.","Diff the two dep lists printed in the error and reconcile pyproject.toml (add missing deps or update version specifiers), then rebuild."],"exampleFix":"# before\nsdist deps: {\"click>=8\", \"pydantic>=2\"}\nwheel deps: {\"click>=8\"}\n# after\nadd pydantic>=2 to the wheel build (rebuild wheels from current pyproject.toml)","handlingStrategy":"validation","validationCode":"# compare wheel deps vs pyproject deps before the release step\npython -c \"import tomllib,sys; print(sorted(tomllib.load(open('pyproject.toml','rb'))['project']['dependencies']))\"\nunzip -p wheel/*.whl '*/METADATA' | grep '^Requires-Dist:' | sort","typeGuard":null,"tryCatchPattern":"if let Err(e) = check_wheel_metadata_agrees(...) {\n    if e.to_string().contains(\"Requires-Dist\") {\n        eprintln!(\"dependency drift between sdist and wheels; rebuild wheels: {e:#}\");\n    }\n    return Err(e);\n}","preventionTips":["Rebuild wheels after any dependency change in pyproject.toml.","Never mix wheels from different commits/versions in one release.","Point --pyproject-dir at the exact project the wheels were built from.","Diff sdist vs wheel metadata in CI before publishing."],"tags":["wheel","metadata","dependencies","packaging"],"backgroundTag":"schema-validation-failed","analyzedSha":"0267ce9170576975b76b64ce856b2e5848e96617","analyzedAt":"2026-09-07T21:53:39.732Z","contentChangedAt":"2026-09-07T21:53:39.732Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}