Skip to content

Instantly share code, notes, and snippets.

@cmelchior
Created February 18, 2026 11:56
Show Gist options
  • Select an option

  • Save cmelchior/70a5bd865935da11198e263e1d279bdb to your computer and use it in GitHub Desktop.

Select an option

Save cmelchior/70a5bd865935da11198e263e1d279bdb to your computer and use it in GitHub Desktop.
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"cell_type": "code",
"metadata": {
"collapsed": true,
"ExecuteTime": {
"end_time": "2026-02-18T11:51:08.551208Z",
"start_time": "2026-02-18T11:51:08.521103Z"
}
},
"source": [
"// Include Compose support\n",
"// The compose compiler plugin used must be provided by IntelliJ, similar to Serialization, DataFrames and others.\n",
"// This should also ensure that we get the correct platform API's.\n",
"%use compose"
],
"id": "adfd4294e6ed8d31",
"outputs": [
{
"ename": "org.jetbrains.kotlinx.jupyter.exceptions.ReplPreprocessingException",
"evalue": "Failed to process '%use compose' command. Unknown library 'compose@default'",
"output_type": "error",
"traceback": [
"org.jetbrains.kotlinx.jupyter.exceptions.ReplPreprocessingException: Failed to process '%use compose' command. Unknown library 'compose@default'",
"\tat org.jetbrains.kotlinx.jupyter.magics.BasicMagicsHandler.handle(BasicMagicsHandler.kt:82)",
"\tat org.jetbrains.kotlinx.jupyter.magics.CompositeMagicsHandler.handle(CompositeMagicsHandler.kt:40)",
"\tat org.jetbrains.kotlinx.jupyter.magics.AbstractMagicsProcessor$Companion.processSingleMagic(AbstractMagicsProcessor.kt:69)",
"\tat org.jetbrains.kotlinx.jupyter.magics.MagicsProcessor.processMagics(MagicsProcessor.kt:28)",
"\tat org.jetbrains.kotlinx.jupyter.magics.MagicsProcessor.processMagics$default(MagicsProcessor.kt:20)",
"\tat org.jetbrains.kotlinx.jupyter.magics.MagicsProcessor.process(MagicsProcessor.kt:36)",
"\tat org.jetbrains.kotlinx.jupyter.magics.CompoundCodePreprocessor.process$iteration(CompoundCodePreprocessor.kt:35)",
"\tat org.jetbrains.kotlinx.jupyter.magics.CompoundCodePreprocessor.process(CompoundCodePreprocessor.kt:42)",
"\tat org.jetbrains.kotlinx.jupyter.repl.impl.CellExecutorImpl.execute-W38Nk0s(CellExecutorImpl.kt:73)",
"\tat org.jetbrains.kotlinx.jupyter.repl.execution.CellExecutor.execute-W38Nk0s$default(CellExecutor.kt:14)",
"\tat org.jetbrains.kotlinx.jupyter.repl.impl.ReplForJupyterImpl.evaluateUserCode-wNURfNM(ReplForJupyterImpl.kt:590)",
"\tat org.jetbrains.kotlinx.jupyter.repl.impl.ReplForJupyterImpl.evalExImpl(ReplForJupyterImpl.kt:471)",
"\tat org.jetbrains.kotlinx.jupyter.repl.impl.ReplForJupyterImpl.evalEx$lambda$0(ReplForJupyterImpl.kt:465)",
"\tat org.jetbrains.kotlinx.jupyter.repl.impl.ReplForJupyterImpl.withEvalContext(ReplForJupyterImpl.kt:447)",
"\tat org.jetbrains.kotlinx.jupyter.repl.impl.ReplForJupyterImpl.evalEx(ReplForJupyterImpl.kt:464)",
"\tat org.jetbrains.kotlinx.jupyter.messaging.IdeCompatibleMessageRequestProcessor.processExecuteRequest$lambda$0$0$0(IdeCompatibleMessageRequestProcessor.kt:179)",
"\tat org.jetbrains.kotlinx.jupyter.streams.BlockingSubstitutionEngine.withDataSubstitution(SubstitutionEngine.kt:124)",
"\tat org.jetbrains.kotlinx.jupyter.streams.StreamSubstitutionManager.withSubstitutedStreams(StreamSubstitutionManager.kt:118)",
"\tat org.jetbrains.kotlinx.jupyter.messaging.IdeCompatibleMessageRequestProcessor.withForkedIn(IdeCompatibleMessageRequestProcessor.kt:373)",
"\tat org.jetbrains.kotlinx.jupyter.messaging.IdeCompatibleMessageRequestProcessor.evalWithIO$lambda$0$0(IdeCompatibleMessageRequestProcessor.kt:386)",
"\tat org.jetbrains.kotlinx.jupyter.streams.BlockingSubstitutionEngine.withDataSubstitution(SubstitutionEngine.kt:124)",
"\tat org.jetbrains.kotlinx.jupyter.streams.StreamSubstitutionManager.withSubstitutedStreams(StreamSubstitutionManager.kt:118)",
"\tat org.jetbrains.kotlinx.jupyter.messaging.IdeCompatibleMessageRequestProcessor.withForkedErr(IdeCompatibleMessageRequestProcessor.kt:363)",
"\tat org.jetbrains.kotlinx.jupyter.messaging.IdeCompatibleMessageRequestProcessor.evalWithIO$lambda$0(IdeCompatibleMessageRequestProcessor.kt:385)",
"\tat org.jetbrains.kotlinx.jupyter.streams.BlockingSubstitutionEngine.withDataSubstitution(SubstitutionEngine.kt:124)",
"\tat org.jetbrains.kotlinx.jupyter.streams.StreamSubstitutionManager.withSubstitutedStreams(StreamSubstitutionManager.kt:118)",
"\tat org.jetbrains.kotlinx.jupyter.messaging.IdeCompatibleMessageRequestProcessor.withForkedOut(IdeCompatibleMessageRequestProcessor.kt:356)",
"\tat org.jetbrains.kotlinx.jupyter.messaging.IdeCompatibleMessageRequestProcessor.evalWithIO(IdeCompatibleMessageRequestProcessor.kt:384)",
"\tat org.jetbrains.kotlinx.jupyter.messaging.IdeCompatibleMessageRequestProcessor.processExecuteRequest$lambda$0$0(IdeCompatibleMessageRequestProcessor.kt:178)",
"\tat org.jetbrains.kotlinx.jupyter.execution.JupyterExecutorImpl$Task.execute(JupyterExecutorImpl.kt:41)",
"\tat org.jetbrains.kotlinx.jupyter.execution.JupyterExecutorImpl.executorThread$lambda$0(JupyterExecutorImpl.kt:81)",
"\tat kotlin.concurrent.ThreadsKt$thread$thread$1.run(Thread.kt:30)",
"Caused by: org.jetbrains.kotlinx.jupyter.api.exceptions.ReplException: Unknown library 'compose@default'",
"\tat org.jetbrains.kotlinx.jupyter.libraries.LibrariesProcessorImpl.processNewLibraries(LibrariesProcessorImpl.kt:50)",
"\tat org.jetbrains.kotlinx.jupyter.magics.LibrariesMagicsHandler.handleUse(LibrariesMagicsHandler.kt:32)",
"\tat org.jetbrains.kotlinx.jupyter.magics.LibrariesMagicsHandler.access$handleUse(LibrariesMagicsHandler.kt:15)",
"\tat org.jetbrains.kotlinx.jupyter.magics.LibrariesMagicsHandler$callbackMap$1.invoke(LibrariesMagicsHandler.kt:22)",
"\tat org.jetbrains.kotlinx.jupyter.magics.LibrariesMagicsHandler$callbackMap$1.invoke(LibrariesMagicsHandler.kt:22)",
"\tat org.jetbrains.kotlinx.jupyter.magics.BasicMagicsHandler.handle(BasicMagicsHandler.kt:93)",
"\tat org.jetbrains.kotlinx.jupyter.magics.BasicMagicsHandler.handle(BasicMagicsHandler.kt:76)",
"\t... 31 more",
""
]
}
],
"execution_count": 1
},
{
"metadata": {},
"cell_type": "code",
"outputs": [],
"execution_count": null,
"source": [
"// Example 1: Define Composable functions and show them inline in the notebook\n",
"@Composable\n",
"fun simpleButton() {\n",
" Button(onClick = {}) {\n",
" Text(\"Hello Compose!\")\n",
" }\n",
"}\n",
"\n",
"// COMPOSE returns a `ComposePanel`\n",
"// It will be rendered as Cell output.\n",
"COMPOSE {\n",
" simpleButton()\n",
"}"
],
"id": "4612bac328609f87"
},
{
"metadata": {
"ExecuteTime": {
"end_time": "2026-02-18T11:51:54.753248Z",
"start_time": "2026-02-18T11:51:54.696196Z"
},
"executionRelatedData": {
"compiledClasses": [
"Line_3_jupyter"
]
}
},
"cell_type": "code",
"source": [
"// Example 2: Call a Composable function from dependencies\n",
"import com.example.compose.composableFunctionFromDependencies\n",
"\n",
"COMPOSE {\n",
" composableFunctionFromDependencies()\n",
"}"
],
"id": "fc72798f17db68ba",
"outputs": [],
"execution_count": 2
},
{
"metadata": {
"ExecuteTime": {
"end_time": "2026-02-18T11:52:35.289490Z",
"start_time": "2026-02-18T11:52:35.253362Z"
}
},
"cell_type": "code",
"source": "",
"id": "438e81928402ac90",
"outputs": [
{
"ename": "org.jetbrains.kotlinx.jupyter.exceptions.ReplCompilerException",
"evalue": "at Cell In[4], line 1, column 12: Unresolved reference 'example'.\nat Cell In[4], line 3, column 1: Unresolved reference 'COMPOSE'.\nat Cell In[4], line 4, column 5: Unresolved reference 'composableFunctionFromDependencies'.",
"output_type": "error",
"traceback": [
"org.jetbrains.kotlinx.jupyter.exceptions.ReplCompilerException: at Cell In[4], line 1, column 12: Unresolved reference 'example'.",
"at Cell In[4], line 3, column 1: Unresolved reference 'COMPOSE'.",
"at Cell In[4], line 4, column 5: Unresolved reference 'composableFunctionFromDependencies'.",
"\tat org.jetbrains.kotlinx.jupyter.repl.impl.JupyterCompilerImpl.compileSync(JupyterCompilerImpl.kt:157)",
"\tat org.jetbrains.kotlinx.jupyter.repl.impl.InternalEvaluatorImpl.eval(InternalEvaluatorImpl.kt:127)",
"\tat org.jetbrains.kotlinx.jupyter.repl.impl.CellExecutorImpl.execute_W38Nk0s$lambda$0$1(CellExecutorImpl.kt:95)",
"\tat org.jetbrains.kotlinx.jupyter.repl.impl.ReplForJupyterImpl.withHost(ReplForJupyterImpl.kt:733)",
"\tat org.jetbrains.kotlinx.jupyter.repl.impl.CellExecutorImpl.execute-W38Nk0s(CellExecutorImpl.kt:93)",
"\tat org.jetbrains.kotlinx.jupyter.repl.execution.CellExecutor.execute-W38Nk0s$default(CellExecutor.kt:14)",
"\tat org.jetbrains.kotlinx.jupyter.repl.impl.ReplForJupyterImpl.evaluateUserCode-wNURfNM(ReplForJupyterImpl.kt:590)",
"\tat org.jetbrains.kotlinx.jupyter.repl.impl.ReplForJupyterImpl.evalExImpl(ReplForJupyterImpl.kt:471)",
"\tat org.jetbrains.kotlinx.jupyter.repl.impl.ReplForJupyterImpl.evalEx$lambda$0(ReplForJupyterImpl.kt:465)",
"\tat org.jetbrains.kotlinx.jupyter.repl.impl.ReplForJupyterImpl.withEvalContext(ReplForJupyterImpl.kt:447)",
"\tat org.jetbrains.kotlinx.jupyter.repl.impl.ReplForJupyterImpl.evalEx(ReplForJupyterImpl.kt:464)",
"\tat org.jetbrains.kotlinx.jupyter.messaging.IdeCompatibleMessageRequestProcessor.processExecuteRequest$lambda$0$0$0(IdeCompatibleMessageRequestProcessor.kt:179)",
"\tat org.jetbrains.kotlinx.jupyter.streams.BlockingSubstitutionEngine.withDataSubstitution(SubstitutionEngine.kt:124)",
"\tat org.jetbrains.kotlinx.jupyter.streams.StreamSubstitutionManager.withSubstitutedStreams(StreamSubstitutionManager.kt:118)",
"\tat org.jetbrains.kotlinx.jupyter.messaging.IdeCompatibleMessageRequestProcessor.withForkedIn(IdeCompatibleMessageRequestProcessor.kt:373)",
"\tat org.jetbrains.kotlinx.jupyter.messaging.IdeCompatibleMessageRequestProcessor.evalWithIO$lambda$0$0(IdeCompatibleMessageRequestProcessor.kt:386)",
"\tat org.jetbrains.kotlinx.jupyter.streams.BlockingSubstitutionEngine.withDataSubstitution(SubstitutionEngine.kt:124)",
"\tat org.jetbrains.kotlinx.jupyter.streams.StreamSubstitutionManager.withSubstitutedStreams(StreamSubstitutionManager.kt:118)",
"\tat org.jetbrains.kotlinx.jupyter.messaging.IdeCompatibleMessageRequestProcessor.withForkedErr(IdeCompatibleMessageRequestProcessor.kt:363)",
"\tat org.jetbrains.kotlinx.jupyter.messaging.IdeCompatibleMessageRequestProcessor.evalWithIO$lambda$0(IdeCompatibleMessageRequestProcessor.kt:385)",
"\tat org.jetbrains.kotlinx.jupyter.streams.BlockingSubstitutionEngine.withDataSubstitution(SubstitutionEngine.kt:124)",
"\tat org.jetbrains.kotlinx.jupyter.streams.StreamSubstitutionManager.withSubstitutedStreams(StreamSubstitutionManager.kt:118)",
"\tat org.jetbrains.kotlinx.jupyter.messaging.IdeCompatibleMessageRequestProcessor.withForkedOut(IdeCompatibleMessageRequestProcessor.kt:356)",
"\tat org.jetbrains.kotlinx.jupyter.messaging.IdeCompatibleMessageRequestProcessor.evalWithIO(IdeCompatibleMessageRequestProcessor.kt:384)",
"\tat org.jetbrains.kotlinx.jupyter.messaging.IdeCompatibleMessageRequestProcessor.processExecuteRequest$lambda$0$0(IdeCompatibleMessageRequestProcessor.kt:178)",
"\tat org.jetbrains.kotlinx.jupyter.execution.JupyterExecutorImpl$Task.execute(JupyterExecutorImpl.kt:41)",
"\tat org.jetbrains.kotlinx.jupyter.execution.JupyterExecutorImpl.executorThread$lambda$0(JupyterExecutorImpl.kt:81)",
"\tat kotlin.concurrent.ThreadsKt$thread$thread$1.run(Thread.kt:30)",
""
]
}
],
"execution_count": 4
},
{
"metadata": {},
"cell_type": "code",
"outputs": [],
"execution_count": null,
"source": [
"// Example 3: Use other JVM API's to bridge into Compose\n",
"application(exitProcessOnExit = false) {\n",
" Window(onCloseRequest = ::exitApplication, title = \"Compose App\") {\n",
" AllColors()\n",
" }\n",
"}"
],
"id": "b21fad08bc82240c"
}
],
"metadata": {
"kernelspec": {
"display_name": "Kotlin",
"language": "kotlin",
"name": "kotlin"
},
"language_info": {
"name": "kotlin",
"version": "2.4.0-dev-2124",
"mimetype": "text/x-kotlin",
"file_extension": ".kt",
"pygments_lexer": "kotlin",
"codemirror_mode": "text/x-kotlin",
"nbconvert_exporter": ""
}
},
"nbformat": 4,
"nbformat_minor": 5
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment