astral-sh / uv

An extremely fast Python package and project manager, written in Rust.
https://docs.astral.sh/uv
Apache License 2.0
27.92k stars 803 forks source link

Support `UV_ONLY_BINARY` and `UV_NO_BINARY` environment variables #4291

Open njzjz opened 5 months ago

njzjz commented 5 months ago

This is useful with cibuildwheel or some other complicated tools in the CI environment.

pip has similiar PIP_NO_BINARY and PIP_ONLY_BINARY: https://pip.pypa.io/en/latest/cli/pip_install/#cmdoption-no-binary

zanieb commented 5 months ago

I think we've avoided this because we're not interested in supporting the pip syntax outside of the pip interface. Maybe we could namespace them e.g. UV_PIP_NO_BINARY in the meantime?

henryiii commented 3 months ago

Some of them are available, though, like UV_CONSTRAINT, UV_INDEX_URL, UV_EXTRA_INDEX_URL, and UV_BREAK_SYSTEM_PACKAGES. I don't really care what it's called, but it would be nice to have, as you can't pass flags through inside cibuildwheel to every command.

sanmai-NL commented 2 months ago

@zanieb Please consider that other package managers also support this, since it's a genuinely useful feature for containerized builds, and not just a Pip feature.

zanieb commented 2 months ago

@sanmai-NL we do support this via persistent configuration, e.g.,

Since our top-level settings differ from pip (we don't use :all:, we have a dedicated flag instead), I'm not sure how best to introduce environment variables for this.

I guess:

UV_NO_BINARY=1
UV_NO_BINARY_PACKAGE="foo bar"

And uv pip users would need to use the new syntax too?