Instead of old `addManuallyAddedInterpreter` we now have two functions: one that requires system python and one that doesn't.
Both functions register system python if provided, but the latter one accepts any python (venv included).
Various "selectors" use these functions.
We also make sure no non-system python is set to `baseInterpreters`: base are always system!
As a bonus, we show "system" or "virtual env" title near interpreter.
It now checks that python is system (see `ensureSystemPython`).
Non-system pythons are never reported, and `registerSystemPython` also returns an error for non-system pythons
We need `execGetBoolFromStdout` for the further changes
Merge-request: IJ-MR-182415
Merged-by: Ilya Kazakevich <ilya.kazakevich@jetbrains.com>
(cherry picked from commit 2950f5f0cd2745c12987a92e40774d366568f312)
GitOrigin-RevId: f30e9a6cd7b5d103454d66f26a0c2282d7c587fc
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
+ add requirePythonSdk() verification for the Sdk extension functions, these methods are not designed to be called for non-python sdks and now will throw IllegalArgumentException.
also corrects dependency tree:
+ move PythonSdkUtil to the python.sdk module, remove dependency on psi.impl
+ create PySkeletonUtil for skeleton utils and leave it in the psi.impl
[python] (IJPL-205889) (BAZEL-2462) don't call getOrCreateAdditionalData for non-python sdks
+ add requirePythonSdk() verification for the Sdk extension functions, these methods are not designed to be called for non-python sdks and now will throw IllegalArgumentException
also corrects dependency tree:
+ move PythonSdkUtil to the python.sdk module, remove dependency on psi.impl
+ create PySkeletonUtil for skeleton utils and leave it in the psi.impl
GitOrigin-RevId: 20d958c5e15cc4e05545b2e61b126b5e015696ed
This module listens for topic that model was just rebuilt from `pyproject.toml` and does its best to configure SDK.
It will support UI to make this process configurable
GitOrigin-RevId: c752c94385814b5fc4413316c0d9d4cc2adb41e4
After this refactoring we how have `comparators.kt` with sorting logic that is used both by `SystemPython` and `PythonSelectableInterpreter` (ViewModel thing for V2).
Tests are also added.
GitOrigin-RevId: 9d04405829f31874d15cb893d9261c7997cb2dd5
Extract various classes to the shared modules, `ExecutablePython` now has `env` map as it can be used by conda.
GitOrigin-RevId: eb45ea29f49132fa4f91c979f71453e6a2ade344
Use `ExecService` `api.kt` to exec any binary and extensions from `execService.python/api.kt` for python-specific things (i.e helpers)
GitOrigin-RevId: bb217798a9d1ee886c4b12220ec1f66a5ef08336
* introduce PyResult.localizedError() (instead of failure()
* get rid of obsolete kotlin.Result.failure(..) extension
* add errorOrNull to python.Result, to access it from Java classes
Merge-request: IJ-MR-163973
Merged-by: Vitaly Legchilkin <Vitaly.Legchilkin@jetbrains.com>
GitOrigin-RevId: 2bd8336cf4c53170eea5d050f609fd64541ebd99
According to feedback, the name `upgrade` confuses people.
We refused `getEelApi` because this call usually implies a getter, and a getter usually implies some lightweight operation.
We refused `make`, `convert`, `get` and other short methods because they're as confusing as `upgrade`.
GitOrigin-RevId: 56adf5362f93bc4f98954db79c039e5e898b4550
People usually struggle to run a Gradle script to install pythons, so we:
1. Tell them explicitly what to do.
2. Provide `PYTHON_FOR_TESTS` env var they can point to Python.
GitOrigin-RevId: 06337f1f7d831f1d4b1e94134bdc78c2db2a08dc
If we access `SystemPythonServiceImpl` before the Application is fully loaded (i.e. `com.intellij.python.junit5Tests.env.systemPython.SystemPythonRootsFixer.execute`), we might encounter an error:
```
Registry key python.system.refresh.minutes is not defined
```
With this change we access Registry lazily and, unlike `Registry.get`, `RegistryManager` async service is fully safe: it just suspends until the Registry is available.
Merge-request: IJ-MR-160727
Merged-by: Ilya Kazakevich <ilya.kazakevich@jetbrains.com>
GitOrigin-RevId: ef56cfee7b15907c7c99b859b5704b6fcef66b01