[python] PY-79486: (WIP) Move tools to separate modules to access them from the frontend.

We are slowly moving all tools to the separate modules to register them as EP. On the front we might have `ToolId` only. To map it to an icon we will use EP.

GitOrigin-RevId: 642f4b8d77a0a14b6b61a5192607fbc7984529c7
This commit is contained in:
Ilya.Kazakevich
2025-10-15 22:13:46 +00:00
committed by intellij-monorepo-bot
parent 2d853ed3ac
commit f1a3b39973
55 changed files with 235 additions and 161 deletions
+1 -1
View File
@@ -32,11 +32,11 @@ jvm_library(
"//python/openapi:community",
"//python/python-exec-service:community-execService",
"//python/python-sdk:sdk",
"//python/python-sdk-ui:sdk-ui",
"//python/python-pyproject:pyproject",
"//libraries/kotlinx/serialization/json",
"//libraries/kotlinx/serialization/core",
"@lib//:io-github-z4kn4fein-semver-jvm-provided",
"//python/python-sdk-ui:sdk-ui",
]
)
### auto-generated section `build intellij.python.hatch` end
@@ -0,0 +1,5 @@
// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
@Internal
package com.intellij.python.hatch.icons;
import static org.jetbrains.annotations.ApiStatus.Internal;
@@ -41,10 +41,10 @@
<orderEntry type="module" module-name="intellij.python.community" />
<orderEntry type="module" module-name="intellij.python.community.execService" />
<orderEntry type="module" module-name="intellij.python.sdk" />
<orderEntry type="module" module-name="intellij.python.sdk.ui" />
<orderEntry type="module" module-name="intellij.python.pyproject" />
<orderEntry type="module" module-name="intellij.libraries.kotlinx.serialization.json" />
<orderEntry type="module" module-name="intellij.libraries.kotlinx.serialization.core" />
<orderEntry type="library" scope="PROVIDED" name="io.github.z4kn4fein.semver.jvm" level="project" />
<orderEntry type="module" module-name="intellij.python.sdk.ui" />
</component>
</module>
@@ -12,4 +12,7 @@
order="after CondaEvoProvider"
implementation="com.intellij.python.hatch.sdk.evolution.HatchSelectSdkProvider"/>
</extensions>
<extensions defaultExtensionNs="com.intellij.python.pyproject.model">
<tool implementation="com.intellij.python.hatch.impl.HatchTool"/>
</extensions>
</idea-plugin>
@@ -0,0 +1,5 @@
// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
@Internal
package com.intellij.python.hatch.cli;
import static org.jetbrains.annotations.ApiStatus.Internal;
@@ -0,0 +1,30 @@
// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.python.hatch.impl
import com.intellij.openapi.util.NlsSafe
import com.intellij.python.hatch.icons.PythonHatchIcons
import com.intellij.python.pyproject.model.spi.ProjectName
import com.intellij.python.pyproject.model.spi.ProjectStructureInfo
import com.intellij.python.pyproject.model.spi.PyProjectTomlProject
import com.intellij.python.pyproject.model.spi.Tool
import com.jetbrains.python.PyToolUIInfo
import com.jetbrains.python.ToolId
import com.jetbrains.python.venvReader.Directory
import org.apache.tuweni.toml.TomlTable
import org.jetbrains.annotations.ApiStatus
@ApiStatus.Internal
val HATCH_TOOL_ID: ToolId = ToolId("hatch")
val HATCH_UI_INFO: PyToolUIInfo = PyToolUIInfo("Hatch", PythonHatchIcons.Logo)
internal class HatchTool : Tool {
override val id: ToolId = HATCH_TOOL_ID
override val ui: PyToolUIInfo = HATCH_UI_INFO
override suspend fun getSrcRoots(toml: TomlTable, projectRoot: Directory): Set<Directory> = emptySet()
override suspend fun getProjectName(projectToml: TomlTable): @NlsSafe String? = null
override suspend fun getProjectStructure(entries: Map<ProjectName, PyProjectTomlProject>, rootIndex: Map<Directory, ProjectName>): ProjectStructureInfo? = null
}
@@ -0,0 +1,5 @@
// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
@Internal
package com.intellij.python.hatch.impl;
import static org.jetbrains.annotations.ApiStatus.Internal;
@@ -0,0 +1,5 @@
// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
@Internal
package com.intellij.python.hatch.runtime;
import static org.jetbrains.annotations.ApiStatus.Internal;
@@ -0,0 +1,5 @@
// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
@Internal
package com.intellij.python.hatch.sdk.evolution;
import static org.jetbrains.annotations.ApiStatus.Internal;
@@ -0,0 +1,5 @@
// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
@Internal
package com.intellij.python.hatch.service;
import static org.jetbrains.annotations.ApiStatus.Internal;