Skip to content

Commit

Permalink
feat(python): display warning message when trying to use an unsupport…
Browse files Browse the repository at this point in the history
…ed Python version

Closes #2587.

Co-authored-by: Stevie Gayet <[email protected]>
  • Loading branch information
zanieb and stegayet committed Apr 24, 2024
1 parent 005b767 commit 8ae344d
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions crates/uv/src/commands/venv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ use uv_fs::Simplified;
use uv_interpreter::{find_default_python, find_requested_python, Error};
use uv_resolver::{ExcludeNewer, FlatIndex, InMemoryIndex, OptionsBuilder};
use uv_types::{BuildContext, BuildIsolation, HashStrategy, InFlight};
use uv_warnings::warn_user;

use crate::commands::ExitStatus;
use crate::printer::Printer;
Expand Down Expand Up @@ -120,6 +121,14 @@ async fn venv_impl(
find_default_python(cache).into_diagnostic()?
};

// Warn on usage with an unsupported Python version
if interpreter.python_tuple() < (3, 8) {
warn_user!(
"uv is only compatible with Python 3.8+, found Python {}.",
interpreter.python_version()
);
}

// Add all authenticated sources to the cache.
for url in index_locations.urls() {
store_credentials_from_url(url);
Expand Down

0 comments on commit 8ae344d

Please sign in to comment.