[pycharm] PY-79132 Address feedback

GitOrigin-RevId: 03e4786ad9e32de518a11b2cad6a8b653e2cc1f8
This commit is contained in:
David Lysenko
2025-08-06 17:18:54 +02:00
committed by intellij-monorepo-bot
parent 04d67a09a7
commit 14f1f6bfe4
4 changed files with 10 additions and 8 deletions

View File

@@ -423,7 +423,7 @@ python.sdk.uv.associated.project=Associated project:
python.sdk.uv.environment.panel.title=uv environment
python.sdk.uv.executable.not.found=uv executable is not found
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.creating.python.module.structure=Creating Python Module Structure

View File

@@ -9,6 +9,7 @@ import com.intellij.openapi.project.Project
import com.intellij.openapi.projectRoots.Sdk
import com.intellij.openapi.ui.ComboBox
import com.intellij.openapi.ui.validation.DialogValidationRequestor
import com.intellij.python.pyproject.PY_PROJECT_TOML
import com.intellij.python.pyproject.PyProjectToml
import com.intellij.ui.dsl.builder.AlignX
import com.intellij.ui.dsl.builder.Panel
@@ -75,7 +76,7 @@ internal class EnvironmentCreatorUv(
row(message("sdk.create.python.version")) {
pythonVersion = propertyGraph.property(null)
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)
.enabledIf(loading.not())
@@ -131,7 +132,7 @@ internal class EnvironmentCreatorUv(
try {
loading.set(true)
val pyProjectTomlPath = projectPath.resolve("pyproject.toml")
val pyProjectTomlPath = projectPath.resolve(PY_PROJECT_TOML)
val pythonVersions = withContext(Dispatchers.IO) {
val versionRequest = if (pyProjectTomlPath.exists()) {
@@ -144,8 +145,6 @@ internal class EnvironmentCreatorUv(
val uvLowLevel = createUvLowLevel(Path.of(""), cli)
uvLowLevel.listSupportedPythonVersions(versionRequest)
.getOr { return@withContext emptyList() }
.toList()
.sortedDescending()
}
pythonVersions.forEach {

View File

@@ -21,7 +21,7 @@ interface UvLowLevel {
suspend fun initializeEnvironment(init: Boolean, version: Version?): PyResult<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

View File

@@ -91,7 +91,7 @@ private class UvLowLevelImpl(val cwd: Path, private val uvCli: UvCli) : UvLowLev
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")
if (versionRequest != null) {
@@ -107,7 +107,10 @@ private class UvLowLevelImpl(val cwd: Path, private val uvCli: UvCli) : UvLowLev
it.groupValues[1],
strict = false
)
}.toSet()
}
.toSet()
.toList()
.sortedDescending()
)
}