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

Can't specify URIs (for multiple paths) in UV_CONSTRAINT #4124

Closed
henryiii opened this issue Jun 7, 2024 · 3 comments · Fixed by #4145
Closed

Can't specify URIs (for multiple paths) in UV_CONSTRAINT #4124

henryiii opened this issue Jun 7, 2024 · 3 comments · Fixed by #4145
Assignees
Labels
compatibility Compatibility with a specification or another tool

Comments

@henryiii
Copy link
Contributor

henryiii commented Jun 7, 2024

In pip, if you want to provide a path that has as space in it, you must provide a URI, as pip universally uses spaces for separating arguments. So for example, to set two constraint files that potentially contain spaces, you'd do:

echo "packaging==21.2" > 'file 1.txt'
echo "cowsay==6.0" > 'file 2.txt'
a = $(python3 -c 'import pathlib; print(pathlib.Path("file 1.txt").resolve().as_uri())')
b = $(python3 -c 'import pathlib; print(pathlib.Path("file 2.txt").resolve().as_uri())')
uv venv
PIP_CONSTRAINT="$a $b" pip install --python .venv cowsay packaging

(This is exactly what cibuildwheel does, it has it's own constraint file which it is combining with a user specified file(s), and it doesn't know if there might be spaces in the paths)

Trying this with uv just breaks on the URI with error: File not found: `file:///.../cibuildwheel/tmp/file%202.txt` . If I remove the spaces, it handles the space separated files just fine, but it doesn't seem to support URIs, which is the standard way to allow space separated paths in Pip.

@charliermarsh
Copy link
Member

Sounds like a bug, thanks.

@charliermarsh charliermarsh added the compatibility Compatibility with a specification or another tool label Jun 7, 2024
@charliermarsh
Copy link
Member

Does PIP_CONSTRAINT="$a" pip install --python .venv cowsay packaging work? (Is the "multiple files" relevant?)

@henryiii
Copy link
Contributor Author

henryiii commented Jun 7, 2024

Multiple files is not relevant actually, other than being the reason that spaces aren't available for file paths. Pip generally accepts a URI anywhere it accepts a file path, which happens to be important for environment variables that use the space for other purposes.

Yes, pip works with one file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compatibility Compatibility with a specification or another tool
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants