Skip to content

Constraints files with spaces #12639

Open
@henryiii

Description

@henryiii

Summary

uv pip doesn't support constraint files with spaces:

$ echo "pytest~=7" > "constraints file.txt"
$ uv pip install pytest -c "constraints file.txt"
error: File not found: `constraints`

While pip does:

$ .venv/bin/pip install pytest -c "constraints file.txt"
ERROR: Invalid requirement: 'pytest~=7': Expected end or semicolon (after name and no valid version specifier)
    pytest~=7
          ^ (from line 1 of constraints file.txt)

(Ignore the fact I don't know how to write a constraint file, oops)

Note this is different than PIP_CONSTRAINT, which does not support spaces, and instead requires URIs since spaces are used to input multiple files.

I was trying to use uv in more places in cibuildwheel and ran into this, we test paths with spaces since they are common on Windows. pypa/cibuildwheel#2322

Platform

All

Version

uv 0.6.10 (Homebrew 2025-03-26) (and others)

Python version

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions