Add UV_COMPILE_BYTECODE_TIMEOUT environment variable (#14369)

## Summary

When installing packages on _very_ slow/overloaded systems it'spossible
to trigger bytecode compilation timeouts, which tends to happen in
environments such as Qemu (especially without KVM/virtio), but also on
systems that are simply overloaded. I've seen this in my Nix builds if I
for example am compiling a Linux kernel at the same time as a few other
concurrent builds.

By making the bytecode compilation timeout adjustable you can work
around such issues. I plan to set `UV_COMPILE_BYTECODE_TIMEOUT=0` in the
[pyproject.nix
builders](https://pyproject-nix.github.io/pyproject.nix/build.html) to
make them more reliable.

- Related issues

  * https://github.com/astral-sh/uv/issues/6105

## Test Plan

Only manual testing was applied in this instance. There is no existing
automated tests for bytecode compilation timeout afaict.
This commit is contained in:
adisbladis 2025-07-18 01:11:32 +12:00 committed by GitHub
parent 09fc943cca
commit bdb8c2646a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 56 additions and 12 deletions

View file

@ -26,6 +26,10 @@ directory for caching instead of the default cache directory.
Equivalent to the `--compile-bytecode` command-line argument. If set, uv
will compile Python source files to bytecode after installation.
### `UV_COMPILE_BYTECODE_TIMEOUT`
Timeout (in seconds) for bytecode compilation.
### `UV_CONCURRENT_BUILDS`
Sets the maximum number of source distributions that uv will build