Skip to content

Commit 060ded8

Browse files
committed
chore: kotlin notebook sample
1 parent fe842d0 commit 060ded8

File tree

2 files changed

+149
-94
lines changed

2 files changed

+149
-94
lines changed

meta/ktor-df.ipynb

Lines changed: 0 additions & 94 deletions
This file was deleted.

shared/data.ipynb

Lines changed: 149 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,149 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "code",
5+
"metadata": {
6+
"collapsed": true,
7+
"ExecuteTime": {
8+
"end_time": "2025-02-26T00:26:39.065042Z",
9+
"start_time": "2025-02-26T00:26:08.203259Z"
10+
}
11+
},
12+
"source": [
13+
"import io.ktor.client.engine.java.*\n",
14+
"import kotlinx.coroutines.runBlocking\n",
15+
"import kotlinx.serialization.json.Json\n",
16+
"import io.ktor.client.*\n",
17+
"import dev.suresh.http.*\n",
18+
"\n",
19+
"%use ktor-client\n",
20+
"%use coroutines\n",
21+
"%use datetime\n",
22+
"%use dataframe\n",
23+
"%use exposed\n",
24+
"%use kandy\n",
25+
"\n",
26+
"val client = MediaApiClient()\n",
27+
"\n",
28+
"runBlocking { client.images() }"
29+
],
30+
"outputs": [
31+
{
32+
"ename": "java.lang.NoSuchMethodError",
33+
"evalue": "'void kotlinx.serialization.json.JsonBuilder.setAllowComments(boolean)'",
34+
"output_type": "error",
35+
"traceback": [
36+
"java.lang.NoSuchMethodError: 'void kotlinx.serialization.json.JsonBuilder.setAllowComments(boolean)'",
37+
"\tat dev.suresh.http.HttpClientKt.json_delegate$lambda$1$lambda$0(HttpClient.kt:31)",
38+
"\tat kotlinx.serialization.json.JsonKt.Json(Json.kt:199)",
39+
"\tat kotlinx.serialization.json.JsonKt.Json$default(Json.kt:197)",
40+
"\tat dev.suresh.http.HttpClientKt.json_delegate$lambda$1(HttpClient.kt:20)",
41+
"\tat kotlin.SynchronizedLazyImpl.getValue(LazyJVM.kt:74)",
42+
"\tat dev.suresh.http.HttpClientKt.getJson(HttpClient.kt:19)",
43+
"\tat dev.suresh.http.HttpClient_jvmKt.httpClient$lambda$13$lambda$4(HttpClient.jvm.kt:51)",
44+
"\tat io.ktor.client.HttpClientConfig.install$lambda$3(HttpClientConfig.kt:166)",
45+
"\tat io.ktor.client.plugins.api.ClientPluginImpl.prepare(CreatePluginUtils.kt:67)",
46+
"\tat io.ktor.client.plugins.api.ClientPluginImpl.prepare(CreatePluginUtils.kt:58)",
47+
"\tat io.ktor.client.HttpClientConfig.install$lambda$5(HttpClientConfig.kt:174)",
48+
"\tat io.ktor.client.HttpClientConfig.install(HttpClientConfig.kt:200)",
49+
"\tat io.ktor.client.HttpClient.<init>(HttpClient.kt:1396)",
50+
"\tat io.ktor.client.HttpClient.<init>(HttpClient.kt:1293)",
51+
"\tat io.ktor.client.HttpClientKt.HttpClient(HttpClient.kt:649)",
52+
"\tat dev.suresh.http.HttpClient_jvmKt.httpClient(HttpClient.jvm.kt:29)",
53+
"\tat dev.suresh.http.HttpClient_jvmKt.httpClient$default(HttpClient.jvm.kt:22)",
54+
"\tat dev.suresh.http.MediaApiClient.<init>(MediaApiClient.kt:41)",
55+
"\tat dev.suresh.http.MediaApiClient.<init>(MediaApiClient.kt:33)",
56+
"\tat Line_34_jupyter.<init>(Line_34.jupyter.kts:14) at Cell In[3], line 14",
57+
"\tat java.base/jdk.internal.reflect.DirectConstructorHandleAccessor.newInstance(DirectConstructorHandleAccessor.java:62)",
58+
"\tat java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:502)",
59+
"\tat java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:486)",
60+
"\tat kotlin.script.experimental.jvm.BasicJvmScriptEvaluator.evalWithConfigAndOtherScriptsResults(BasicJvmScriptEvaluator.kt:122)",
61+
"\tat kotlin.script.experimental.jvm.BasicJvmScriptEvaluator.invoke$suspendImpl(BasicJvmScriptEvaluator.kt:48)",
62+
"\tat kotlin.script.experimental.jvm.BasicJvmScriptEvaluator.invoke(BasicJvmScriptEvaluator.kt)",
63+
"\tat kotlin.script.experimental.jvm.BasicJvmReplEvaluator.eval(BasicJvmReplEvaluator.kt:49)",
64+
"\tat org.jetbrains.kotlinx.jupyter.repl.impl.InternalEvaluatorImpl$eval$resultWithDiagnostics$1.invokeSuspend(InternalEvaluatorImpl.kt:137)",
65+
"\tat kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)",
66+
"\tat kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:104)",
67+
"\tat kotlinx.coroutines.EventLoopImplBase.processNextEvent(EventLoop.common.kt:277)",
68+
"\tat kotlinx.coroutines.BlockingCoroutine.joinBlocking(Builders.kt:95)",
69+
"\tat kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking(Builders.kt:69)",
70+
"\tat kotlinx.coroutines.BuildersKt.runBlocking(Unknown Source)",
71+
"\tat kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking$default(Builders.kt:48)",
72+
"\tat kotlinx.coroutines.BuildersKt.runBlocking$default(Unknown Source)",
73+
"\tat org.jetbrains.kotlinx.jupyter.repl.impl.InternalEvaluatorImpl.eval(InternalEvaluatorImpl.kt:137)",
74+
"\tat org.jetbrains.kotlinx.jupyter.repl.impl.CellExecutorImpl$execute$1$result$1.invoke(CellExecutorImpl.kt:80)",
75+
"\tat org.jetbrains.kotlinx.jupyter.repl.impl.CellExecutorImpl$execute$1$result$1.invoke(CellExecutorImpl.kt:78)",
76+
"\tat org.jetbrains.kotlinx.jupyter.repl.impl.ReplForJupyterImpl.withHost(ReplForJupyterImpl.kt:774)",
77+
"\tat org.jetbrains.kotlinx.jupyter.repl.impl.CellExecutorImpl.execute-L4Nmkdk(CellExecutorImpl.kt:78)",
78+
"\tat org.jetbrains.kotlinx.jupyter.repl.execution.CellExecutor$DefaultImpls.execute-L4Nmkdk$default(CellExecutor.kt:13)",
79+
"\tat org.jetbrains.kotlinx.jupyter.repl.impl.ReplForJupyterImpl.evaluateUserCode-wNURfNM(ReplForJupyterImpl.kt:596)",
80+
"\tat org.jetbrains.kotlinx.jupyter.repl.impl.ReplForJupyterImpl.evalExImpl(ReplForJupyterImpl.kt:454)",
81+
"\tat org.jetbrains.kotlinx.jupyter.repl.impl.ReplForJupyterImpl.access$evalExImpl(ReplForJupyterImpl.kt:141)",
82+
"\tat org.jetbrains.kotlinx.jupyter.repl.impl.ReplForJupyterImpl$evalEx$1.invoke(ReplForJupyterImpl.kt:447)",
83+
"\tat org.jetbrains.kotlinx.jupyter.repl.impl.ReplForJupyterImpl$evalEx$1.invoke(ReplForJupyterImpl.kt:446)",
84+
"\tat org.jetbrains.kotlinx.jupyter.repl.impl.ReplForJupyterImpl.withEvalContext(ReplForJupyterImpl.kt:427)",
85+
"\tat org.jetbrains.kotlinx.jupyter.repl.impl.ReplForJupyterImpl.evalEx(ReplForJupyterImpl.kt:446)",
86+
"\tat org.jetbrains.kotlinx.jupyter.messaging.IdeCompatibleMessageRequestProcessor$processExecuteRequest$1$response$1$1.invoke(IdeCompatibleMessageRequestProcessor.kt:159)",
87+
"\tat org.jetbrains.kotlinx.jupyter.messaging.IdeCompatibleMessageRequestProcessor$processExecuteRequest$1$response$1$1.invoke(IdeCompatibleMessageRequestProcessor.kt:158)",
88+
"\tat org.jetbrains.kotlinx.jupyter.streams.BlockingSubstitutionEngine.withDataSubstitution(SubstitutionEngine.kt:70)",
89+
"\tat org.jetbrains.kotlinx.jupyter.streams.StreamSubstitutionManager.withSubstitutedStreams(StreamSubstitutionManager.kt:118)",
90+
"\tat org.jetbrains.kotlinx.jupyter.messaging.IdeCompatibleMessageRequestProcessor.withForkedIn(IdeCompatibleMessageRequestProcessor.kt:335)",
91+
"\tat org.jetbrains.kotlinx.jupyter.messaging.IdeCompatibleMessageRequestProcessor.access$withForkedIn(IdeCompatibleMessageRequestProcessor.kt:54)",
92+
"\tat org.jetbrains.kotlinx.jupyter.messaging.IdeCompatibleMessageRequestProcessor$evalWithIO$1$1.invoke(IdeCompatibleMessageRequestProcessor.kt:349)",
93+
"\tat org.jetbrains.kotlinx.jupyter.streams.BlockingSubstitutionEngine.withDataSubstitution(SubstitutionEngine.kt:70)",
94+
"\tat org.jetbrains.kotlinx.jupyter.streams.StreamSubstitutionManager.withSubstitutedStreams(StreamSubstitutionManager.kt:118)",
95+
"\tat org.jetbrains.kotlinx.jupyter.messaging.IdeCompatibleMessageRequestProcessor.withForkedErr(IdeCompatibleMessageRequestProcessor.kt:324)",
96+
"\tat org.jetbrains.kotlinx.jupyter.messaging.IdeCompatibleMessageRequestProcessor.access$withForkedErr(IdeCompatibleMessageRequestProcessor.kt:54)",
97+
"\tat org.jetbrains.kotlinx.jupyter.messaging.IdeCompatibleMessageRequestProcessor$evalWithIO$1.invoke(IdeCompatibleMessageRequestProcessor.kt:348)",
98+
"\tat org.jetbrains.kotlinx.jupyter.streams.BlockingSubstitutionEngine.withDataSubstitution(SubstitutionEngine.kt:70)",
99+
"\tat org.jetbrains.kotlinx.jupyter.streams.StreamSubstitutionManager.withSubstitutedStreams(StreamSubstitutionManager.kt:118)",
100+
"\tat org.jetbrains.kotlinx.jupyter.messaging.IdeCompatibleMessageRequestProcessor.withForkedOut(IdeCompatibleMessageRequestProcessor.kt:316)",
101+
"\tat org.jetbrains.kotlinx.jupyter.messaging.IdeCompatibleMessageRequestProcessor.evalWithIO(IdeCompatibleMessageRequestProcessor.kt:347)",
102+
"\tat org.jetbrains.kotlinx.jupyter.messaging.IdeCompatibleMessageRequestProcessor$processExecuteRequest$1$response$1.invoke(IdeCompatibleMessageRequestProcessor.kt:158)",
103+
"\tat org.jetbrains.kotlinx.jupyter.messaging.IdeCompatibleMessageRequestProcessor$processExecuteRequest$1$response$1.invoke(IdeCompatibleMessageRequestProcessor.kt:157)",
104+
"\tat org.jetbrains.kotlinx.jupyter.execution.JupyterExecutorImpl$Task.execute(JupyterExecutorImpl.kt:41)",
105+
"\tat org.jetbrains.kotlinx.jupyter.execution.JupyterExecutorImpl$executorThread$1.invoke(JupyterExecutorImpl.kt:83)",
106+
"\tat org.jetbrains.kotlinx.jupyter.execution.JupyterExecutorImpl$executorThread$1.invoke(JupyterExecutorImpl.kt:80)",
107+
"\tat kotlin.concurrent.ThreadsKt$thread$thread$1.run(Thread.kt:30)",
108+
"",
109+
"java.lang.NoSuchMethodError: 'void kotlinx.serialization.json.JsonBuilder.setAllowComments(boolean)'",
110+
"at Cell In[3], line 14",
111+
""
112+
]
113+
}
114+
],
115+
"execution_count": 3
116+
},
117+
{
118+
"metadata": {},
119+
"cell_type": "code",
120+
"source": "",
121+
"outputs": [],
122+
"execution_count": null
123+
}
124+
],
125+
"metadata": {
126+
"kernelspec": {
127+
"display_name": "Kotlin",
128+
"language": "kotlin",
129+
"name": "kotlin"
130+
},
131+
"language_info": {
132+
"name": "kotlin",
133+
"version": "1.9.23",
134+
"mimetype": "text/x-kotlin",
135+
"file_extension": ".kt",
136+
"pygments_lexer": "kotlin",
137+
"codemirror_mode": "text/x-kotlin",
138+
"nbconvert_exporter": ""
139+
},
140+
"ktnbPluginMetadata": {
141+
"projectDependencies": [
142+
"kotlin-mpp-playground.shared.jvmMain"
143+
],
144+
"projectLibraries": false
145+
}
146+
},
147+
"nbformat": 4,
148+
"nbformat_minor": 0
149+
}

0 commit comments

Comments
 (0)