org.jetbrains.kotlinx.jupyter.api.CodePreprocessor.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of kotlin-jupyter-api Show documentation
Show all versions of kotlin-jupyter-api Show documentation
API for libraries supporting Kotlin Jupyter notebooks
package org.jetbrains.kotlinx.jupyter.api
import org.jetbrains.kotlinx.jupyter.api.libraries.LibraryDefinitionProducer
/**
* Preprocesses the cell code before its execution
*/
interface CodePreprocessor {
/**
* Returns `true` if this preprocessor accepts the given [code]
*/
fun accepts(code: String): Boolean = true
/**
* Performs code preprocessing
*/
fun process(
code: String,
host: KotlinKernelHost,
): Result
data class Result(val code: Code, val libraries: List = emptyList())
}