PY-79486: Introduce sdkConfigurator module.

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
This commit is contained in:
Ilya.Kazakevich
2025-10-02 07:02:49 +02:00
committed by intellij-monorepo-bot
parent ed0c01f602
commit 5a4843d743
33 changed files with 457 additions and 68 deletions

View File

@@ -7,8 +7,10 @@ import com.intellij.openapi.module.Module
import com.intellij.openapi.progress.runBlockingMaybeCancellable
import com.intellij.openapi.projectRoots.Sdk
import com.intellij.util.concurrency.annotations.RequiresBackgroundThread
import com.jetbrains.python.ToolId
import com.jetbrains.python.errorProcessing.PyResult
import org.jetbrains.annotations.ApiStatus
import org.jetbrains.annotations.CheckReturnValue
/**
* Used on directory opening with an attempt to configure suitable Python interpreter
@@ -19,6 +21,10 @@ import org.jetbrains.annotations.ApiStatus
*/
@ApiStatus.Internal
interface PyProjectSdkConfigurationExtension {
/**
* Every tool (poetry, uv) has id
*/
val toolId: ToolId? get() = null
companion object {
@JvmStatic
@@ -37,6 +43,7 @@ interface PyProjectSdkConfigurationExtension {
*
* Rule of thumb is to explicitly ask a user if sdk creation is desired and allowed.
*/
@CheckReturnValue
suspend fun createAndAddSdkForConfigurator(module: Module): PyResult<Sdk?>
/**
@@ -45,6 +52,7 @@ interface PyProjectSdkConfigurationExtension {
*
* You're free here to create sdk immediately, without any user permission since quick fix is explicitly clicked.
*/
@CheckReturnValue
suspend fun createAndAddSdkForInspection(module: Module): PyResult<Sdk?>
/**