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
[pycharm] PY-85729 Post-cherry-pick fixes
[pycharm] PY-85729 Fix stress test on Windows
[pycharm] PY-85729 Fix smoke tests
[pycharm] PY-85729 Add visibility attribute to plugin config
[pycharm] PY-85729 Add a coroutine cleanup test
[pycharm] PY-85729 Add a stress env test
[pycharm] PY-85729 Minor cosmetic fixes
[pycharm] PY-85729 Performance improvement: add debounce to reduce the amount of GC garbage
[pycharm] PY-85729 Fix potential OOM: adjust limits
[pycharm] PY-85729 Fix potential OOM: add cancellation logic for background process observer
The background error process observation logic didn't cancel the coroutines, making them last for way longer than needed. Cancellation logic was added to remedy this.
[pycharm] PY-85729 Fix OOM: Force LazyTree recomposition on tree change
It looks like LazyTree composable hogs memory by keeping track of all the previous trees; this is bad for our use case as any snapshot change to the tree will be saved, causing potential OOM by not freeing the processes. This is fixed by forcing a recomposition on each tree change (via key(tree)).
Merge-request: IJ-MR-183264
Merged-by: David Lysenko <david.lysenko@jetbrains.com>
GitOrigin-RevId: 6a3f71219da1b8577b26d35ce73846685314eb3d
While closing remote stream should lead to `EOF` (`-1`), `read` might still throw `IOException`.
This is documented by the `read` contract, and we face it when underlying stream gets closed i.e: one thread was blocked by `read` and another one called `close`.
(cherry picked from commit 2c49be37333a794c6ed1f5ce4ad3d8d2f29b93fa)
IJ-MR-181675
GitOrigin-RevId: f3f40e8edbc0caa2450b297ae278b37a754a5f49
* too-wide catch block because some types like DockerRemoteRequest throw base RuntimeException instead of anything meaningful, need to change platform code first
(cherry picked from commit 869bd4892b82be39d42a082a83bf1191c8d404f2)
IJ-MR-179433
GitOrigin-RevId: d214bf43f3fe86f7856816aeec7a7458412ffacb
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
Pip packaging tool used legacy process handler, which led to undetached
processes being spawned and even process leaks if they are really long
running. This led to flaky tests that were trying to delete temporary
directories after the test was finished, and at the same time process
was still running and creating __pycache__ directories there. That's
where a DirectoryNotEmptyException was thrown leading to a test failure.
The whole problem was fixed by using a new ExecService instead of a
legacy process handler. Also unused register keys `python.packaging.tool.use.project.location.as.working.dir` and `python.packaging.tool.upload.project` have been removed.
Merge-request: IJ-MR-176080
Merged-by: Alexey Katsman <alexey.katsman@jetbrains.com>
GitOrigin-RevId: 31c02fc8c25abd5941518958e7e2651f3771bad1
This commit enables check only for modules WITH a Kotlin facet
Bazel generator was updated as well
GitOrigin-RevId: 90a3427d4b5a3ebc29e257693cb3748ac09bfc6a
Look `src/com/jetbrains/python/sdk/sdkExecApi.kt` for method that executes SDK and returns a process.
See `PySdkOnTargetTest` as a usage example.
Merge-request: IJ-MR-171740
Merged-by: Ilya Kazakevich <ilya.kazakevich@jetbrains.com>
GitOrigin-RevId: a7e9b6995eba7ae1fa71019b370acca2d98738d2
API changes:
Class `Args` is not used to provide arguments for commands. Previous implementation was incompatible with Targets.
Instead of `Path` we now accept `BinaryToExec` which is either Eel or Target based.
Impl:
`ExecServiceImpl` now delegates execution to `com.intellij.python.community.execService.impl.processLaunchers`: there are two functions (Eel and Targets)
Merge-request: IJ-MR-171488
Merged-by: Ilya Kazakevich <ilya.kazakevich@jetbrains.com>
GitOrigin-RevId: 4c4ac7023e6605caaacb1880d60faf145b4160bf
SSH is now target-based and we can't use `EelPath` with it. So we now have two types of `ExecError.exe`.
Test is going to be created as next commit
GitOrigin-RevId: 6bc56eb9770caeb7ba32c8f43e6f374fcf5a3325
When scope is cancelled, process must also be killed.
Otherwise, readers would be blocked forever
GitOrigin-RevId: 3a9c628845779b65298a2a4ab6ea4a1cecd60566
Extract various classes to the shared modules, `ExecutablePython` now has `env` map as it can be used by conda.
GitOrigin-RevId: eb45ea29f49132fa4f91c979f71453e6a2ade344