Closed holgerbrandl closed 2 years ago
Use JupyterSessionInfo.isRunWithKernel()
Beautiful, thanks a lot.
Not sure if this is a regression, but with the latest integration plugin 0.12.0-81 and kotlin 1.9.10 isRunWithKernel()
returns true when called from IDE (without any Jypyter in sight). In debug view it seems the provider
which is used for the detection is present :
I've also tested this with v0.12.0-82-1. It's indeed a regression: JupyterSessionInfo.isRunWithKernel()
returns true
when running in a simple JVM kotlin application.
We can use classes from the main kernel artifact to test if code is running within the jupyter kernel. (e.g. try-catch around
Class.forName("org.jetbrains.kotlinx.jupyter.ReplForJupyter")
)However, to streamline developer experience this could also be exposed as an integration library function.