Skip to content

MONGOCRYPT-872 Use uv tool to obtain CMake, Ninja, and Python#1153

Open
eramongodb wants to merge 8 commits intomongodb:masterfrom
eramongodb:crypt-872
Open

MONGOCRYPT-872 Use uv tool to obtain CMake, Ninja, and Python#1153
eramongodb wants to merge 8 commits intomongodb:masterfrom
eramongodb:crypt-872

Conversation

@eramongodb
Copy link
Copy Markdown
Contributor

Resolves MONGOCRYPT-872. Successor to mongodb/mongo-cxx-driver#1428 and mongodb/mongo-c-driver#2097.

Introduces the install-build-tools.sh script, which installs latest versions of cmake, ninja, and python for subsequent use by build-and-test EVG tasks, reducing dependence on system-provided binaries (numerous inconsistent versions across distros). Because of the age of certain EVG distros still in use by the current configuration, the latest uv-installer.sh script (version 0.11.8) is bundled and used as a fallback when a system-provided uv binary is not available (see: DEVPROD-13413 and DEVPROD-22169). Note that uv-installer.sh finally embeds checksums in the script itself, so the checksum patch script used in prior PRs is no longer required.

The Earthfile is also updated to install and use uv whenever possible (for compatibility with other updated build scripts which now require uv). When a system package provides uv directly, it is used (regardless of its version); otherwise, the newest-available pip provided by system packages is used to install uv instead (always the latest available version). This is made possible following #1148.

All calls to run_* (formerly provided by init.sh) are replaced with simple commands instead (available via PATH exported by install-build-tools.sh). All calls to python are invoked through uv. Note that install-build-tools.sh exports CMAKE_GENERATOR=Ninja on all non-Windows environments by default, simplifying other helper scripts. However, a comment is added to this line which is responsible for selecting the Ninja generator even on Windows, which as a single-config generator (not-obviously) impacts the layout of build artifacts that are depended-on by downstream test scripts such as bindings/python/.evergreen/test.sh.

Due to the age of certain EVG distros (notably RHEL 6 and RHEL 7) which do not provide a sufficiently recent Python version to support uv, these distros are special-cased to defer partially or entirely to the mongodbtoolchain binaries present in the those environments. These workarounds should be removed once the EVG configuration is updated to migrate away from these EOL, unsupported distros (outside the scope of this PR).

@eramongodb eramongodb self-assigned this Apr 27, 2026
@eramongodb eramongodb requested a review from a team as a code owner April 27, 2026 17:57
Copy link
Copy Markdown
Collaborator

@kevinAlbs kevinAlbs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM with minor comments.

Comment thread .evergreen/benchmark-python.sh Outdated
. ./venv/bin/activate
python -m pip install --prefer-binary -r requirements-test.txt
python -m pip install -e .
uv python install
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove uv python install? I expect python is already installed by the uv venv command.

Comment thread .evergreen/install-build-tools.sh Outdated
INSTALLER_PRINT_VERBOSE=1 \
"${script:?}" || return

PATH="${uv_install_dir:?}:$PATH" || return
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggest removing || return since I expect the variable assignment cannot fail.

Suggested change
PATH="${uv_install_dir:?}:$PATH" || return
PATH="${uv_install_dir:?}:$PATH"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants