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:
Charlie Marsh 2024-03-16 12:06:42 -07:00 committed by GitHub
parent 5a95f50619
commit db5898bd67
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 76 additions and 2 deletions

View file

@ -0,0 +1,22 @@
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"
[project]
name = "root-editable"
description = 'A simple editable package with a {root:uri} dependency.'
readme = "README.md"
requires-python = ">=3.7"
license = "MIT"
keywords = []
authors = [
{ name = "Astral Software Inc.", email = "hey@astral.sh" },
]
classifiers = []
dependencies = [
"black @ {root:uri}/../black_editable"
]
version = "0.1.0"
[tool.hatch.metadata]
allow-direct-references = true

View file

@ -0,0 +1,2 @@
def func():
pass