All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.jetbrains.kotlinx.jupyter.repl.creating.creatingUtil.kt Maven / Gradle / Ivy

There is a newer version: 0.12.0-356
Show newest version
package org.jetbrains.kotlinx.jupyter.repl.creating

import org.jetbrains.kotlinx.jupyter.ReplForJupyter
import org.jetbrains.kotlinx.jupyter.ReplRuntimeProperties
import org.jetbrains.kotlinx.jupyter.defaultRuntimeProperties
import org.jetbrains.kotlinx.jupyter.libraries.EmptyResolutionInfoProvider
import org.jetbrains.kotlinx.jupyter.libraries.LibraryResolver
import org.jetbrains.kotlinx.jupyter.libraries.ResolutionInfoProvider
import org.jetbrains.kotlinx.jupyter.messaging.DisplayHandler
import org.jetbrains.kotlinx.jupyter.messaging.JupyterConnectionInternal
import org.jetbrains.kotlinx.jupyter.messaging.NoOpDisplayHandler
import java.io.File
import kotlin.script.experimental.dependencies.RepositoryCoordinates

fun createRepl(
    resolutionInfoProvider: ResolutionInfoProvider = EmptyResolutionInfoProvider,
    scriptClasspath: List = emptyList(),
    homeDir: File? = null,
    mavenRepositories: List = listOf(),
    libraryResolver: LibraryResolver? = null,
    runtimeProperties: ReplRuntimeProperties = defaultRuntimeProperties,
    scriptReceivers: List = emptyList(),
    isEmbedded: Boolean = false,
    displayHandler: DisplayHandler = NoOpDisplayHandler,
    connection: JupyterConnectionInternal = MockJupyterConnection,
): ReplForJupyter {
    val factory = object : BaseReplFactory() {
        override fun provideResolutionInfoProvider() = resolutionInfoProvider
        override fun provideScriptClasspath() = scriptClasspath
        override fun provideHomeDir() = homeDir
        override fun provideMavenRepositories() = mavenRepositories
        override fun provideLibraryResolver() = libraryResolver
        override fun provideRuntimeProperties() = runtimeProperties
        override fun provideScriptReceivers() = scriptReceivers
        override fun provideIsEmbedded() = isEmbedded
        override fun provideDisplayHandler() = displayHandler
        override fun provideConnection() = connection
    }
    return factory.createRepl()
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy