87 Commits

Author SHA1 Message Date
Ilya.Kazakevich
3388536d2c [python]: PY-85585 : Do not display vens as system pythons in "Add new interpreter" window.
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
2025-11-26 13:52:46 +00:00
David Lysenko
7ae15dd8d4 IJ-MR-182960-to-253
[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
2025-11-22 11:20:30 +00:00
David Lysenko
443406f930 [pycharm] PY-85618 Expose target information
Merge-request: IJ-MR-182369
Merged-by: David Lysenko <david.lysenko@jetbrains.com>

(cherry picked from commit 3a29771c841058d1591ae79eee71887ce495d15e)

IJ-MR-182369

GitOrigin-RevId: 7e24ff6fb745b422a9f949b46b27c692d7bbd3a2
2025-11-18 17:20:58 +00:00
Marcus Mews
33673afd98 PY-57566 Support PEP 660 editable installs.
GitOrigin-RevId: cca68d9504ae4f10a774cfbdd03c38f5176f88fd
2025-11-14 21:59:55 +00:00
Ilya.Kazakevich
e11a58046b [python] PY-85433: Survive IOException thrown by read.
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
2025-11-07 16:11:57 +00:00
Alexey Katsman
1ac353ef9a [python] PY-83881 Provide python info during environment detection
GitOrigin-RevId: 4382680255fc78925c4b23ce825a2894114040c5
2025-11-03 12:05:45 +00:00
David Lysenko
b4f77f3aee PY-85090
[pycharm] PY-85090 Improve close detection for LoggingProcess

[pycharm] PY-85090 Address feedback

[pycharm] PY-85090 Add empty screen when contexts are selected

[pycharm] PY-85090 Change expand/collapse all logic

[pycharm] PY-85090 Improve collapse all/expand all logic

[pycharm] PY-85090 Add bulk read override


Merge-request: IJ-MR-179958
Merged-by: David Lysenko <david.lysenko@jetbrains.com>

(cherry picked from commit 00b7b0dd121eeebcb5920514ca8a535520f71160)

IJ-MR-179958

GitOrigin-RevId: 048759fad0eb42b6e01d71225da535800c66feda
2025-10-25 12:11:40 +00:00
Vitaly Legchilkin
ae1a3c871c [python] (PY-84946) catch RuntimeException in target execution
* 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
2025-10-22 15:53:49 +00:00
Alexey Katsman
a03643bb9c [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
2025-10-22 13:10:20 +00:00
David Lysenko
fc7d863a50 IJ-MR-176106-to-253
[pycharm] PY-81494 Fix deadlocking code


Merge-request: IJ-MR-179432
Merged-by: David Lysenko <david.lysenko@jetbrains.com>
[pycharm] PY-81494 Config fixes

PY-81494

[pycharm] PY-81494 Fix further flakiness

[pycharm] PY-81494 Address feedback

[pycharm] PY-81494 Fix flakiness

[pycharm] PY-81494 Separate modules

[pycharm] PY-81494 Fix tests

[pycharm] PY-81494 Change waitFor to awaitExit for coroutines

[pycharm] PY-81494 Configuration fixes

[pycharm] PY-81494 Add usage statistics

[pycharm] PY-81494 Address feedback

[pycharm] PY-81494 Add more limit tests

[pycharm] PY-81494 Post-rebase fixes

[pycharm] PY-81494 Implement logging tests

[pycharm] PY-81494 Final design adjustments

[pycharm] PY-81494 Refactor flows

[pycharm] PY-81494 Add more OutputSection tests

[pycharm] PY-81494 Add Toolbar tests

[pycharm] PY-81494 Add InterText tests

[pycharm] PY-81494 Add FilterActionGroup tests

[pycharm] PY-81494 Add EmptyContainerNotice tests

[pycharm] PY-81494 Add CollapsibleListSection tests

[pycharm] PY-81494 Add ActionIconButton tests

[pycharm] PY-81494 Address feedback

[pycharm] PY-81494 Address feedback

[pycharm] PY-81494 Post-rebase fixes

[pycharm] PY-81494 Address initial feedback

[pycharm] PY-81494 Fix existing tests & add new to tree

[pycharm] PY-81494 Implement copy to clipboard button

[pycharm] PY-81494 Amend design

[pycharm] PY-81494 Begin implementing output tests

[pycharm] PY-81494 Refactor file structure

[pycharm] PY-81494 Implement tests for process list

[pycharm] PY-81494 wip tests for process list

[pycharm] PY-81494 Finishing touches

[pycharm] PY-81494 Consolidate list logic in the model

[pycharm] PY-81494 Add logging limits

[pycharm] PY-81494 Implement open tool window on exec service error

[pycharm] PY-81494 Implement open command in terminal

[pycharm] PY-81494 Add expansion actions

[pycharm] PY-81494 Implement categorization by coroutine names

[pycharm] PY-81494 Memorize expansion states between tool window openings

[pycharm] PY-81494 Memorize scroll state between tool window openings

[pycharm] PY-81494 Introduce collapsible section for process info

[pycharm] PY-81494 Implement view setting filtering

[pycharm] PY-81494 Refactor process logging to use shared flows

[pycharm] PY-81494 Implement tests for ProcessList composable

[pycharm] PY-81494 Implement process toolwindow prototype

Merge-request: IJ-MR-176106
Merged-by: David Lysenko <david.lysenko@jetbrains.com>


Merge-request: IJ-MR-179303
Merged-by: David Lysenko <david.lysenko@jetbrains.com>

GitOrigin-RevId: 44552a582dd628d206b207e02e6f24c7749b4d9f
2025-10-22 09:04:47 +00:00
Vitaly Legchilkin
96be92568d [python] (PY-78749) support ssh upload
Merge-request: IJ-MR-178510
Merged-by: Vitaly Legchilkin <Vitaly.Legchilkin@jetbrains.com>

(cherry picked from commit 1085eccff5433c0902aac46d648c9f536241e5d5)

IJ-MR-178510

GitOrigin-RevId: bf18b88f5b6ea2129d05374df722699ab605b2e3
2025-10-15 20:11:52 +00:00
Vitaly Legchilkin
8cd1721c45 [python] catch ServerRuntimeException from target SDKs
* Docker client throws it when docker agent is not available for example.

GitOrigin-RevId: 4e3a06467423ecbb0862beb5a7f8c692181855c9
2025-10-13 22:54:32 +00:00
Vitaly Legchilkin
5e2028d129 [python] (PY-78749) single dialog for all types of Python SDKs
+ old dialogs were removed

GitOrigin-RevId: 00ed85ba578c6419373d8605ed50954e7aa58f0a
2025-10-13 22:54:32 +00:00
Alexey Katsman
0c509dbb23 PY-82666 Fix undetached process cancellation when running packaging tool
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
2025-10-05 17:18:24 +00:00
Vladimir Krivosheev
d7875f7d97 IJPL-209419 remove unused dependency on intellij.platform.eel.impl
GitOrigin-RevId: 4335e0cc630a881691909b11cc23b140acccbbc1
2025-10-03 15:08:44 +00:00
Ilia Kirianovskii
f43aa95086 [bazel] Update build files (IJI-3062)
GitOrigin-RevId: 98a67396a48bddc3d084cc93c50ae2f2017bfe8c
2025-09-29 00:11:15 +00:00
Vladimir Krivosheev
1b3c93d736 IJ-CR-146078 IJPL-209510 use kotlinx-serialization core and json product modules instead of jps lib (except fleet - no idea what to do)
GitOrigin-RevId: b74e1ac62eb7917aac3d5edb4bbfd2be2a4a191e
2025-09-26 20:36:41 +00:00
Vladimir.Koshelev
c5b44ca085 [python] PY-84398 get rid of package prefix in python modules.
It doesn't work. Sad, but true.

GitOrigin-RevId: c6cf4f2971ce813a2ce18afb2dcee22c2c5dad75
2025-09-26 15:15:29 +00:00
Vladimir.Koshelev
ba393efaa7 [python] PY-84398 get rid of embedded loading rules in PythonCore plugin, fix related issues
GitOrigin-RevId: 54f4bb333e0ca06a002a86c75f0bbc474863253e
2025-09-26 15:15:29 +00:00
Ilia Kirianovskii
0a0f0f4ba8 [python] Add intellij.python.community.execService._test module descriptor to run tests in dev-mode (IJPL-116621)
GitOrigin-RevId: 4ac875d629c57ba44248cb6028145dc550c77d76
2025-09-25 00:06:41 +00:00
Ilia Kirianovskii
6f8920da99 [bazel] Update build files (IJI-3062)
GitOrigin-RevId: 2394c1289e33945f7640f249b17cbf34b31fd695
2025-09-23 09:25:59 +00:00
Ilya.Kazakevich
0fecbf2ca1 Python: report wrong version string
GitOrigin-RevId: ebdcf4f5be07bd1a7ff4bffd2b81a7114c2f283e
2025-09-02 14:46:47 +00:00
Ilya.Kazakevich
85d34e9c0e Python: drop unused symbols
GitOrigin-RevId: 6d571b57c6e5abe2ac88765b1c73b7f31bb1503b
2025-09-01 18:57:34 +00:00
Nikolay Chashnikov
4f63150cff [intellij project configuration] change JVM target level from 17 to 21 in Kotlin facets (IJPL-176259)
GitOrigin-RevId: d518be3562a359b9d4034c2972d7c8444741b7f0
2025-08-30 07:50:09 +00:00
Ilya.Kazakevich
0cf893efdf Python: support getting version for python on target.
See test for usage example

GitOrigin-RevId: aa65f15d294585040c3cdadc2ef3057c85136a19
2025-08-27 22:56:52 +00:00
Aleksei.Cherepanov
c7515bfd3a KTIJ-35250 [Bazel] Promote "Missing dependency superclass" warning to error (part 2)
This commit enables check only for modules WITH a Kotlin facet
Bazel generator was updated as well

GitOrigin-RevId: 90a3427d4b5a3ebc29e257693cb3748ac09bfc6a
2025-08-24 18:49:00 +00:00
Ilia Kirianovskii
dc268560b6 [bazel] Update build files (IJI-2835)
GitOrigin-RevId: 275260ab73f59d3c08f0b4cb9f4c89b74054094a
2025-08-20 08:49:22 +00:00
Vitaly Legchilkin
eb336fedc2 [python] show execution command and outputs for conda runner in case of parsing failures (PY-76274)
+ ZeroCodeStdoutParserTransformer  
 + ZeroCodeJsonParserTransformer
 + add transformer showcase


Merge-request: IJ-MR-172758
Merged-by: Vitaly Legchilkin <Vitaly.Legchilkin@jetbrains.com>

GitOrigin-RevId: 1f293e8725a986eaed2a6050a3c6a240441f09fe
2025-08-19 08:09:48 +00:00
Ilya.Kazakevich
c51f227a33 PyCharm tests: shutdown targets when process dies
GitOrigin-RevId: 7036b78a905017b418cecc8d16659bcdcdee4f9e
2025-08-13 22:20:51 +00:00
Ilya Kazakevich
ec7562bf07 Python: Introduce API to get process from SDK via ExecService
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
2025-08-08 19:08:05 +00:00
Ilya.Kazakevich
12960161ff Python: Introduce functions to call code against SDK:
See `sdkExecApi.kt`

GitOrigin-RevId: 0014b607ee6efa058e9144cfb208c7e75dff1e47
2025-08-06 23:27:57 +00:00
Ilya.Kazakevich
837468c5f6 Python ExecService: Add ability to configure target command dynamically as it is used by Sdk
See `configureBuilderToRunPythonOnTarget`.

GitOrigin-RevId: a96a8b34a6d4cf1dbe3a08b26627b6ca5491df47
2025-08-06 20:50:59 +00:00
Ilya.Kazakevich
b01f494ec3 Support "local" target in exec service
GitOrigin-RevId: 28f24501c5e2fd829cbeceb0d9c104cbf2b1ab08
2025-08-06 18:18:50 +00:00
Ilya Kazakevich
8f83b52355 Python: Support Targets API in ExecService.
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
2025-08-06 16:10:47 +00:00
Andrii Zinchenko
2fa1af099c [eel][wsl] IJPL-196973 Compile error open target not source in wsl
- Split EelDescriptor in to EelDescriptor and the EelMachine
- Add EelPathBoundDescriptor

GitOrigin-RevId: e0b7e5d5f3532682498466642b034e1892ef3cda
2025-07-23 15:04:29 +00:00
Leonid Shalupov
cff76ea65e bazel: split test and build sections in convert jps to bazel:L update Bazel files
GitOrigin-RevId: 90063178de33c2a95bfdebd160a721d6977d8097
2025-07-18 16:18:47 +00:00
Ilya.Kazakevich
d707df8c14 PY-82160: No need to kill process explicitly as it is not part of Eel API.
See previous commit.

GitOrigin-RevId: 155c6a407da75e6f0be8afce70c167adfb03bcb9
2025-07-05 03:02:06 +00:00
Ilya.Kazakevich
0099974fc3 Python: eel supports absolute paths only.
Relative path is always local: either against workdir or current process dir

GitOrigin-RevId: 850473bfa7d93d8ca072db04cd23d0ea5d1e71c3
2025-07-03 04:28:17 +00:00
Ilya.Kazakevich
92d8c4f34c Python: kill process when scope is cancelled.
Previous implementation wasn't synchronized leaving space for a race.

GitOrigin-RevId: 00231be95ac33daf27bb8fe7a814c9f2fcd89f08
2025-07-02 16:10:56 +00:00
Ilya.Kazakevich
3eadc38e05 Python: do not catch CancellationException in test
GitOrigin-RevId: 065eda796cc74c858de88d64c6ed3f10530ce39b
2025-07-01 20:55:53 +00:00
Ilya.Kazakevich
4964cc3a7d PY-82326: Preparation for it (WIP): support ExecError for targets.
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
2025-07-01 08:05:21 +00:00
Ilya.Kazakevich
fb1a3c893b Python: narrow various return types
GitOrigin-RevId: a98a36eefe29964754fd28e445703ac91464237b
2025-06-30 21:53:26 +00:00
Ilya.Kazakevich
72594825bd Python: no need to catch EelPathException: it is always programmer error (user is not interested in it)
GitOrigin-RevId: c48d56cd6741998805532f27392753688830ebb3
2025-06-30 18:21:10 +00:00
Nikita.Ashihmin
024d2ae147 PY-82119 Packaging: Fix env tests for conda
Signed-off-by: Nikita.Ashihmin <nikita.ashihmin@jetbrains.com>

GitOrigin-RevId: 47286211e8ca894aa2e04c3f65528a2ab22fc37c
2025-06-25 17:06:43 +00:00
Nikita.Ashihmin
1ea6fe28d7 PY-82119 Packaging: Fix '\r' for windows in EEL
Signed-off-by: Nikita.Ashihmin <nikita.ashihmin@jetbrains.com>

GitOrigin-RevId: 27c3a790fc471ee45ea707d0a17fb43df7414926
2025-06-25 16:22:59 +00:00
Ilya.Kazakevich
f4cee89a79 PY-82160: Kill process along with the scope.
When scope is cancelled, process must also be killed.

Otherwise, readers would be blocked forever

GitOrigin-RevId: 3a9c628845779b65298a2a4ab6ea4a1cecd60566
2025-06-24 01:46:22 +00:00
Nikita Ashihmin
7a7c9b3f2d PY-82191 PySDK: Refactor new priject creation to support progress
GitOrigin-RevId: 6af82359528b086811c958577f296669eb578353
2025-06-23 15:41:20 +00:00
Evgenii Ilichev
06fb3e21e6 Update test definitions in BUILD.bazel
GitOrigin-RevId: 12636c0153e8909f9d9658a07278edac5ceb9c23
2025-06-18 19:05:49 +00:00
Ilya.Kazakevich
107201d413 Python: refactoring before interpreters service.
Extract various classes to the shared modules, `ExecutablePython` now has `env` map as it can be used by conda.

GitOrigin-RevId: eb45ea29f49132fa4f91c979f71453e6a2ade344
2025-06-08 04:14:00 +00:00
Ilya.Kazakevich
105554c91d Python: introduce getOr("message"){} API to add errors on an appropriate level.
See `getOr` extension doc.

GitOrigin-RevId: 859af221e99f03b99ee2f82e829e83e0f00a9e6d
2025-06-07 22:05:56 +00:00