lint: switch to uv for python management in linter
What changed, and why it matters
This change is a routine maintenance update to Bitcoin Core's internal linting (code style-checking) setup. It replaces one Python installation tool (pyenv) with another (uv) inside the CI lint container. There is no user-facing behavior change, no wallet or consensus code is touched, and no security vulnerability is present in the diff.
No security action required. Reviewers may optionally verify that the pinned uv image and installed Python package versions match project policy, but this is a normal tooling change.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The commit modifies three CI lint files to install Python via uv (Astral’s Python package manager) instead of cloning and building Python with pyenv/python-build. It creates a venv at /python_env, updates PATH references from /python_build/bin to /python_env/bin, and pins the uv binary copy to minor version 0.10 in the lint Dockerfile. The change is purely build-tooling hygiene.
Changed components
ci/lint/01_install.shci/lint/06_script.shci/lint_imagefileInspect captured patch +10 / −17
diff --git a/ci/lint/01_install.sh b/ci/lint/01_install.sh
index 573dbca5..50615030 100755
--- a/ci/lint/01_install.sh
+++ b/ci/lint/01_install.sh
@@ -22,25 +22,14 @@ ${CI_RETRY_EXE} apt-get update
# - moreutils (used by scripted-diff)
${CI_RETRY_EXE} apt-get install -y cargo curl xz-utils git gpg moreutils
-PYTHON_PATH="/python_build"
-if [ ! -d "${PYTHON_PATH}/bin" ]; then
- (
- ${CI_RETRY_EXE} git clone --depth=1 https://github.com/pyenv/pyenv.git
- cd pyenv/plugins/python-build || exit 1
- ./install.sh
- )
- # For dependencies see https://github.com/pyenv/pyenv/wiki#suggested-build-environment
- ${CI_RETRY_EXE} apt-get install -y build-essential libssl-dev zlib1g-dev \
- libbz2-dev libreadline-dev libsqlite3-dev curl llvm \
- libncursesw5-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev \
- clang
- env CC=clang python-build "$(cat "/.python-version")" "${PYTHON_PATH}"
-fi
-export PATH="${PYTHON_PATH}/bin:${PATH}"
+# Install Python and create venv using uv (reads version from .python-version)
+uv venv /python_env
+
+export PATH="/python_env/bin:${PATH}"
command -v python3
python3 --version
-${CI_RETRY_EXE} pip3 install \
+uv pip install --python /python_env \
lief==0.17.5 \
mypy==1.19.1 \
pyzmq==27.1.0 \
diff --git a/ci/lint/06_script.sh b/ci/lint/06_script.sh
index 1b36fada..a0f2dc88 100755
--- a/ci/lint/06_script.sh
+++ b/ci/lint/06_script.sh
@@ -12,7 +12,7 @@ set -o errexit -o pipefail -o xtrace
# of the mounted bitcoin src dir.
git config --global --add safe.directory /bitcoin
-export PATH="/python_build/bin:${PATH}"
+export PATH="/python_env/bin:${PATH}"
if [ -n "${LINT_CI_IS_PR}" ]; then
export COMMIT_RANGE="HEAD~..HEAD"
diff --git a/ci/lint_imagefile b/ci/lint_imagefile
index 77e9688c..d050153f 100644
--- a/ci/lint_imagefile
+++ b/ci/lint_imagefile
@@ -6,6 +6,10 @@
FROM mirror.gcr.io/ubuntu:24.04
+# Pin uv to minor version to avoid breaking changes:
+# https://docs.astral.sh/uv/reference/policies/versioning/
+COPY --from=ghcr.io/astral-sh/uv:0.10 /uv /uvx /bin/
+
COPY ./ci/retry/retry /ci_retry
COPY ./.python-version /.python-version
COPY ./ci/lint/01_install.sh /install.sh
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.