mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-16 14:23:28 +07:00
[pycharm] PY-79132 Address feedback
GitOrigin-RevId: 03e4786ad9e32de518a11b2cad6a8b653e2cc1f8
This commit is contained in:
committed by
intellij-monorepo-bot
parent
04d67a09a7
commit
14f1f6bfe4
@@ -423,7 +423,7 @@ python.sdk.uv.associated.project=Associated project:
|
|||||||
python.sdk.uv.environment.panel.title=uv environment
|
python.sdk.uv.environment.panel.title=uv environment
|
||||||
python.sdk.uv.executable.not.found=uv executable is not found
|
python.sdk.uv.executable.not.found=uv executable is not found
|
||||||
python.sdk.uv.executable=uv executable:
|
python.sdk.uv.executable=uv executable:
|
||||||
python.sdk.uv.install.packages.from.toml.checkbox.text=Install packages from pyproject.toml
|
python.sdk.uv.default.version=Default
|
||||||
|
|
||||||
python.sdk.local=Local
|
python.sdk.local=Local
|
||||||
python.sdk.creating.python.module.structure=Creating Python Module Structure
|
python.sdk.creating.python.module.structure=Creating Python Module Structure
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import com.intellij.openapi.project.Project
|
|||||||
import com.intellij.openapi.projectRoots.Sdk
|
import com.intellij.openapi.projectRoots.Sdk
|
||||||
import com.intellij.openapi.ui.ComboBox
|
import com.intellij.openapi.ui.ComboBox
|
||||||
import com.intellij.openapi.ui.validation.DialogValidationRequestor
|
import com.intellij.openapi.ui.validation.DialogValidationRequestor
|
||||||
|
import com.intellij.python.pyproject.PY_PROJECT_TOML
|
||||||
import com.intellij.python.pyproject.PyProjectToml
|
import com.intellij.python.pyproject.PyProjectToml
|
||||||
import com.intellij.ui.dsl.builder.AlignX
|
import com.intellij.ui.dsl.builder.AlignX
|
||||||
import com.intellij.ui.dsl.builder.Panel
|
import com.intellij.ui.dsl.builder.Panel
|
||||||
@@ -75,7 +76,7 @@ internal class EnvironmentCreatorUv(
|
|||||||
row(message("sdk.create.python.version")) {
|
row(message("sdk.create.python.version")) {
|
||||||
pythonVersion = propertyGraph.property(null)
|
pythonVersion = propertyGraph.property(null)
|
||||||
versionComboBox = comboBox(listOf<Version?>(null), textListCellRenderer {
|
versionComboBox = comboBox(listOf<Version?>(null), textListCellRenderer {
|
||||||
it?.let { "${it.major}.${it.minor}" } ?: "Default"
|
it?.let { "${it.major}.${it.minor}" } ?: message("python.sdk.uv.default.version")
|
||||||
})
|
})
|
||||||
.bindItem(pythonVersion)
|
.bindItem(pythonVersion)
|
||||||
.enabledIf(loading.not())
|
.enabledIf(loading.not())
|
||||||
@@ -131,7 +132,7 @@ internal class EnvironmentCreatorUv(
|
|||||||
try {
|
try {
|
||||||
loading.set(true)
|
loading.set(true)
|
||||||
|
|
||||||
val pyProjectTomlPath = projectPath.resolve("pyproject.toml")
|
val pyProjectTomlPath = projectPath.resolve(PY_PROJECT_TOML)
|
||||||
|
|
||||||
val pythonVersions = withContext(Dispatchers.IO) {
|
val pythonVersions = withContext(Dispatchers.IO) {
|
||||||
val versionRequest = if (pyProjectTomlPath.exists()) {
|
val versionRequest = if (pyProjectTomlPath.exists()) {
|
||||||
@@ -144,8 +145,6 @@ internal class EnvironmentCreatorUv(
|
|||||||
val uvLowLevel = createUvLowLevel(Path.of(""), cli)
|
val uvLowLevel = createUvLowLevel(Path.of(""), cli)
|
||||||
uvLowLevel.listSupportedPythonVersions(versionRequest)
|
uvLowLevel.listSupportedPythonVersions(versionRequest)
|
||||||
.getOr { return@withContext emptyList() }
|
.getOr { return@withContext emptyList() }
|
||||||
.toList()
|
|
||||||
.sortedDescending()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pythonVersions.forEach {
|
pythonVersions.forEach {
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ interface UvLowLevel {
|
|||||||
suspend fun initializeEnvironment(init: Boolean, version: Version?): PyResult<Path>
|
suspend fun initializeEnvironment(init: Boolean, version: Version?): PyResult<Path>
|
||||||
|
|
||||||
suspend fun listUvPythons(): PyResult<Set<Path>>
|
suspend fun listUvPythons(): PyResult<Set<Path>>
|
||||||
suspend fun listSupportedPythonVersions(versionRequest: String? = null): PyResult<Set<Version>>
|
suspend fun listSupportedPythonVersions(versionRequest: String? = null): PyResult<List<Version>>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Manage project dependencies by adding/removing them to the project along side installation
|
* Manage project dependencies by adding/removing them to the project along side installation
|
||||||
|
|||||||
@@ -91,7 +91,7 @@ private class UvLowLevelImpl(val cwd: Path, private val uvCli: UvCli) : UvLowLev
|
|||||||
return PyResult.success(pythons)
|
return PyResult.success(pythons)
|
||||||
}
|
}
|
||||||
|
|
||||||
override suspend fun listSupportedPythonVersions(versionRequest: String?): PyResult<Set<Version>> {
|
override suspend fun listSupportedPythonVersions(versionRequest: String?): PyResult<List<Version>> {
|
||||||
val args = mutableListOf("python", "list")
|
val args = mutableListOf("python", "list")
|
||||||
|
|
||||||
if (versionRequest != null) {
|
if (versionRequest != null) {
|
||||||
@@ -107,7 +107,10 @@ private class UvLowLevelImpl(val cwd: Path, private val uvCli: UvCli) : UvLowLev
|
|||||||
it.groupValues[1],
|
it.groupValues[1],
|
||||||
strict = false
|
strict = false
|
||||||
)
|
)
|
||||||
}.toSet()
|
}
|
||||||
|
.toSet()
|
||||||
|
.toList()
|
||||||
|
.sortedDescending()
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user