mirror of
https://github.com/astral-sh/uv.git
synced 2025-08-01 09:32:18 +00:00
Add support for URL requirements in --generate-hashes
(#2952)
## Summary This PR enables hash generation for URL requirements when the user provides `--generate-hashes` to `pip compile`. While we include the hashes from the registry already, today, we omit hashes for URLs. To power hash generation, we introduce a `HashPolicy` abstraction: ```rust #[derive(Debug, Clone, Copy, PartialEq, Eq)] pub enum HashPolicy<'a> { /// No hash policy is specified. None, /// Hashes should be generated (specifically, a SHA-256 hash), but not validated. Generate, /// Hashes should be validated against a pre-defined list of hashes. If necessary, hashes should /// be generated so as to ensure that the archive is valid. Validate(&'a [HashDigest]), } ``` All of the methods on the distribution database now accept this policy, instead of accepting `&'a [HashDigest]`. Closes #2378.
This commit is contained in:
parent
8513d603b4
commit
006379c50c
31 changed files with 546 additions and 495 deletions
|
@ -2,7 +2,6 @@ pub use dependency_mode::DependencyMode;
|
|||
pub use error::ResolveError;
|
||||
pub use exclusions::Exclusions;
|
||||
pub use flat_index::FlatIndex;
|
||||
pub use hash_checking_mode::HashCheckingMode;
|
||||
pub use manifest::Manifest;
|
||||
pub use options::{Options, OptionsBuilder};
|
||||
pub use preferences::{Preference, PreferenceError};
|
||||
|
@ -27,7 +26,6 @@ mod editables;
|
|||
mod error;
|
||||
mod exclusions;
|
||||
mod flat_index;
|
||||
mod hash_checking_mode;
|
||||
mod manifest;
|
||||
mod options;
|
||||
mod pins;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue