Skip to content
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

pyproject validation messages are ambiguous #8416

Open
lskbr opened this issue Oct 21, 2024 · 4 comments
Open

pyproject validation messages are ambiguous #8416

lskbr opened this issue Oct 21, 2024 · 4 comments
Labels
error messages Messaging when something goes wrong

Comments

@lskbr
Copy link

lskbr commented Oct 21, 2024

uv --version
0.4.45

also tested with version 0.4.22

OS: Windows 11 - WSL

pyproject.toml:

[project]
name = "x"
version = "0.1.0"
description = "Add your description here"
readme = "README.md"
requires-python = ">=3.11"
dependencies = [
]
 
[project.optional-dependencies]
dev = [
    "rich>=13.9.2",
]

This pyproject.toml was created with uv init. The rich dependency was added with:

uv add rich --optional dev

The problem:

uv pip install --extra dev . -vvvv
    0.002785s DEBUG uv uv 0.4.25
error: Requesting extras requires a `pyproject.toml`, `setup.cfg`, or `setup.py` file.

The message implies that pyproject.toml file does not exist, but it is there.

Installing with

uv pip install .[dev]

works without any problem. Same directory, same venv.

The problem is: if pyptoject.toml exists and is valid, why the error message tells extra requires a pyproject.toml?

This also happens when a [project] section is not present in the pyproject, for example, when it is created with poetry. The error message is the same, even if the pyproject.toml is there and is used by other uv options.

In the first case RUST_TRACE and RUST_LOG do not help, the output is the same.
In the second case, missing project header, RUST_TRACE and RUST_LOG can be used to have a hint of the problem.

Can you please have a look if there is an error in uv pip install --help?
Can you please consider changing the error message to clearly indicate when a file does not exist and when it exists but is invalid or missing something?
Can you please confirm uv should be compatible with the pyproject.toml generated by poetry? (and when poetry is the specified builder).

@zanieb
Copy link
Member

zanieb commented Oct 21, 2024

I believe uv pip install --extra dev -r pyproject.toml is the expected usage there.

I see how this is confusing though, we can improve this.

@zanieb zanieb added the error messages Messaging when something goes wrong label Oct 21, 2024
@lskbr
Copy link
Author

lskbr commented Oct 21, 2024

So the -r is missing when I use --extra. By the message I thought it wasn't finding the pyproject file itself.
It is also strange that pip install .[dev] works without the -r.
So we have two settings:
If I use the uv pip install .[dev] notation, I don't have to pass a -r and I should not use --extra.
If I use uv pip install -extra dev I have to pass the -r pyproject.toml.
Is this correct?

@charliermarsh
Copy link
Member

.[dev] and -r pyproject.toml aren't quite the same. The former installs the project itself; the latter installs the project's requirements.

@zanieb
Copy link
Member

zanieb commented Oct 21, 2024

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
error messages Messaging when something goes wrong
Projects
None yet
Development

No branches or pull requests

3 participants