diff --git a/CHANGELOG.md b/CHANGELOG.md index 85fe04187..c9c1d2011 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ ## [Unreleased] - Updated pip from 25.3 to 26.0.1. ([#2032](https://github.com/heroku/heroku-buildpack-python/pull/2032)) +- Explicitly configured uv to use hard links to maintain the behaviour of previous versions. ([#2044](https://github.com/heroku/heroku-buildpack-python/pull/2044)) ## [v336] - 2026-03-02 diff --git a/lib/uv.sh b/lib/uv.sh index 927c84821..53d66e990 100644 --- a/lib/uv.sh +++ b/lib/uv.sh @@ -88,6 +88,9 @@ function uv::install_uv() { # Prevent uv from downloading/using its own Python installation. export UV_NO_MANAGED_PYTHON="1" export UV_PYTHON_DOWNLOADS="never" + # Force uv to use hardlinks rather than the new default of reflinks, since the latter are + # significantly slower on Kodon: https://github.com/astral-sh/uv/issues/18259 + export UV_LINK_MODE="hardlink" # Set the same env vars in the environment used by later buildpacks. cat >>"${export_file}" <<-EOF @@ -95,6 +98,7 @@ function uv::install_uv() { export UV_PROJECT_ENVIRONMENT="${python_home}" export UV_NO_MANAGED_PYTHON="1" export UV_PYTHON_DOWNLOADS="never" + export UV_LINK_MODE="hardlink" EOF # As a performance optimisation, uv attempts to use hardlinks instead of copying files from its diff --git a/spec/hatchet/ci_spec.rb b/spec/hatchet/ci_spec.rb index 60319499b..9b4ba8af9 100644 --- a/spec/hatchet/ci_spec.rb +++ b/spec/hatchet/ci_spec.rb @@ -319,6 +319,7 @@ PATH=/tmp/cache\\w+/.heroku/python-uv:/app/.heroku/python/bin:/usr/local/bin:/usr/bin:/bin:/app/.sprettur/bin/ PKG_CONFIG_PATH=/app/.heroku/python/lib/pkg-config PYTHONUNBUFFERED=1 + UV_LINK_MODE=hardlink UV_NO_MANAGED_PYTHON=1 UV_PROJECT_ENVIRONMENT=/app/.heroku/python UV_PYTHON_DOWNLOADS=never @@ -331,6 +332,7 @@ PYTHONHOME=/app/.heroku/python PYTHONPATH=/app PYTHONUNBUFFERED=true + UV_LINK_MODE=hardlink UV_NO_MANAGED_PYTHON=1 UV_PROJECT_ENVIRONMENT=/app/.heroku/python UV_PYTHON_DOWNLOADS=never diff --git a/spec/hatchet/uv_spec.rb b/spec/hatchet/uv_spec.rb index 766df4dca..3b0d74c21 100644 --- a/spec/hatchet/uv_spec.rb +++ b/spec/hatchet/uv_spec.rb @@ -33,6 +33,7 @@ remote: PKG_CONFIG_PATH=/app/.heroku/python/lib/pkg-config remote: PYTHONUNBUFFERED=1 remote: UV_CACHE_DIR=/tmp/uv-cache + remote: UV_LINK_MODE=hardlink remote: UV_NO_MANAGED_PYTHON=1 remote: UV_PROJECT_ENVIRONMENT=/app/.heroku/python remote: UV_PYTHON_DOWNLOADS=never @@ -46,6 +47,7 @@ remote: PYTHONPATH=/app remote: PYTHONUNBUFFERED=true remote: UV_CACHE_DIR=/tmp/uv-cache + remote: UV_LINK_MODE=hardlink remote: UV_NO_MANAGED_PYTHON=1 remote: UV_PROJECT_ENVIRONMENT=/app/.heroku/python remote: UV_PYTHON_DOWNLOADS=never