-
Notifications
You must be signed in to change notification settings - Fork 790
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
uv fails to parse pyproject.toml when using Hatchling's {root:uri}
for dependencies
#2475
Comments
Thanks for the well written report! I think this might be solved by making a PEP 517 request per #1624 — or we could add support for this context formatting directly but I'm hesitant to do that since it's not a Python standard. |
Hmm, I'm not quite sure how projects other than hatch are supposed to be able to build that. |
@ofek - are other frontends expected to be able to build these projects? Any advice? I know Rye doesn't support this either: astral-sh/rye#826. |
PDM added support for that but generally no, other projects can't use it without doing the PEP 517 process. |
We do go through the PEP 517 process so assuming all the build hooks work, it should "just work". I think we're failing because we're trying to parse the requirements even though we don't "need" them here. I'll take a look and see if it's easy. |
Okay yeah, we can support this. |
## 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 #2475.
Hatchling includes a feature that allows specifying local dependencies relative to a project's root directory using the following syntax:
uv fails to install projects that are using this feature, even if only used in an optional dependency that is not selected.
Reproduction steps
To reproduce, create this file structure:
/pyproject.toml
/subproject/pyproject.toml
Then run these commands:
uv pip install -e .
ORuv pip install -e .[local]
pip install -e .
pip install -e .[local]
Versions
OS: Windows 11
Python:
3.11.0 (main, Oct 24 2022, 18:26:48) [MSC v.1933 64 bit (AMD64)] on win32
uv:
0.1.17 (bb2d06cbb 2024-03-10)
The text was updated successfully, but these errors were encountered: