You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
with this I can also run %use example in the kernel, and it will correctly load the file at /home/myusername/.jupyter_kotlin/libraries/example.json, so some other code knows the default homedir anyway.
Possible Fixes
Create resolverConfig with null homeDir
loadResolverConfig has a signature that requires the homeDir to be not null
// Standard resolver doesn't cache results in memory
var res:LibraryResolver=FallbackLibraryResolver
val librariesDir:File?= homeDir?.let { KERNEL_LIBRARIES.homeLibrariesDir(File(it)) }
res =LocalLibraryResolver(res, librariesDir)
res =DefaultInfoLibraryResolver(res, infoProvider, listOf(KERNEL_LIBRARIES.userLibrariesDir))
return res
}
Change the signature of embedKernel to allow passing a homeDir
I don't know what this homeDir value actually achieves, and it might be useful for code using embedKernel to correctly set this. But because a nullhomeDir doesn't raise an issues in my case it should probably be an optional parameter. And then it should IMO still be possible to load library definitions from a full path or from the .jupyter_kotlin/libraries/ directory even if no homeDir is passed.
The text was updated successfully, but these errors were encountered:
All of the examples are on https://github.com/Kotlin/kotlin-jupyter/blob/stable-kotlin-2 but it doesn't look like this changed compared to current
master
Problem
Usually I embed the kernel via
but in the resulting kernel it is not possible to load a library definition, even if explicitly specifying a full path
because in:
kotlin-jupyter/src/main/kotlin/org/jetbrains/kotlinx/jupyter/libraries/LibrariesProcessorImpl.kt
Lines 66 to 67 in e512619
libraries
isnull
, and theReplException
is thrown.this happens because
embedKernel
passesnull
for ahomeDir
,kotlin-jupyter/src/main/kotlin/org/jetbrains/kotlinx/jupyter/ikotlin.kt
Line 96 in e512619
then the
resolverConfig
isn't created:kotlin-jupyter/src/main/kotlin/org/jetbrains/kotlinx/jupyter/config.kt
Line 164 in e512619
and then there are no libraries to pass when the
LibrariesProcessor
is constructed:kotlin-jupyter/src/main/kotlin/org/jetbrains/kotlinx/jupyter/repl.kt
Line 242 in e512619
If I instead use the following code to create the kernel it works, despite the
homeDir
being a completely invalid directory:with this I can also run
%use example
in the kernel, and it will correctly load the file at/home/myusername/.jupyter_kotlin/libraries/example.json
, so some other code knows the default homedir anyway.Possible Fixes
Create
resolverConfig
withnull
homeDirloadResolverConfig
has a signature that requires the homeDir to be not nullkotlin-jupyter/src/main/kotlin/org/jetbrains/kotlinx/jupyter/config.kt
Line 172 in e512619
but the called
getStandardResolver
is fine with ahomeDir
ofnull
again.kotlin-jupyter/src/main/kotlin/org/jetbrains/kotlinx/jupyter/libraries/resolutionUtil.kt
Lines 14 to 21 in e512619
Change the signature of
embedKernel
to allow passing ahomeDir
I don't know what this
homeDir
value actually achieves, and it might be useful for code usingembedKernel
to correctly set this. But because anull
homeDir
doesn't raise an issues in my case it should probably be an optional parameter. And then it should IMO still be possible to load library definitions from a full path or from the.jupyter_kotlin/libraries/
directory even if nohomeDir
is passed.The text was updated successfully, but these errors were encountered: