Commit Graph

308 Commits

Author SHA1 Message Date
Aleksandr Sorotskii
5dde5518fa cleanup package name normalization; PY-79870
(cherry picked from commit cfc8e220df5d7a2a33b2c027bbf37a7d5055ffc5)

IJ-MR-158370

GitOrigin-RevId: 85f665ae8f601052eb21526f974f196d6f53ceb9
2025-03-27 12:07:58 +00:00
Timur Malanin
dbdb988529 PY-54850 Normalized package names in PyPackageRequirementsInspection for consistent matching and refactored requirement satisfaction checks. Unified normalizePackageName logic. introduced a test to verify that requirement mismatch warnings disappear upon package installation.
GitOrigin-RevId: 11a4c70e26abcb4cb6d445016d8f68599666fb16
2025-03-22 14:02:34 +00:00
David Lysenko
a782da7be5 [pycharm] PY-78648 Resolve uv correctly on windows
GitOrigin-RevId: f280a79ce566d43682fd77da735d037fff2e9ed3
2025-02-17 13:58:20 +00:00
Vitaly Legchilkin
d1bac97eb8 [python] ExecService / PyError adjustments (PY-60410)
+ replace processDescription and timeout fields with ExecOptions
+ add workingDirectory and env variables to exec options
+ support ProcessOutputTransformer for cases when both stdout/stderr and custom error handling is needed
+ make PyError classes open to have custom business errors

GitOrigin-RevId: 99c969e730cdbf23df4c9b176a43f78ede43001a
2025-02-12 21:19:30 +00:00
Leonid Shalupov
e4e5753846 housekeeping: remove unused imports
GitOrigin-RevId: ccba6d05260f5eb551ffa87e0d8a38dc93148a3a
2025-02-04 11:00:15 +00:00
Ilya.Kazakevich
6b6658fbc9 Python: make system python service available from community.
We make it a part of PythonCore module to use it from community

GitOrigin-RevId: ea6b00b6ac1a24478f9ff74cb34beffab0942089
2025-02-03 22:07:16 +00:00
Aleksandr Sorotskii
e0e9e611a6 support for listing uv provided pythons PY-77537
GitOrigin-RevId: 7003a66ba729d7565c1cf876198d85d45d025659
2025-02-03 17:10:53 +00:00
Ilya.Kazakevich
69d4f52dbb Python tests: move venv test fixture into a separate module
We finally decouple test framework from community impl

GitOrigin-RevId: 87178107f2fe785d295aca4cb46527634f465f90
2025-02-02 21:05:54 +00:00
Vladimir Krivosheev
b8245e1370 IJ-CR-146078 update bazel files
GitOrigin-RevId: 3bcfd10f71c84283bded464e142ead99edc6a278
2025-02-02 15:20:11 +00:00
Ilya.Kazakevich
dafe83d2c7 Python: temporary hack: Move SPP to community to break cyclic dependency.
Will move it back soon.

GitOrigin-RevId: b2f032dbc9926b2e23c0438d2ce522985c7a6ad4
2025-01-30 17:45:52 +00:00
Ilya.Kazakevich
eab4466488 Python: move VirtualEnvReader out of psi-impl module
GitOrigin-RevId: c4d7bd0bf0c5592b13a2ccffcd217c1bae819637
2025-01-29 21:40:40 +00:00
Ilya.Kazakevich
4678462b27 Python: move PyError and ErrorSink into api to reuse it in modules
GitOrigin-RevId: 44eeac6d4a44a4ce095a1b4aed1cccca61a4efbb
2025-01-29 02:33:56 +00:00
Ilya.Kazakevich
0ef4f9cb65 Python: extract venv var to reuse it between modules
GitOrigin-RevId: d04c02a9cab979b86a2b97a13edc834f883025be
2025-01-28 04:12:03 +00:00
Vladimir Krivosheev
97eb8081ed update bazel files
GitOrigin-RevId: fc8f02d9532ef4f014925f793434e9b0bcfd9317
2025-01-26 19:04:16 +00:00
Ilya.Kazakevich
d1b441d0bb Python: Replace localized string class with string with annotation.
No need to have a separate class

Signed-off-by: Ilya.Kazakevich <ilya.kazakevich@jetbrains.com>

GitOrigin-RevId: 9af33f30bbab9a85609c0c6536cb3120347fa20b
2025-01-24 02:02:40 +00:00
Ilya.Kazakevich
6b4fabf59a PY-78649: Migrate to Result with PyError (first steps).
`com.jetbrains.python.Result<Something, PyError>` is supported by `com/jetbrains/python/util/ErrorSink.kt`

The idea: if your function executes some external command, return an error as the aforementioned class. `ErrorSink` will display it nicely.

GitOrigin-RevId: d8a7d6997a9aded91691dbb531c3d4286de85f15
2025-01-23 04:42:24 +00:00
Ilya.Kazakevich
ca2148932f PY-78649: Improve error handling.
There were three problems:

1.
There was `PyExecutionException` with an optional message which was intended to be displayed via dialog using a message as a title.
It breaks an exception contract (code that isn't aware of this particular class should still be able to fetch info, and a message is usually blank).

2.
Moreover, `ErrorSink` wasn't aware of it either and displayed it as a plain text.

3.
`PyExecutionException` didn't distinguish between "process can't be started" and "process died with error code != 0". Those are different cases.

This change:
1. Fixes `PyExecutionException` for 1 and 3.
2. Introduces API in `ErrorSink.kt` to display `PyExecutionException`

GitOrigin-RevId: a8d835afb086b23c73ced15f243d2b27b59dcf82
2025-01-22 23:07:52 +00:00
Ilya.Kazakevich
4b22bc0b72 Python: add method to Result to simplify migration
GitOrigin-RevId: 05983eae9d6e6f4047d62abdd690d3bc80d2b2da
2025-01-22 22:18:20 +00:00
Vladimir Krivosheev
0bc1cf1557 update bazel files
GitOrigin-RevId: 7320d3eff3aba093692ce66839c720ece6d7c4db
2024-12-30 11:28:24 +00:00
Vladimir Krivosheev
7b9ec58009 do not export intellij.database.connectivity.tests
GitOrigin-RevId: a1ef44dfa34cde110c9e6cad19d11b5e3019ab72
2024-12-28 21:45:55 +00:00
Vladimir Krivosheev
68d99c6550 cleanup
GitOrigin-RevId: 9cb238c220249088bfc75a448eb310b93c7fc45c
2024-12-26 14:56:01 +00:00
Ilya.Kazakevich
6f0f9cc8eb Python: move PythonBinary to reuse across the modules
GitOrigin-RevId: 4e79a8fd330e95eca09d81386ab6e143f8ad2c4a
2024-12-17 20:01:59 +00:00
Ilya.Kazakevich
9f37594a1f Python test: move test to module with code as PoC that tests can be accessed via cross-module deps
GitOrigin-RevId: 7819273fccb719ea065611f3f2e26bf3f13fe558
2024-12-17 19:38:33 +00:00
Vladimir Krivosheev
98799639aa do not use _test as lib - test targets do not support this
GitOrigin-RevId: f2f49db4294b6a64040dbbd5f1d95e972cbd70a3
2024-12-15 18:32:30 +00:00
Ilya.Kazakevich
6398eecad3 Python: mark old API deprecated
GitOrigin-RevId: c579d6fbd17f0006c1270d3f6536312e4310fcdf
2024-12-02 18:43:50 +00:00
Vladimir Krivosheev
17916c90f8 libraries -> lib, resources, opt-in, test deps
GitOrigin-RevId: db66ee95dcb0f0553b40c9cc56cd6afed8634cdd
2024-11-27 13:53:42 +00:00
Ilya.Kazakevich
e271220bac Python Result: create aliases to simplify migration from kotlin Result
GitOrigin-RevId: 64b9ad7f1d458253c7d43bef74bef9f8fd88f697
2024-11-13 19:24:52 +00:00
Ilya.Kazakevich
842895c01e Python Result: orThrow throws ERR if ERR is exception: no need to wrap it
GitOrigin-RevId: 39cf9b43268be1a02b7bc54fc08bbb37881faabf
2024-11-13 18:03:50 +00:00
Konstantin Nisht
a2982b95da Refactor Python Result to simplify getOr{ return it }
With `Nothing` we can replace `getOr{ return it.convertErr() }` with `getOr{ it }`

GitOrigin-RevId: 5aad2e455f02899b87975366205d7e3bb2b425a0
2024-11-11 23:32:33 +00:00
Ilya.Kazakevich
20bf407b28 Python: Result documented, show cases added
GitOrigin-RevId: 0acfe32c2db90a3e2dbe58e4b087d581d82ea23a
2024-10-24 19:44:26 +00:00
Ilya.Kazakevich
f72d7f04b6 Python: Various Result improvements
We still use it, because Kotlin result only supports `Throwable`

GitOrigin-RevId: b66d4cd8382174829bb8027e8384780a7b2b1198
2024-10-24 14:18:08 +00:00
Ilya Kazakevich
7bd141a993 PyCharm: Rewrite NPW API: See com.jetbrains.python.newProjectWizard
This package (aka PyV3) fixes several issues, including
1. Lots of `DirectoryProjectGenerator` misuses: We now create UI and settings with `ProjectGeneratorPeer`: no more manuals casts in callback
2. Decouples project generation from UI: Settings aren't aware of UI but generate a project instead. Settings are mapped to the UI using Kotlin DSL UI
3. Kotlin DSL UI panel enables validation
4. `PySdkCreator` (an interface implemented by all "v2" SDK panels) now accepts `Module`, so we can provide it Poetry

The whole machinery of `PythonGenerateProjectCallback` (a pack of manual casts only mother could love) is completely deprecated and will be removed soon.

Lots of small changes towards `suspend` functions, Kotlin DSL UI and `Flow` decrease the technical debt.


Merge-request: IJ-MR-144503
Merged-by: Ilya Kazakevich <ilya.kazakevich@jetbrains.com>

GitOrigin-RevId: 21963e843b0ae67c71a6fc5ea1229cb0f57915a9
2024-09-10 19:50:12 +00:00
Ilya.Kazakevich
01228fba20 PyCharm: remove supportsPython3 check as any modern framework support it (all impls return true)
GitOrigin-RevId: 06f939ac73ae864a04ee6bdfd09be1e54b5bda5d
2024-08-01 19:52:34 +00:00
Nikolay Chashnikov
c39556d80e [python] add special access method to PyPackageManager to avoid incorrect usage of protected methods (IJPL-149126)
'getSdk' and 'shouldSubscribeToLocalChanges' were called not from a subclass, so they were actually used via 'package private' visibility. And this will fail with IllegalAccessError if intellij.python.community and intellij.python.community.impl are loaded by different classloaders.

GitOrigin-RevId: 6e2f779063ae9fc188b60b3d52bb5cbe6fe496a9
2024-05-02 08:45:44 +00:00
Ilya.Kazakevich
49fd59c70a PY-64402: Only create main.py if "create welcome script" checkbox set for the Jupyter project.
We used to create `main.py` in any case, but must do that with checkbox.

This code is not elegant due to boilerplate and possible inconsistency (generator might ask for the welcome script and ignore it), but this is the only API for now.

GitOrigin-RevId: 5ecf78f017229aa77d9ec296e46fc8bb742ccc0a
2024-03-21 20:10:55 +00:00
lada.gagina
670e389e15 Revert "[python] Convert underscores to hyphens for python packages (PY-65170)"
This reverts commit a9d3a72e050f8ddc104f706a63d181d81840e94c.

GitOrigin-RevId: d165051645a1e18efabe7ed3a7d1f186fb6d4049
2024-01-29 19:56:59 +00:00
lada.gagina
cfcc685699 [python] Convert underscores to hyphens for python packages (PY-65170)
Python packages use hyphens and underscores in their names. However, when publishing/searching the package on PyPI the underscore gets normalized to hyphen which can lead to inconsistencies between displaying/manipulating packages and requirements.txt files in PyCharm.

GitOrigin-RevId: 3382a6c002b8e593b9e398c182289e740dc3e19f
2024-01-26 01:05:29 +00:00
Aleksei Kniazev
49f0e39af3 [python] deprecate old python packaging classes in favor of PythonPackageManager
GitOrigin-RevId: 8c2bc03c04d95839192b612c2a9053cfdbc3ee00
2023-12-04 13:47:48 +00:00
Andrey Cherkasov
965336c323 The "Incorrect service retrieving" inspection: cleanup
Merge-request: IJ-MR-116714
Merged-by: Andrey Cherkasov <Andrey.Cherkasov@jetbrains.com>

GitOrigin-RevId: b1d06c88028fc2248ab63c8522dc67d7e4fa2e60
2023-10-17 01:21:54 +00:00
Vladimir Koshelev
7dc8c853c5 [python] move some stuff from openapi
GitOrigin-RevId: bc0a26fd9436a26c7e4b2be1cb0210b7179bf3bb
2023-10-10 08:27:58 +00:00
Vladimir Koshelev
967119e85f [python] add fus events for creating python project and adding python interpreter PY-61461
GitOrigin-RevId: daa2356f445485651eb563d8abd18f48a709d124
2023-07-20 13:00:53 +00:00
Nikolay Chashnikov
4899a5a210 cleanup: remove redundant '@author' tags from javadoc comments - 6
Now we have Code Vision hints which determine the author via Git history and show it in the editor automatically, and this information is more accurate than the tags which were automatically added when files were created.

GitOrigin-RevId: 30586ed1915e3b35394ff3ee6251607c64bbabdd
2023-01-18 17:01:44 +00:00
Daniil Ovchinnikov
578eaaf60e rename library kotlin-stdlib-jdk8 -> kotlin-stdlib
GitOrigin-RevId: cddf45ccfd5563d3fe209bea62a1c37c94f44ff9
2023-01-10 12:22:34 +00:00
andrey.matveev
70d6a4eb79 PY-55360 Use sdk instead of sdkHomePath to allow select interpreter in docker compose
(cherry picked from commit 2ae371ce70be9490ddb14b6981366e06a41ddb5d)

IJ-MR-96284

GitOrigin-RevId: 832cadd71e1a0d47852e44854b2ead217342b7e4
2022-11-14 18:55:08 +00:00
Ilya.Kazakevich
2a52439c6a Move `FullPathOnTarget` to the execution module
GitOrigin-RevId: 0bcc9f2085503f6be40bfbb69e4910c4cc76eff8
2022-10-26 22:49:57 +00:00
Ilya.Kazakevich
813cf3e706 PY-56796: Fix conda freeze for DockerCompose
* Coroutines must call ``blockingContext`` when run legacy code with ``invokeAndWait``. Modality state leads to livelock otherwise.
* Coroutines must use ``runInterruptible` when accessing process streams (see ProcessExt.kt)

GitOrigin-RevId: 5aaa357ff329dc95efd072d50fbca7e36ab07563
2022-10-17 23:59:23 +00:00
Alexey Sedunov
c443410d79 Django: Extract Django/Jinja2 commons
GitOrigin-RevId: 3f6bb7b7cd80cbf6007e1930d4d018e1b1cff44a
2022-10-16 11:59:01 +00:00
Ilya.Kazakevich
a4dcfdd16e PY-35978: Improve Conda support and refactor other parts to support it.
Each sdk has additional data with flavor and flavor-specific data. For target-based SDK there is also target information. ``PySdkExt`` has extension method that uses this data to execute code on some SDK. For Conda we store path to conda binary and env name.

GitOrigin-RevId: c63b57aac9b5a267b3a6710902670bfe7d10c722
2022-10-12 17:55:25 +00:00
Nikolay Chashnikov
0c2dd1eefd [python] cleanup: remove unused deprecated API (IDEA-295370)
GitOrigin-RevId: 35b47e4aea678a95d20f19e3cf66db7196fd9c7b
2022-09-16 12:41:46 +00:00
Ilya.Kazakevich
5ca58470f7 PY-54231: Fix "AlreadyDisposedException" and get rid of copy-paste and leak of this.
Each package manager must report explicitly if it needs to be subscribed to local changes or not.

Then, ``PyPackageManagersImpl`` obeys this flag.

Package manager disposed when SDK is disposed.

GitOrigin-RevId: 2cac8411c322c3b499ad6125b764c5c7e9dae8b7
2022-06-11 11:31:33 +00:00