mirror of
https://github.com/astral-sh/uv.git
synced 2025-11-02 21:02:37 +00:00
Add support for path dependencies (#471)
## Summary This PR adds support for local path dependencies. The approach mostly just falls out of our existing approach and infrastructure for Git and URL dependencies. Closes https://github.com/astral-sh/puffin/issues/436. (We'll open a separate issue for editable installs.) ## Test Plan Added `pip-compile` tests that pre-download a wheel or source distribution, then install it via local path.
This commit is contained in:
parent
f1aa70d9d3
commit
17228ba04e
23 changed files with 580 additions and 24 deletions
|
|
@ -7,8 +7,13 @@ use serde::{Deserialize, Serialize};
|
|||
///
|
||||
/// See: <https://packaging.python.org/en/latest/specifications/direct-url-data-structure/>
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
#[serde(rename_all = "snake_case", untagged)]
|
||||
pub enum DirectUrl {
|
||||
/// The direct URL is a local directory. For example:
|
||||
/// ```json
|
||||
/// {"url": "file:///home/user/project", "dir_info": {}}
|
||||
/// ```
|
||||
LocalDirectory { url: String, dir_info: DirInfo },
|
||||
/// The direct URL is a path to an archive. For example:
|
||||
/// ```json
|
||||
/// {"archive_info": {"hash": "sha256=75909db2664838d015e3d9139004ee16711748a52c8f336b52882266540215d8", "hashes": {"sha256": "75909db2664838d015e3d9139004ee16711748a52c8f336b52882266540215d8"}}, "url": "https://files.pythonhosted.org/packages/b8/8b/31273bf66016be6ad22bb7345c37ff350276cfd46e389a0c2ac5da9d9073/wheel-0.41.2-py3-none-any.whl"}
|
||||
|
|
@ -31,6 +36,13 @@ pub enum DirectUrl {
|
|||
},
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
pub struct DirInfo {
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub editable: Option<bool>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
pub struct ArchiveInfo {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
pub use direct_url::{ArchiveInfo, DirectUrl, VcsInfo, VcsKind};
|
||||
pub use direct_url::{ArchiveInfo, DirInfo, DirectUrl, VcsInfo, VcsKind};
|
||||
pub use index_url::IndexUrl;
|
||||
pub use lenient_requirement::LenientVersionSpecifiers;
|
||||
pub use metadata::{Error, Metadata21};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue