Add hashes to pip-compile output (#894)

## Summary

Adds hashes to `pip-compile` output, though we don't actually check
those hashes in `pip-sync` yet.

Closes https://github.com/astral-sh/puffin/issues/131.
This commit is contained in:
Charlie Marsh 2024-01-12 12:44:19 -05:00 committed by GitHub
parent 1629141d67
commit 06039e1293
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 281 additions and 37 deletions

View file

@ -85,8 +85,14 @@ impl Yanked {
///
/// PEP 691 says multiple hashes can be included and the interpretation is left to the client, we
/// only support SHA 256 atm.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[derive(Debug, Clone, Ord, PartialOrd, Eq, PartialEq, Hash, Serialize, Deserialize)]
pub struct Hashes {
// TODO(charlie): Hashes should be optional.
pub sha256: String,
}
impl std::fmt::Display for Hashes {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "sha256:{}", self.sha256)
}
}