[red-knot] Log sys-prefix origin for easier debugging (#16921)

## Summary

Log the origin of the sys path prefix. This should help with debugging
if someone doesn't understand
why Red Knot picks up a certain venv.

## Test Plan

Ran the CLI and tested that it logs the origin
This commit is contained in:
Micha Reiser 2025-03-23 09:06:04 +01:00 committed by GitHub
parent 0360c6b219
commit 7fb765d9b6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -224,6 +224,9 @@ impl SearchPaths {
let site_packages_paths = match python_path {
PythonPath::SysPrefix(sys_prefix, origin) => {
tracing::debug!(
"Discovering site-packages paths from sys-prefix `{sys_prefix}` ({origin}')"
);
// TODO: We may want to warn here if the venv's python version is older
// than the one resolved in the program settings because it indicates
// that the `target-version` is incorrectly configured or that the