-
Notifications
You must be signed in to change notification settings - Fork 70
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #769 from Kotlin/jupyter-integration-module
Move Jupyter integration from :core to a new module
- Loading branch information
Showing
22 changed files
with
136 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
core/src/main/kotlin/org/jetbrains/kotlinx/dataframe/codeGen/CodeWithConverter.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
plugins { | ||
alias(libs.plugins.kotlin.jvm) | ||
alias(libs.plugins.publisher) | ||
alias(libs.plugins.jupyter.api) | ||
} | ||
|
||
group = "org.jetbrains.kotlinx" | ||
|
||
repositories { | ||
mavenCentral() | ||
} | ||
|
||
dependencies { | ||
compileOnly(project(":core")) | ||
testImplementation(libs.junit) | ||
testImplementation(libs.serialization.json) | ||
testImplementation(project(":core")) | ||
testImplementation(libs.kotestAssertions) { | ||
exclude("org.jetbrains.kotlin", "kotlin-stdlib-jdk8") | ||
} | ||
} | ||
|
||
kotlin { | ||
explicitApi() | ||
} | ||
|
||
tasks.compileKotlin { | ||
kotlinOptions { | ||
freeCompilerArgs += listOf("-Xfriend-paths=${project(":core").projectDir}") | ||
jvmTarget = "11" | ||
} | ||
} | ||
|
||
tasks.compileTestKotlin { | ||
kotlinOptions { | ||
val friendModule = project(":core") | ||
val jarTask = friendModule.tasks.getByName("jar") as Jar | ||
val jarPath = jarTask.archiveFile.get().asFile.absolutePath | ||
freeCompilerArgs += "-Xfriend-paths=$jarPath" | ||
jvmTarget = "11" | ||
} | ||
} | ||
|
||
tasks.withType<JavaCompile> { | ||
sourceCompatibility = JavaVersion.VERSION_11.toString() | ||
targetCompatibility = JavaVersion.VERSION_11.toString() | ||
} | ||
|
||
tasks.processJupyterApiResources { | ||
libraryProducers = listOf("org.jetbrains.kotlinx.dataframe.jupyter.Integration") | ||
} | ||
|
||
kotlinPublications { | ||
publication { | ||
publicationName.set("dataframe-jupyter") | ||
artifactId.set("dataframe-jupyter") | ||
description.set("Kotlin DataFrame integration with Kotlin Jupyter") | ||
packageName.set("dataframe-jupyter") | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
...me-jupyter/src/main/kotlin/org/jetbrains/kotlinx/dataframe/jupyter/JupyterCellRenderer.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
@file:Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER") | ||
|
||
package org.jetbrains.kotlinx.dataframe.jupyter | ||
|
||
import org.jetbrains.kotlinx.dataframe.io.DisplayConfiguration | ||
import org.jetbrains.kotlinx.dataframe.io.internallyRenderable | ||
import org.jetbrains.kotlinx.dataframe.io.renderValueForHtml | ||
import org.jetbrains.kotlinx.jupyter.api.MimeTypedResult | ||
import org.jetbrains.kotlinx.jupyter.api.Notebook | ||
import org.jetbrains.kotlinx.jupyter.api.Renderable | ||
import org.jetbrains.kotlinx.jupyter.api.libraries.ExecutionHost | ||
|
||
internal class JupyterCellRenderer( | ||
private val notebook: Notebook, | ||
private val host: ExecutionHost, | ||
) : ChainedCellRenderer(DefaultCellRenderer) { | ||
override fun maybeContent(value: Any?, configuration: DisplayConfiguration): RenderedContent? { | ||
val renderersProcessor = notebook.renderersProcessor | ||
if (internallyRenderable(value)) return null | ||
val renderedVal = renderersProcessor.renderValue(host, value) | ||
val finalVal = if (renderedVal is Renderable) renderedVal.render(notebook) else renderedVal | ||
if (finalVal is MimeTypedResult && "text/html" in finalVal) return RenderedContent.media( | ||
finalVal["text/html"] ?: "" | ||
) | ||
return renderValueForHtml(finalVal, configuration.cellContentLimit, configuration.decimalFormat) | ||
} | ||
|
||
override fun maybeTooltip(value: Any?, configuration: DisplayConfiguration): String? { | ||
return null | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 2 additions & 0 deletions
2
...tlinx/dataframe/jupyter/RenderingTests.kt → ...tlinx/dataframe/jupyter/RenderingTests.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -41,3 +41,4 @@ plugins { | |
} | ||
include("dataframe-excel") | ||
include("core") | ||
include("dataframe-jupyter") |