PY-84953: Unify tool detection approach

Our tool detection approach varies a lot. We have different logic for
uv, poetry and other tools. Also, uv detection is not suspendable and
doesn't have any explicit thread requirements, even though it performs
I/O operations.

This change makes such detection unified and suspendable (where
possible) and moves it to BGT.

GitOrigin-RevId: 18e9c4cc085c8d373c82ad2874033b53711f09c6
This commit is contained in:
Alexey Katsman
2025-11-03 16:25:22 +00:00
committed by intellij-monorepo-bot
parent cc191b2b3d
commit 27838bc2da
32 changed files with 217 additions and 168 deletions
@@ -35,7 +35,7 @@ class TestPackageManagerProvider : PythonPackageManagerProvider {
}
override fun createPackageManagerForSdk(project: Project, sdk: Sdk): PythonPackageManager {
override suspend fun createPackageManagerForSdk(project: Project, sdk: Sdk): PythonPackageManager {
return TestPythonPackageManager(project, sdk)
.withPackageNames(packageNames)
.withPackageDetails(packageDetails)
@@ -15,7 +15,7 @@ import org.jetbrains.annotations.TestOnly
@TestOnly
class TestPythonPackageManagerService(val installedPackages: List<PythonPackage> = emptyList()) : PythonPackageManagerService {
override fun forSdk(project: Project, sdk: Sdk): PythonPackageManager {
override suspend fun forSdk(project: Project, sdk: Sdk): PythonPackageManager {
installedPackages.ifEmpty {
return TestPythonPackageManager(project, sdk).also { Disposer.register(project, it) }
}