From 9817870141ed8c1108576d497da15f086b3d2659 Mon Sep 17 00:00:00 2001 From: Tobias Diez Date: Sun, 14 Sep 2025 08:52:41 +0800 Subject: [PATCH 1/3] Improve hint for installing meson-python when missing as build backend --- crates/uv-build-frontend/src/error.rs | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/crates/uv-build-frontend/src/error.rs b/crates/uv-build-frontend/src/error.rs index 299ce3e0085e4..77ba4cadf1137 100644 --- a/crates/uv-build-frontend/src/error.rs +++ b/crates/uv-build-frontend/src/error.rs @@ -160,13 +160,20 @@ fn hint_build_dependency( f: &mut std::fmt::Formatter<'_>, display_name: &str, package_name: &str, - package: &str, + build_backend: &str, ) -> std::fmt::Result { let table_key = if package_name.contains('.') { format!("\"{package_name}\"") } else { package_name.to_string() }; + // The build backend 'mesonpy' can be installed via the 'meson-python' Python package + let build_package = if build_backend == "mesonpy" { + "meson-python" + } else { + build_backend + }; + write!( f, "This error likely indicates that `{}` depends on `{}`, but doesn't declare it as a build dependency. \ @@ -178,13 +185,13 @@ fn hint_build_dependency( \n\ or `{}` into the environment and re-run with `{}`.", display_name.cyan(), - package.cyan(), + build_package.cyan(), package_name.cyan(), - package.cyan(), + build_package.cyan(), "build-system.requires".green(), table_key.cyan(), - package.cyan(), - format!("uv pip install {package}").green(), + build_package.cyan(), + format!("uv pip install {build_package}").green(), "--no-build-isolation".green(), ) } From 181c201ab4c3eeabb6b082009feaf79341c3461f Mon Sep 17 00:00:00 2001 From: Tobias Diez Date: Sun, 14 Sep 2025 08:58:18 +0800 Subject: [PATCH 2/3] fix linter --- crates/uv-build-frontend/src/error.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/uv-build-frontend/src/error.rs b/crates/uv-build-frontend/src/error.rs index 77ba4cadf1137..2aedaf4b548b3 100644 --- a/crates/uv-build-frontend/src/error.rs +++ b/crates/uv-build-frontend/src/error.rs @@ -167,13 +167,13 @@ fn hint_build_dependency( } else { package_name.to_string() }; - // The build backend 'mesonpy' can be installed via the 'meson-python' Python package + // The build backend 'mesonpy' can be installed via the 'meson-python' Python package let build_package = if build_backend == "mesonpy" { "meson-python" } else { build_backend }; - + write!( f, "This error likely indicates that `{}` depends on `{}`, but doesn't declare it as a build dependency. \ From b45c9805bbbe5b7a114df4d9bb96d5fe3a236048 Mon Sep 17 00:00:00 2001 From: Tobias Diez Date: Mon, 22 Dec 2025 13:16:13 +0100 Subject: [PATCH 3/3] Add meson-python mapping --- crates/uv-build-frontend/src/error.rs | 17 +++++------------ crates/uv-build-frontend/src/pipreqs/mapping | 1 + 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/crates/uv-build-frontend/src/error.rs b/crates/uv-build-frontend/src/error.rs index 2aedaf4b548b3..299ce3e0085e4 100644 --- a/crates/uv-build-frontend/src/error.rs +++ b/crates/uv-build-frontend/src/error.rs @@ -160,20 +160,13 @@ fn hint_build_dependency( f: &mut std::fmt::Formatter<'_>, display_name: &str, package_name: &str, - build_backend: &str, + package: &str, ) -> std::fmt::Result { let table_key = if package_name.contains('.') { format!("\"{package_name}\"") } else { package_name.to_string() }; - // The build backend 'mesonpy' can be installed via the 'meson-python' Python package - let build_package = if build_backend == "mesonpy" { - "meson-python" - } else { - build_backend - }; - write!( f, "This error likely indicates that `{}` depends on `{}`, but doesn't declare it as a build dependency. \ @@ -185,13 +178,13 @@ fn hint_build_dependency( \n\ or `{}` into the environment and re-run with `{}`.", display_name.cyan(), - build_package.cyan(), + package.cyan(), package_name.cyan(), - build_package.cyan(), + package.cyan(), "build-system.requires".green(), table_key.cyan(), - build_package.cyan(), - format!("uv pip install {build_package}").green(), + package.cyan(), + format!("uv pip install {package}").green(), "--no-build-isolation".green(), ) } diff --git a/crates/uv-build-frontend/src/pipreqs/mapping b/crates/uv-build-frontend/src/pipreqs/mapping index 8edacdd6deb87..9a4f4d75267c2 100644 --- a/crates/uv-build-frontend/src/pipreqs/mapping +++ b/crates/uv-build-frontend/src/pipreqs/mapping @@ -777,6 +777,7 @@ marks:pytest_marks markupsafe:MarkupSafe mavnative:pymavlink memcache:python_memcached +mesonpy:meson-python metacomm:AllPairs metaphone:Metafone metlog:metlog_py