Remove special-casing for editable requirements (#3869)

## Summary

There are a few behavior changes in here:

- We now enforce `--require-hashes` for editables, like pip. So if you
use `--require-hashes` with an editable requirement, we'll reject it. I
could change this if it seems off.
- We now treat source tree requirements, editable or not (e.g., both `-e
./black` and `./black`) as if `--refresh` is always enabled. This
doesn't mean that we _always_ rebuild them; but if you pass
`--reinstall`, then yes, we always rebuild them. I think this is an
improvement and is close to how editables work today.

Closes #3844.

Closes #2695.
This commit is contained in:
Charlie Marsh 2024-05-28 11:49:34 -04:00 committed by GitHub
parent 063a0a4384
commit 1fc6a59707
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
64 changed files with 583 additions and 1813 deletions

View file

@ -33,6 +33,13 @@ pub struct VerbatimParsedUrl {
pub verbatim: VerbatimUrl,
}
impl VerbatimParsedUrl {
/// Returns `true` if the URL is editable.
pub fn is_editable(&self) -> bool {
self.parsed_url.is_editable()
}
}
impl Pep508Url for VerbatimParsedUrl {
type Err = ParsedUrlError;
@ -150,6 +157,13 @@ pub enum ParsedUrl {
Archive(ParsedArchiveUrl),
}
impl ParsedUrl {
/// Returns `true` if the URL is editable.
pub fn is_editable(&self) -> bool {
matches!(self, Self::Path(ParsedPathUrl { editable: true, .. }))
}
}
/// A local path url
///
/// Examples: