Description
We should provide a function to get DataFrame from NotebookHttpResponse
I tried to add a compileOnly dependency on ktor-client, declared a function in dataframe-jupyter module. Due to classloading conflicts its work is unstable.
If you execute cell with %use dataframe
first, then %use ktor-client
, there's this exception:
Line_12.jupyter.kts (1:15 - 18) Cannot access class 'org.jetbrains.kotlinx.jupyter.ktor.client.core.NotebookHttpResponse'. Check your module classpath for missing or conflicting dependencies
It happens because NotebookHttpResponse.bodyAsDataFrame
is loaded with classloader that doesn't know anything about NotebookHttpResponse.
So instead of declaring this function in a library, we can combine afterCellExecution + executeCode to declare it when dataframe is added and ktor-client is already on the classpath or when ktor-client is added to the classpath. This way the function will be executed in a cell with both ktor-client and dataframe classloaders available