From bc0f7fe0d8a5ad8fa31b99d42d62fe533efac2af Mon Sep 17 00:00:00 2001 From: Stevie Gayet Date: Mon, 1 Apr 2024 15:36:40 +0200 Subject: [PATCH] feat(python): display warning message when trying to use an unsupported Python version Closes https://github.com/astral-sh/uv/issues/2587. --- crates/uv/src/commands/venv.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/crates/uv/src/commands/venv.rs b/crates/uv/src/commands/venv.rs index 6faa5e1316f9..9cd3c86d7eaf 100644 --- a/crates/uv/src/commands/venv.rs +++ b/crates/uv/src/commands/venv.rs @@ -23,6 +23,7 @@ use uv_resolver::{InMemoryIndex, OptionsBuilder}; use uv_types::{ BuildContext, BuildIsolation, ConfigSettings, InFlight, NoBinary, NoBuild, SetupPyStrategy, }; +use uv_warnings::warn_user; use crate::commands::ExitStatus; use crate::printer::Printer; @@ -113,6 +114,10 @@ async fn venv_impl( find_default_python(cache).into_diagnostic()? }; + if interpreter.python_tuple() < (3, 8) { + warn_user!("uv is only compatible with Python 3.8+, found Python {}.", interpreter.python_version()); + } + writeln!( printer.stderr(), "Using Python {} interpreter at: {}",