Add `constraints.txt` export to `uv export`
Constraints files are a little different... Specifically, every requirement has to be named, so we can't write relative paths. (You also can't include extras, but we already don't do that.)
Hm. An export of the pyproject.toml constraints?
No, it’s an export of the lockfile in constraints.txt format. requirements.txt files support things that constraints files do not. You can’t export in requirements.txt format and pass it as constraints.
I've had this line in every rye-based Dockerfile for the last few years to work around this.
RUN sed -i '/^-e ./d' requirements.txt
@carderne -- If you structure your project as a non-package (i.e., omit a [build-system] or set package = false under [tool.uv]), that line should be omitted from the export.
Sorry maybe I crossed a wire. To be super explicit, this works:
uv init --package foo
cd foo
uv sync
uv run python -c 'import foo'
But if I set tool.uv.package = false then I obviously can't import foo.
I want foo to be installed in the venv, but I don't want it in the constraints file, as pip rejects that.
(Happy to have a thumbs up and go on my way, I might be derailing the point of this thread.)