Gradle plugin · Kotlin Multiplatform · Python

Gradle 플러그인 · Kotlin Multiplatform · Python

Declare the Python half of your app in Gradle.앱의 Python 절반을 Gradle 에 선언하세요.

toolchain turns one python { } block into installed dependencies, a bundle per target, and a payload inside your jar and APK: by delegating the work, not redoing it.

toolchain 은 python { } 블록 하나를 설치된 의존성, 타깃별 번들, 그리고 jar 와 APK 안의 페이로드로 바꿉니다. 작업을 다시 만들지 않고 위임해서요.

python { }you declare선언한다toolchaintranslates번역한다pypackpackuv · bundleruv · 번들러pythonStagingper platform플랫폼별your app내 앱jar · APK · iOSjar · APK · iOSruntime런타임python-multiplatformpython-multiplatformbuild time: this repository + pypackpack빌드 시점: 이 저장소 + pypackpackrun time실행 시점one python { } block → an app that carries its Pythonpython { } 블록 하나 → Python 을 품은 앱
toolchain owns the Gradle vocabulary. pypackpack owns the work. python-multiplatform owns the runtime.toolchain 은 Gradle 어휘를, pypackpack 은 작업을, python-multiplatform 은 런타임을 맡습니다.

Three ideas the plugin is built on이 플러그인이 지키는 세 가지

01

One vocabulary하나의 어휘

A python { } block reads like the android { } and kotlin { } blocks beside it: compileSdk, buildTypes, sourceSets, dependencies. No second build system to learn.

python { } 블록은 옆의 android { }, kotlin { } 블록처럼 읽힙니다. compileSdk, buildTypes, sourceSets, dependencies. 배울 두 번째 빌드 시스템이 없습니다.

02

Delegate the work작업은 위임한다

Installing a package is a real uv add through pypackpack. Bundling is pypackpack's resource bundler. The plugin translates Gradle into those calls and nothing more.

패키지 설치는 pypackpack 을 거친 실제 uv add 이고, 번들링은 pypackpack 의 리소스 번들러입니다. 플러그인은 Gradle 을 그 호출로 번역할 뿐입니다.

03

Loud, never silent조용히 넘기지 않는다

Every DSL value is either read by a task or rejected with a reason. An unmapped platform or an unsupported compile level fails: and only the variant that asked for it.

모든 DSL 값은 태스크가 읽거나, 이유와 함께 거부됩니다. 매핑되지 않는 플랫폼이나 지원되지 않는 컴파일 레벨은 실패합니다: 그것을 요청한 변형만.

Where it is going가고 있는 곳

This is the shape of the DSL the maintainer wrote by hand: the target the plugin grows toward. Part of it is live today; the status page says exactly which part.

아래는 메인테이너가 직접 쓴 DSL 의 모습, 즉 플러그인이 향하는 목표입니다. 일부는 지금 동작하고, 정확히 어느 부분인지는 상태 페이지에 있습니다.

python {
    compileSdk = "3.11.9-alpha"

    android("android") { androidSdk = 24 }
    ios { iosSdk = 14 }
    desktop()

    packaging {
        embedLevel = 2
        fileName = "myapp"
        hotReload { serverHost = "https://localhost:8080" }
    }

    buildTypes {
        getByName("debug")   { compileLevel = "bytecode"; enableHotReload = true }
        getByName("release") { compileLevel = "native";   enableCodePush = true }
    }

    sourceSets {
        val commonMain by getting {
            srcDirs("src/commonMain/python")
            dependencies { implementation("pyzmq") }
        }
        val androidMain by getting {
            dependencies { integration("pycomposeui") }
        }
    }
}