Skip to content

Constraint flag for uv add #6518

@yehoshuadimarsky

Description

@yehoshuadimarsky

Hi, can we instead add a new flag -c / --constraint to uv add, so that you can pass in constraint files directly? I think currently you can do this by adding a constraint to a requirements.txt file, then running uv add --requirements requirements.txt, but this would embed it directly in the command.

My specific use case is using Apache Airflow which only supports pip (not Poetry etc) because it basically requires constraint files, see https://github.com/apache/airflow/blob/main/README.md#installing-from-pypi

That way, I can do (copying from their example):

uv add 'apache-airflow==2.10.0' \
 --constraint "https://raw.githubusercontent.com/apache/airflow/constraints-2.10.0/constraints-3.8.txt"

Thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or improvement to existing functionality

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions