Use the following one-liner to reformat an existing requirements.txt file as constraints:
$ uv pip compile requirements.txt --no-annotate --no-header \
| awk '{printf("%s\"%s\",\n", (NR==1?"constraint-dependencies = [\n ":" "), $0)}' \
| sed '$s/,$/\n]/'Then, add the constraints to the pyproject.toml in the [tool.uv] section:
TODO EXAMPLEThen, add the input requirements as dependencies:
$ uv add -r requirements.inThen, you can remove the constraints-dependencies entry from the pyproject.toml. These
dependencies are now pinned in uv.lock instead.