fix: avoid PYTHON_VERSION breaking uv if set (#2795)

* fix: avoid PYTHON_VERSION breaking uv if set

* fix: also keep UV_PYTHON out

Signed-off-by: Henry Schreiner <henryfs@princeton.edu>

* fix: specify the python version in the uv command more often

Signed-off-by: Henry Schreiner <henryfs@princeton.edu>

* fix: revert env order change

Signed-off-by: Henry Schreiner <henryfs@princeton.edu>

* Update windows.py

Co-authored-by: Joe Rickerby <joerick@mac.com>

---------

Signed-off-by: Henry Schreiner <henryfs@princeton.edu>
Co-authored-by: Joe Rickerby <joerick@mac.com>
This commit is contained in:
Henry Schreiner
2026-03-28 11:28:39 -04:00
committed by GitHub
co-authored by Joe Rickerby
parent fffe2ca07d
commit 643b30c796
2 changed files with 13 additions and 1 deletions
+8
View File
@@ -253,6 +253,10 @@ def setup_python(
# https://github.com/pypa/virtualenv/issues/620
# Also see https://github.com/python/cpython/pull/9516
env.pop("__PYVENV_LAUNCHER__", None)
# uv uses this over the current environment's python, so remove it to avoid confusion
env.pop("PYTHON_VERSION", None)
env.pop("PYTHON_ARCH", None)
env.pop("UV_PYTHON", None)
# we version pip ourselves, so we don't care about pip version checking
env["PIP_DISABLE_PIP_VERSION_CHECK"] = "1"
@@ -370,6 +374,8 @@ def setup_python(
uv_path,
"pip",
"install",
"--python",
which_python,
"--upgrade",
"delocate",
"build[virtualenv, uv]",
@@ -382,6 +388,8 @@ def setup_python(
uv_path,
"pip",
"install",
"--python",
which_python,
"--upgrade",
"delocate",
*constraint_flags(dependency_constraint),
+5 -1
View File
@@ -293,7 +293,9 @@ def setup_python(
# set up environment variables for run_with_env
env["PYTHON_VERSION"] = python_configuration.version
env["PYTHON_ARCH"] = python_configuration.arch
env["PIP_DISABLE_PIP_VERSION_CHECK"] = "1"
env.pop("UV_PYTHON", None)
if not use_uv:
env["PIP_DISABLE_PIP_VERSION_CHECK"] = "1"
# update env with results from CIBW_ENVIRONMENT
env = environment.as_dictionary(prev_environment=env)
@@ -334,6 +336,8 @@ def setup_python(
uv_path,
"pip",
"install",
"--python",
where_python,
"--upgrade",
"build[virtualenv]",
*constraint_flags(dependency_constraint),