Kotlin / kotlin-jupyter

Kotlin kernel for Jupyter/IPython
Apache License 2.0
1.09k stars 106 forks source link

Add Gradle-like API for adding dependencies #382

Closed ileasile closed 1 year ago

ileasile commented 1 year ago

Fix #367

ileasile commented 1 year ago

I'm concerned about names too: it's not clear what gradle means, it sounds like we configure Gradle, not kernel. But I can't come up with a better name for this DSL entry point Maven resolver is used underhood, yes.

altavir commented 1 year ago

I'm concerned about names too: it's not clear what gradle means, it sounds like we configure Gradle, not kernel. But I can't come up with a better name for this DSL entry point Maven resolver is used underhood, yes.

maybe something like requires? It does not matter how it is called since you copy only what is inside.

ileasile commented 1 year ago
  1. gradle - clear what you should write inside but doesn't explain the purpose
  2. gradleLike[Conf] - better, but verbose
  3. requires - good borrowing from JS modules, but there is require in Kotlin, and may be misleading
  4. config, configure, provide - not bad, but too generic
  5. build - looks like a compromise variant
  6. dependencyResolutionManagement - name of block in settings.gradle[.kts] that is actually responsible for dependency management

Let's choose something please

altavir commented 1 year ago

@ileasile I think it is better to discuss in slack. Maybe a vote.

I do not think that the outer scope should match how it looks in Gradle because people do not copy the whole block, they copy its contents. Also dependencyResolutionManagement is not used in project config, only in settings.

What about dependsOn{ }?

ileasile commented 1 year ago

Final version of API:

USE {
    repositories {
        mavenCentral()
    }
    dependencies {
        implementation("io.github.config4k:config4k:0.4.2")
    }
}

Or in integration:

internal class Integration : JupyterIntegration() {

    override fun Builder.onLoaded() {
        repositories {
        mavenCentral()
    }
    dependencies {
        implementation("io.github.config4k:config4k:0.4.2")
    }
    }
}