mirror of
https://github.com/astral-sh/uv.git
synced 2025-08-04 19:08:04 +00:00
Add support for Hatch's {root:uri}
paths in editable installs (#2492)
## Summary If a package uses Hatch's `root.uri` feature, we currently error: ```toml dependencies = [ "black @ {root:uri}/../black_editable" ] ``` Even though we're using PEP 517 hooks to get the metadata, which _should_ support this. The problem is that we load the full `PyProjectToml`, which means we parse the requirements, which means we reject what looks like a relative URL in dependencies. Instead, we should only enforce a limited subset of `pyproject.toml` (arguably none). Closes https://github.com/astral-sh/uv/issues/2475.
This commit is contained in:
parent
5a95f50619
commit
db5898bd67
7 changed files with 76 additions and 2 deletions
|
@ -15,6 +15,7 @@ workspace = true
|
|||
|
||||
[dependencies]
|
||||
distribution-types = { path = "../distribution-types" }
|
||||
pep440_rs = { path = "../pep440-rs" }
|
||||
pep508_rs = { path = "../pep508-rs" }
|
||||
pypi-types = { path = "../pypi-types" }
|
||||
uv-fs = { path = "../uv-fs" }
|
||||
|
|
|
@ -15,7 +15,6 @@ use fs_err as fs;
|
|||
use indoc::formatdoc;
|
||||
use itertools::Itertools;
|
||||
use once_cell::sync::Lazy;
|
||||
use pyproject_toml::Project;
|
||||
use regex::Regex;
|
||||
use rustc_hash::FxHashMap;
|
||||
use serde::de::{value, SeqAccess, Visitor};
|
||||
|
@ -27,6 +26,7 @@ use tokio::sync::Mutex;
|
|||
use tracing::{debug, info_span, instrument, Instrument};
|
||||
|
||||
use distribution_types::Resolution;
|
||||
use pep440_rs::{Version, VersionSpecifiers};
|
||||
use pep508_rs::Requirement;
|
||||
use uv_fs::Simplified;
|
||||
use uv_interpreter::{Interpreter, PythonEnvironment};
|
||||
|
@ -193,7 +193,7 @@ impl Error {
|
|||
}
|
||||
}
|
||||
|
||||
/// A pyproject.toml as specified in PEP 517
|
||||
/// A pyproject.toml as specified in PEP 517.
|
||||
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq)]
|
||||
#[serde(rename_all = "kebab-case")]
|
||||
pub struct PyProjectToml {
|
||||
|
@ -203,6 +203,18 @@ pub struct PyProjectToml {
|
|||
pub project: Option<Project>,
|
||||
}
|
||||
|
||||
/// The `[project]` section of a pyproject.toml as specified in PEP 621.
|
||||
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq)]
|
||||
#[serde(rename_all = "kebab-case")]
|
||||
pub struct Project {
|
||||
/// The name of the project
|
||||
pub name: String,
|
||||
/// The version of the project as supported by PEP 440
|
||||
pub version: Option<Version>,
|
||||
/// The Python version requirements of the project
|
||||
pub requires_python: Option<VersionSpecifiers>,
|
||||
}
|
||||
|
||||
/// The `[build-system]` section of a pyproject.toml as specified in PEP 517.
|
||||
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq)]
|
||||
#[serde(rename_all = "kebab-case")]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue