[python] PY-84777 Use system pythons as a fallback for SDK configuration

There was a problem with detecting system-wide pythons, which relied on
binary not being a part of conda env or virtualenv. But it led to
unrelated Hatch and Poetry pythons automatically configured as
interpreters in new projects. Another problem is that free-threaded
python was chosen as default interpreter with highest priority because
of the newest version.

This change uses SystemPythonService to detect system pythons properly,
also free-threaded python used as a default interpreter only if it's the
only available option.

Merge-request: IJ-MR-179008
Merged-by: Alexey Katsman <alexey.katsman@jetbrains.com>

GitOrigin-RevId: 73bc98aed2918c44832b57f22b86c9c7d17a4301
This commit is contained in:
Alexey Katsman
2025-10-22 13:10:20 +00:00
committed by intellij-monorepo-bot
parent 9140cb4e7b
commit a03643bb9c
44 changed files with 304 additions and 272 deletions
@@ -1170,6 +1170,7 @@ install.packages.from.pipfile=Install packages from Pipfile
looking.for.default.interpreter=Looking for the default interpreter setting for a new project
looking.for.previous.system.interpreter=Looking for the previously used system-wide interpreter
looking.for.system.interpreter=Looking for a system-wide interpreter
looking.for.system.pythons=Looking for system pythons
looking.for.shared.conda.environment=Looking for a shared conda environment
current.interpreter=Current Interpreter: {0}
switch.python.interpreter=Switch Python Interpreter