Skip to content

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

Closed

Description

@henryiii

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.

Activity

  1. charliermarsh commented on Jun 7, 2024

    @charliermarsh
    Member

    Sounds like a bug, thanks.

  2. added
    compatibility
    on Jun 7, 2024
  3. charliermarsh commented on Jun 7, 2024

    @charliermarsh
    Member

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

  4. henryiii commented on Jun 7, 2024

    @henryiii
    ContributorAuthor

    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.

  5. self-assigned this
    on Jun 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

compatibility

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions