- Convert PyModuleService (abstract class) to Kotlin interface
- Convert PyModuleServiceImpl to Kotlin with project-level scope
- Change from application-level to project-level service
- Add findPythonSdkWaitingForProjectModel suspend method that awaits
JPS project model loading before resolving the SDK
- Mark old findPythonSdk as @ApiStatus.Obsolete
- Update all call sites to use getInstance(project)
(cherry picked from commit 4dc39a57dbc6063d37522fac8befe01329c10cde)
GitOrigin-RevId: 529405c76d8e2fa503ccc40e15dd0834dd59f469
- Add PyPackageName.normalizeProjectName() per PEP 503 name normalization spec
- Normalize project names in uv, poetry, and hatch project generators
- Fix hatch createNewProject to use NioFiles.copyRecursively instead of broken EEL move
- Add background progress indicators for module structure creation and SDK setup
- Refresh VFS with markDirtyAndRefresh after module structure creation
- Add TraceContext to project generation and packaging tool window coroutines
(cherry picked from commit b64dfb4ae541e4a220698d804aec3fe95103bdf2)
IJ-MR-194426
GitOrigin-RevId: 0a1212d70d8136e1ba8821b736d09e00d78f310e
This MR cherry picks changes done for PY-87723 and PY-87578
Merge-request: IJ-MR-193482
Merged-by: David Lysenko <david.lysenko@jetbrains.com>
GitOrigin-RevId: c74229ed48ae8702667dda201613a2d0c3f25369
- Extract PyVersionSpecifiers from Poetry-specific PoetryPythonVersion
into python-community-openapi for reuse across subsystems
- Add PyVersionSpecifiers parameter to PythonInstallerService.installLatestPython()
so installation respects pyproject.toml version constraints
- Pass version specifiers from getSystemPython() through to the installer
- Move pyproject.toml python-version parsing to pyproject PSI utilities
- Replace PoetryPyProjectTomlPythonVersionsService internals with PyVersionSpecifiers
(cherry picked from commit 5ef8f7cb3430826ee38cd80ab460ea4a52da919a)
IJ-MR-193218
GitOrigin-RevId: a989e2dffd5b3081db526b703f9cc6085eac96d5
The alert for existing venv in SDK creation dialog was missing. This
commit adds it back, also tying it together with the venv path field
validator. In particular, we now support existing venv alert for any
venv typed in the field (including on remotes). Also, it's now possible
to override existing venv.
Also these changes fix broken alert for in-project poetry environment.
(cherry picked from commit 3cf7202ab0a1393c510abb07e2e0d5676cff9a69)
IJ-MR-192485
GitOrigin-RevId: 79b6852ddd6edef14a1c808a1a5bf83e2ac5fc31
This property violates kotlin ideology: properties must be fast, `O(1)`, and thread agnostic.
This one is used all over the system including plugins (unfortunately) and we can't force callers to use BG. So we have to make it thread-agnostic. We sacrifice accuracy in favor of speed. Most people use `.pyenv` as a dir name, and those who do not, will be excluded from the statistics. Note, that this function was never intended to be used for anything but statistics.
`LOG.error` throws exception in tests (but not in prod) so we use it to make sure we do not access IO from this function.
Merge-request: IJ-MR-191539
Merged-by: Ilya Kazakevich <ilya.kazakevich@jetbrains.com>
GitOrigin-RevId: a92a233bcce22d47e522034c04ba2c93d2efb33b
API, which was marked as deprecated in 252 or earlier and has no external and internal usages, is marked for removal.
GitOrigin-RevId: 1b2718d98de6c12266e9224d59e594ffbc986670
When adding new interpreter, we could either specify venv root or python
binary path. Since we cannot check actual files for targets, we check
path regex to determine whether it's a venv root or a binary.
GitOrigin-RevId: d46ef025d9681b4d697d5d9572d0302c9599fdfc
PY-87081 Prefer shortest Python binary name when resolving interpreters in virtual environments.
PY-87281 Support versioned Python binaries (python3, python3.13, pypy3, etc.)
Replace hardcoded Python binary name sets with regex patterns to match
versioned executables like python3.13, python3.11.5, pypy3.10.
Merge-request: IJ-MR-189909
Merged-by: Timur Malanin <timur.malanin@jetbrains.com>
GitOrigin-RevId: f60b1c15b75e63cd96fd21c087b051c38ab095fe
Calling `getEelDescriptor()` is too much ceremony.
Space-RevId: cc7d4b851dd8dbf484fe7f67e44625cdd1dd7772
GitOrigin-RevId: 2aaa72756a77a0cba7ee865eb9afc4ade39b6a27
Use `VirtualEnvReader()` instead of `VirtualEnvReader.Instance` as it is shorter and more idiomatic
Space-RevId: 58448643037948f1e7dc2e84303844b50bd56ee9
GitOrigin-RevId: 35d5b67b8a2d2964ec4b5f611b0f081ac722be2a
1. No need to check if file is directory: FS isn't atomic anyway, and we need to handle exceptions. Let's not do one more useless syscall which might be expensive on eel.
2. Check filename before reading it metadata (one more syscall)
GitOrigin-RevId: 0fac159784c2c1d80c3418eb0d9c60a501662b7d
[python]: PY-85709: Support Python facet for non-PyCharm IDEs.
The following code doesn't work for anything but PyCharm.
```kotlin
ModuleRootManager.getInstance(module).sdk
```
We now call `com.jetbrains.python.module.PyModuleService.findPythonSdk` which supports both Python SDK and Facet.
[python]: PY-85711 : Do not touch non-python modules in `removeFakeModuleEntity` and do not set `inherited` for newly created modules.
1. We should never delete any module which isn't python.
2. No need to look for sdk in workspace as we already do that for all modules by reverting their SDK settings. Moreover, `InheritedSdkDependency` was wrong: it set project-level Java JDK as Python SDK
[python]: PY-85711 : Make `PyActiveSdkModuleConfigurable` filter non-python modules.
See `com.jetbrains.python.configuration.PyActiveSdkModuleConfigurable.isSuitableForModule` comment
[python]: PY-85711 : Move `isPythonModule` to `PyModuleService`.
We are going to reuse it all over the code
[python]: PY-85711 : Refactor `PyModuleService`.
Drop unneeded class
Merge-request: IJ-MR-183088
Merged-by: Ilya Kazakevich <ilya.kazakevich@jetbrains.com>
GitOrigin-RevId: 19f65ba65ea7ea8d8ff8698a64e6a3cbe6803cb0
[python]: `PathShortenerTest`: do not throw an exception for relative paths.
`EelPath` is always absolute, so we used to throw an exception if relative path was provided.
It makes no sense to substitute anything in relative path, so we simply return it as is.
[python]: `SystemPythonService`: remove duplicates.
Merge-request: IJ-MR-183231
Merged-by: Ilya Kazakevich <ilya.kazakevich@jetbrains.com>
GitOrigin-RevId: c391a55fda0f372184279e444e9188f71bceba3e
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>
GitOrigin-RevId: 2950f5f0cd2745c12987a92e40774d366568f312
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: f32238b063575a125642ee91984ed45ba47010ec
Each tool (uv, poetry) now has `common` and `backend` part. `common` has icons because we need them both on the front and on the back.
We might need to create `front` module also if we wouldn't be able to use icons in compose.
GitOrigin-RevId: b5662fbdf3d23f1ddaa5926469d1cfd2051a0fba
153 modules which contain classes used from external plugins from the Marketplace are marked as public. This is needed to ensure that it'll be possible to use that API after converting code from these external plugins to content modules.
GitOrigin-RevId: dc48e8970041fddd3bf50d280711e95ce9e9ad9b
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
* will be used by the Process Tool Window to show the context of the executed command
Merge-request: IJ-MR-176530
Merged-by: Vitaly Legchilkin <Vitaly.Legchilkin@jetbrains.com>
GitOrigin-RevId: 70d41845943b5c19b0647ef4711b16f48c53b28c
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