Skip to content

[FR] inline magic for automatically resolving libraries from Maven #476

Open
@gaplo917

Description

@gaplo917

Objective

  • Improve developer experience on handling Kotlin dependencies.
  • Kotlin Notebook for general purpose

Existing %use design

I am an experience Kotlin/JVM users and building general purpose Kotlin Notebooks. When I am new to Kotlin Notebook and reading the following inline magic, it is not clear to me about what to resolve in dataframe.

%use dataframe

It is actually controlled by another repository that resolved to org.jetbrains.kotlinx in 0.15.0 version.

{
  "description": "Kotlin framework for structured data processing",
  "properties": [
    { "name": "v", "value": "0.15.0" },
    { "name": "v-renovate-hint", "value": "update: package=org.jetbrains.kotlinx:dataframe" }
  ],
  "link": "https://github.com/Kotlin/dataframe",
  "dependencies": [
    "org.jetbrains.kotlinx:dataframe:$v"
  ],
  "integrationTypeNameRules": [
    "+:org.jetbrains.kotlinx.dataframe.**"
  ]
}

The list in the repository is very limited and not practical for Kotlin Notebook to be used in general purpose. Consequently, if my notebook need to use aws kotlin sdk and dataframe. I have two different ways to import dependencies.

Option 1: Mixed

%use dataframe

USE {
    repositories {
        mavenCentral()
    }
    dependencies {
        implementation("aws.sdk.kotlin:bedrock-jvm:1.4.11")
    }
}

Option 2: Use gradle-like syntax only

USE {
    repositories {
        mavenCentral()
    }
    dependencies {
        implementation("aws.sdk.kotlin:bedrock-jvm:1.4.11")
        implementation("org.jetbrains.kotlinx.dataframe:1.5.0")
    }
}

Using a custom alias in kotlin-jupyter-libraries introduced extra complexities.

  • More work to maintain the kotlin-jupyter-libraries repostiory
  • Handle the alias naming collision when it grows
  • More complexities for new users to kick start in their first step!! (limited library options and need to find another way USE to import)
  • Not align with the existing JVM/multiple-platform dependencies for experience users

Proposed design

Resolve libraries from Maven automatically.

%use org.jetbrains.kotlinx.dataframe aws.sdk.kotlin:bedrock-jvm

# or with version
%use org.jetbrains.kotlinx.dataframe:0.15.0 aws.sdk.kotlin:bedrock-jvm:1.4.11

As the naming pattern must have {groupId}:{artifactId}:{version}, it should be backward-compatible.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions