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

org.jetbrains.kotlinx.jupyter.repl.ReplConfig.kt Maven / Gradle / Ivy

Go to download

Implementation of REPL compiler and preprocessor for Jupyter dialect of Kotlin (IDE-compatible)

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

import org.jetbrains.kotlinx.jupyter.config.defaultRepositoriesCoordinates
import org.jetbrains.kotlinx.jupyter.libraries.LibraryHttpUtil
import org.jetbrains.kotlinx.jupyter.libraries.LibraryResolver
import org.jetbrains.kotlinx.jupyter.libraries.ResolutionInfoProvider
import org.jetbrains.kotlinx.jupyter.libraries.createLibraryHttpUtil
import org.jetbrains.kotlinx.jupyter.libraries.getStandardResolver
import java.io.File

data class ReplConfig(
    val mavenRepositories: List = listOf(),
    val libraryResolver: LibraryResolver? = null,
    val httpUtil: LibraryHttpUtil,
    val resolutionInfoProvider: ResolutionInfoProvider,
    val embedded: Boolean = false,
) {
    companion object {
        fun create(
            resolutionInfoProviderFactory: (LibraryHttpUtil) -> ResolutionInfoProvider,
            httpUtil: LibraryHttpUtil = createLibraryHttpUtil(),
            homeDir: File? = null,
            embedded: Boolean = false,
        ): ReplConfig {
            val resolutionInfoProvider = resolutionInfoProviderFactory(httpUtil)

            return ReplConfig(
                mavenRepositories = defaultRepositoriesCoordinates,
                libraryResolver = getStandardResolver(
                    homeDir?.toString(),
                    resolutionInfoProvider,
                    httpUtil.httpClient,
                    httpUtil.libraryDescriptorsManager,
                ),
                httpUtil = httpUtil,
                resolutionInfoProvider = resolutionInfoProvider,
                embedded = embedded,
            )
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy