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

uv add adds a dependency and then declares it invalid #5752

Closed
dimbleby opened this issue Aug 3, 2024 · 2 comments · Fixed by #5753
Closed

uv add adds a dependency and then declares it invalid #5752

dimbleby opened this issue Aug 3, 2024 · 2 comments · Fixed by #5753
Assignees
Labels
bug Something isn't working preview Experimental behavior

Comments

@dimbleby
Copy link

dimbleby commented Aug 3, 2024

$ uv init .
warning: `uv init` is experimental and may change without warning
Initialized project `foo` at `/home/dch/foo`      

$ uv add --extra-index-url="https://download.pytorch.org/whl/cpu" -- torch
warning: `uv add` is experimental and may change without warning
Using Python 3.10.12 interpreter at: /usr/bin/python3
Creating virtualenv at: .venv
Resolved 10 packages in 2.50s
error: Failed to prepare distributions
  Caused by: Failed to fetch wheel: foo @ file:///home/dch/foo
  Caused by: Failed to build: `foo @ file:///home/dch/foo`
  Caused by: Build backend failed to build wheel through `build_editable()` with exit status: 1
--- stdout:

--- stderr:
Traceback (most recent call last):
  File "<string>", line 11, in <module>
  File "/home/dch/.cache/uv/builds-v0/.tmpqaB24C/lib/python3.10/site-packages/hatchling/build.py", line 83, in build_editable
    return os.path.basename(next(builder.build(directory=wheel_directory, versions=['editable'])))
  File "/home/dch/.cache/uv/builds-v0/.tmpqaB24C/lib/python3.10/site-packages/hatchling/builders/plugin/interface.py", line 90, in build
    self.metadata.validate_fields()
  File "/home/dch/.cache/uv/builds-v0/.tmpqaB24C/lib/python3.10/site-packages/hatchling/metadata/core.py", line 261, in validate_fields
    self.core.validate_fields()
  File "/home/dch/.cache/uv/builds-v0/.tmpqaB24C/lib/python3.10/site-packages/hatchling/metadata/core.py", line 1353, in validate_fields
    getattr(self, attribute)
  File "/home/dch/.cache/uv/builds-v0/.tmpqaB24C/lib/python3.10/site-packages/hatchling/metadata/core.py", line 1224, in dependencies
    self._dependencies = list(self.dependencies_complex)
  File "/home/dch/.cache/uv/builds-v0/.tmpqaB24C/lib/python3.10/site-packages/hatchling/metadata/core.py", line 1203, in dependencies_complex
    raise ValueError(message) from None
ValueError: Dependency #1 of field `project.dependencies` is invalid: Expected end or semicolon (after version specifier)
    torch>=2.4.0+cpu
         ~~~~~~~^

$ uv version
uv 0.2.33

torch>=2.4.0+cpu was introduced by uv itself

@dimbleby
Copy link
Author

dimbleby commented Aug 3, 2024

I guess strictly speaking it is hatchling declaring that the dependency is invalid, but it is right: per PEP440 "Local version identifiers are NOT permitted in this version specifier."

@charliermarsh
Copy link
Member

Thanks.

@charliermarsh charliermarsh added the bug Something isn't working label Aug 3, 2024
@charliermarsh charliermarsh self-assigned this Aug 3, 2024
@charliermarsh charliermarsh added the preview Experimental behavior label Aug 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working preview Experimental behavior
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants