kotlin-jupyter-kernel 0.12.0.217__py3-none-any.whl → 0.12.0.322__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. kotlin_jupyter_kernel-0.12.0.322.dist-info/METADATA +722 -0
  2. {kotlin_jupyter_kernel-0.12.0.217.dist-info → kotlin_jupyter_kernel-0.12.0.322.dist-info}/RECORD +41 -43
  3. {kotlin_jupyter_kernel-0.12.0.217.dist-info → kotlin_jupyter_kernel-0.12.0.322.dist-info}/WHEEL +1 -1
  4. run_kotlin_kernel/config/jar_args.json +4 -3
  5. run_kotlin_kernel/jars/api-0.12.0-322.jar +0 -0
  6. run_kotlin_kernel/jars/{kotlin-jupyter-kernel-0.12.0-217-all.jar → kotlin-jupyter-kernel-0.12.0-322-all.jar} +0 -0
  7. run_kotlin_kernel/jars/{lib-0.12.0-217.jar → lib-0.12.0-322.jar} +0 -0
  8. run_kotlin_kernel/jars/slf4j-api-2.0.12.jar +0 -0
  9. run_kotlin_kernel/libraries/2p-kt.json +2 -2
  10. run_kotlin_kernel/libraries/biokotlin.json +1 -1
  11. run_kotlin_kernel/libraries/commit_sha +1 -1
  12. run_kotlin_kernel/libraries/coroutines.json +1 -1
  13. run_kotlin_kernel/libraries/dataframe.json +1 -1
  14. run_kotlin_kernel/libraries/datetime.json +1 -1
  15. run_kotlin_kernel/libraries/deeplearning4j-cuda.json +1 -1
  16. run_kotlin_kernel/libraries/deeplearning4j.json +1 -1
  17. run_kotlin_kernel/libraries/develocity-api-kotlin.json +1 -1
  18. run_kotlin_kernel/libraries/exposed.json +1 -1
  19. run_kotlin_kernel/libraries/fuel.json +1 -1
  20. run_kotlin_kernel/libraries/gradle-enterprise-api-kotlin.json +1 -1
  21. run_kotlin_kernel/libraries/intellij-sdk.json +14 -0
  22. run_kotlin_kernel/libraries/kalasim.json +1 -1
  23. run_kotlin_kernel/libraries/kaliningraph.json +5 -1
  24. run_kotlin_kernel/libraries/kandy-echarts.json +1 -1
  25. run_kotlin_kernel/libraries/kandy.json +2 -2
  26. run_kotlin_kernel/libraries/kravis.json +1 -1
  27. run_kotlin_kernel/libraries/ksl.json +48 -0
  28. run_kotlin_kernel/libraries/ktor-client.json +1 -1
  29. run_kotlin_kernel/libraries/lets-plot-gt.json +1 -1
  30. run_kotlin_kernel/libraries/lets-plot.json +4 -3
  31. run_kotlin_kernel/libraries/serialization.json +1 -1
  32. run_kotlin_kernel/libraries/smile.json +1 -1
  33. run_kotlin_kernel/libraries/webtau.json +1 -1
  34. kotlin_jupyter_kernel-0.12.0.217.dist-info/METADATA +0 -515
  35. run_kotlin_kernel/jars/api-0.12.0-217.jar +0 -0
  36. run_kotlin_kernel/libraries/CODE_OF_CONDUCT.md +0 -3
  37. run_kotlin_kernel/libraries/LICENSE +0 -202
  38. run_kotlin_kernel/libraries/README.md +0 -8
  39. run_kotlin_kernel/libraries/kotlin-statistics.json +0 -14
  40. run_kotlin_kernel/libraries/krangl.json +0 -11
  41. {kotlin_jupyter_kernel-0.12.0.217.data → kotlin_jupyter_kernel-0.12.0.322.data}/data/share/jupyter/kernels/kotlin/kernel.css +0 -0
  42. {kotlin_jupyter_kernel-0.12.0.217.data → kotlin_jupyter_kernel-0.12.0.322.data}/data/share/jupyter/kernels/kotlin/kernel.js +0 -0
  43. {kotlin_jupyter_kernel-0.12.0.217.data → kotlin_jupyter_kernel-0.12.0.322.data}/data/share/jupyter/kernels/kotlin/kernel.json +0 -0
  44. {kotlin_jupyter_kernel-0.12.0.217.data → kotlin_jupyter_kernel-0.12.0.322.data}/data/share/jupyter/kernels/kotlin/logo-16x16.png +0 -0
  45. {kotlin_jupyter_kernel-0.12.0.217.data → kotlin_jupyter_kernel-0.12.0.322.data}/data/share/jupyter/kernels/kotlin/logo-64x64.png +0 -0
  46. {kotlin_jupyter_kernel-0.12.0.217.data → kotlin_jupyter_kernel-0.12.0.322.data}/data/share/jupyter/kernels/kotlin/wavyline-orange.gif +0 -0
  47. {kotlin_jupyter_kernel-0.12.0.217.data → kotlin_jupyter_kernel-0.12.0.322.data}/data/share/jupyter/kernels/kotlin/wavyline-red.gif +0 -0
  48. {kotlin_jupyter_kernel-0.12.0.217.dist-info → kotlin_jupyter_kernel-0.12.0.322.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,722 @@
1
+ Metadata-Version: 2.1
2
+ Name: kotlin-jupyter-kernel
3
+ Version: 0.12.0.322
4
+ Summary: Kotlin kernel for Jupyter notebooks
5
+ Home-page: https://github.com/Kotlin/kotlin-jupyter
6
+ Author: JetBrains
7
+ License: Apache 2.0
8
+ Classifier: Framework :: Jupyter
9
+ Classifier: Development Status :: 4 - Beta
10
+ Classifier: Programming Language :: Kotlin
11
+ Classifier: License :: OSI Approved :: Apache Software License
12
+ Classifier: Intended Audience :: Science/Research
13
+ Classifier: Operating System :: OS Independent
14
+ Classifier: Topic :: Software Development :: Interpreters
15
+ Description-Content-Type: text/markdown
16
+
17
+ [![JetBrains official project](https://jb.gg/badges/official.svg)](https://confluence.jetbrains.com/display/ALL/JetBrains+on+GitHub)
18
+ [![Kotlin beta stability](https://img.shields.io/badge/project-beta-kotlin.svg?colorA=555555&colorB=AC29EC&label=&logo=kotlin&logoColor=ffffff&logoWidth=10)](https://kotlinlang.org/docs/components-stability.html)
19
+ [![PyPI](https://img.shields.io/pypi/v/kotlin-jupyter-kernel?label=PyPi)](https://pypi.org/project/kotlin-jupyter-kernel/)
20
+ [![Anaconda](https://anaconda.org/jetbrains/kotlin-jupyter-kernel/badges/version.svg)](https://anaconda.org/jetbrains/kotlin-jupyter-kernel)
21
+ [![Gradle plugin](https://img.shields.io/maven-metadata/v/https/plugins.gradle.org/m2/org/jetbrains/kotlin/kotlin-jupyter-api-gradle-plugin/maven-metadata.xml.svg?label=Gradle+plugin)](https://plugins.gradle.org/plugin/org.jetbrains.kotlin.jupyter.api)
22
+ [![Maven Central](https://img.shields.io/maven-central/v/org.jetbrains.kotlinx/kotlin-jupyter-kernel?color=blue&label=Maven%20artifacts)](https://search.maven.org/search?q=kotlin-jupyter)
23
+ [![GitHub](https://img.shields.io/github/license/Kotlin/kotlin-jupyter)](https://www.apache.org/licenses/LICENSE-2.0)
24
+ [![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/kotlin/kotlin-jupyter/master?filepath=samples)
25
+
26
+ # Kotlin Kernel for Jupyter notebooks
27
+
28
+ The Kotlin Kernel for Jupyter notebooks is a powerful tool that allows you to write and run [Kotlin](https://kotlinlang.org/) 1.9.23 code within the
29
+ [Jupyter Notebook](https://jupyter.org) environment. This [Kernel](https://docs.jupyter.org/en/latest/projects/kernels.html) essentially acts as a bridge between Jupyter Notebook and the Kotlin compiler.
30
+
31
+ <img src="images/kotlin_notebook.gif" width="900" height="700" alt="Alt text for the GIF">
32
+
33
+ The Kotlin Kernel for notebooks supports running code cells to immediately see outputs, basic code completion, error analysis,
34
+ and other interactive coding features, enhancing the interactive experience provided by the [Kotlin REPL](https://www.jetbrains.com/help/idea/kotlin-repl.html#kotlin-repl).
35
+
36
+ With the Kotlin Kernel for notebooks, you gain access to a range of features like:
37
+ * Accessing APIs within cells and using APIs for handling outputs.
38
+ * Retrieving information from previously executed code snippets, allowing quick project exploration.
39
+ * Importing various libraries with a single line of code or even integrating new libraries into your project.
40
+
41
+ You can leverage Kotlin Kernel's benefits in [IntelliJ IDEA](https://www.jetbrains.com/idea/) through the [Kotlin Notebook plugin](https://plugins.jetbrains.com/plugin/16340-kotlin-notebook), in your [Jupyter Notebook](https://jupyter.org/), or in [Datalore](https://www.jetbrains.com/datalore/).
42
+
43
+ ## Contents
44
+ <details>
45
+ <summary>Click here to expand the table of contents.</summary>
46
+
47
+ <!-- TOC -->
48
+ * [Kotlin Kernel for Jupyter notebooks](#kotlin-kernel-for-jupyter-notebooks)
49
+ * [Contents](#contents)
50
+ * [Get started](#get-started)
51
+ * [Versions and support](#versions-and-support)
52
+ * [Kotlin version support](#kotlin-version-support)
53
+ * [Jupyter environments](#jupyter-environments)
54
+ * [Operating systems](#operating-systems)
55
+ * [Install the Kotlin Kernel in various clients](#install-the-kotlin-kernel-in-various-clients)
56
+ * [Install the Kotlin Notebook plugin](#install-the-kotlin-notebook-plugin)
57
+ * [Install with Conda](#install-with-conda)
58
+ * [Install with Pip](#install-with-pip)
59
+ * [Install from sources](#install-from-sources)
60
+ * [Troubleshoot your installation](#troubleshoot-your-installation)
61
+ * [Update the Kotlin Kernel for notebooks](#update-the-kotlin-kernel-for-notebooks)
62
+ * [Update the Kotlin Notebook plugin](#update-the-kotlin-notebook-plugin)
63
+ * [Update with Conda](#update-with-conda)
64
+ * [Update with Pip](#update-with-pip)
65
+ * [Update in Datalore](#update-in-datalore)
66
+ * [Use the Kotlin Kernel for notebooks](#use-the-kotlin-kernel-for-notebooks)
67
+ * [Use the Kotlin Notebook](#use-the-kotlin-notebook)
68
+ * [Use other Jupyter clients](#use-other-jupyter-clients)
69
+ * [Use Datalore](#use-datalore)
70
+ * [Create custom kernels](#create-custom-kernels)
71
+ * [Features](#features)
72
+ * [REPL commands](#repl-commands)
73
+ * [Dependencies resolving](#dependencies-resolving)
74
+ * [Annotations](#annotations)
75
+ * [Gradle-like syntax](#gradle-like-syntax)
76
+ * [Handling dependencies](#handling-dependencies)
77
+ * [Default repositories](#default-repositories)
78
+ * [Line magics](#line-magics)
79
+ * [Supported libraries](#supported-libraries)
80
+ * [List of supported libraries](#list-of-supported-libraries)
81
+ * [Rich output](#rich-output)
82
+ * [Rendering](#rendering)
83
+ * [Common rendering semantics](#common-rendering-semantics)
84
+ * [Autocompletion](#autocompletion)
85
+ * [Error analysis](#error-analysis)
86
+ * [Debug your Kotlin notebook client](#debug-your-kotlin-notebook-client)
87
+ * [Integrate new libraries](#integrate-new-libraries)
88
+ * [Documentation](#documentation)
89
+ * [Contribute](#contribute)
90
+ <!-- TOC -->
91
+
92
+ </details>
93
+
94
+ ## Get started
95
+
96
+ Start using the Kotlin Kernel for Jupyter notebooks:
97
+
98
+ * See the [introductory notebook guide](https://github.com/cheptsov/kotlin-jupyter-demo/blob/master/index.ipynb).
99
+ * Check [notebook samples](https://github.com/Kotlin/kotlin-jupyter/tree/master/samples).
100
+ * Try the sample notebooks online: [![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/kotlin/kotlin-jupyter/master?filepath=samples)
101
+ * Explore the Kotlin Notebook docs to learn about [features](https://www.jetbrains.com/help/idea/kotlin-notebook.html), [use cases](https://kotlinlang.org/docs/kotlin-notebook-overview.html), and [tutorials](https://kotlinlang.org/docs/get-started-with-kotlin-notebooks.html).
102
+
103
+ ## Versions and support
104
+
105
+ > **Note:** The Kotlin Kernel for Jupyter notebooks is in [Beta](https://kotlinlang.org/docs/components-stability.html#stability-levels-explained).
106
+
107
+ ### Kotlin version support
108
+
109
+ The latest version of the Kotlin Kernel for notebooks uses the Kotlin compiler of version 1.9.23.
110
+
111
+ ### Jupyter environments
112
+
113
+ We tested the Kotlin Kernel for notebooks with the following clients:
114
+
115
+ | Client | Minimal supported version |
116
+ |:-----------------|:--------------------------|
117
+ | JupyterLab | 1.2.6 |
118
+ | Jupyter Notebook | 6.0.3 |
119
+ | Jupyter Console | 6.1.0 |
120
+
121
+ ### Operating systems
122
+
123
+ We tested the Kotlin Kernel for notebooks with all the mentioned clients on the following operating systems:
124
+ * Windows
125
+ * Ubuntu Linux
126
+ * macOS
127
+
128
+ ## Install the Kotlin Kernel in various clients
129
+
130
+ You can create, open, and work with Kotlin notebooks on various clients:
131
+
132
+ * [Kotlin Notebook in IntelliJ IDEA](https://www.jetbrains.com/idea/)
133
+ * [Datalore](https://www.jetbrains.com/datalore/)
134
+ * [Jupyter Notebook and JupyterLab](https://jupyter.org/)
135
+
136
+ Our Kotlin Kernel is fully integrated into Kotlin Notebook, which you can use directly within IntelliJ IDEA by [installing the Kotlin Notebook plugin](#install-the-kotlin-notebook-plugin).
137
+
138
+ In Datalore, Kotlin is supported natively, with the Kotlin Kernel already bundled for an out-of-the-box experience.
139
+
140
+ For other Jupyter clients, you'll need to install the Kotlin Kernel separately using [conda](#install-with-conda), [pip](#install-with-pip),
141
+ or [sources](#install-from-sources).
142
+
143
+ ### Install the Kotlin Notebook plugin
144
+
145
+ If you use IntelliJ IDEA, you need to install the Kotlin Notebook plugin that contains the Kotlin Kernel for Jupyter notebooks.
146
+
147
+ Install the Kotlin Notebook plugin by downloading its latest version from the [JetBrains Marketplace](https://plugins.jetbrains.com/plugin/16340-kotlin-notebook).
148
+
149
+ Alternatively, access the Kotlin Notebook plugin from **Settings** | **Plugins** | **Marketplace** within IntelliJ IDEA.
150
+
151
+ > **Note:** For a quick introduction to Kotlin Notebook, see this [blog post](https://blog.jetbrains.com/kotlin/2023/07/introducing-kotlin-notebook/).
152
+
153
+ ### Install with Conda
154
+
155
+ If you use Jupyter Notebook and Conda, run this Conda command to install the stable version [package](https://anaconda.org/jetbrains/kotlin-jupyter-kernel) of the Kotlin Kernel for Jupyter notebooks:
156
+
157
+ `conda install -c jetbrains kotlin-jupyter-kernel`
158
+
159
+ Alternatively, run this Conda command to install the [package](https://anaconda.org/jetbrains-dev/kotlin-jupyter-kernel) from the developers channel:
160
+
161
+ `conda install -c jetbrains-dev kotlin-jupyter-kernel`
162
+
163
+ To uninstall the Kotlin Kernel for Jupyter notebooks, run this Conda command:
164
+
165
+ `conda remove kotlin-jupyter-kernel`
166
+
167
+ ### Install with Pip
168
+
169
+ If you use Jupyter Notebook and Pip, run this Pip command to install the stable version [package](https://pypi.org/project/kotlin-jupyter-kernel) of the Kotlin Kernel for Jupyter notebooks:
170
+
171
+ `pip install kotlin-jupyter-kernel`
172
+
173
+ Alternatively, run this Pip command to install the [package](https://test.pypi.org/project/kotlin-jupyter-kernel) from the developers channel:
174
+
175
+ `pip install -i https://test.pypi.org/simple/ kotlin-jupyter-kernel`
176
+
177
+ To uninstall the Kotlin Kernel for Jupyter notebooks, run this Pip command:
178
+
179
+ `pip uninstall kotlin-jupyter-kernel`
180
+
181
+ ### Install from sources
182
+
183
+ If you use either IntelliJ IDEA or Jupyter Notebook, you can install the Kotlin Kernel for Jupyter notebooks from sources.
184
+
185
+ Clone this repository and run the following Gradle command in the root folder:
186
+
187
+ `./gradlew install`
188
+
189
+ The default installation path is `~/.ipython/kernels/kotlin/`. You can also install the package in another location using the `-PinstallPath=` option.
190
+ However, Jupyter only looks for the kernel specification files in predefined places. For more details, see [Jupyter docs](https://jupyter-client.readthedocs.io/en/stable/kernels.html#kernel-specs).
191
+
192
+ To uninstall the Kotlin Kernel for Jupyter notebooks from sources, run this Gradle command:
193
+
194
+ `./gradlew uninstall`
195
+
196
+ ### Troubleshoot your installation
197
+
198
+ When installing the Kotlin Kernel for Jupyter notebooks, issues can occur while detecting the kernel specification file.
199
+ These issues occur due to different Python environments and installation modes.
200
+
201
+ If you are using Pip or Conda to install the package, run this post-install fixup script:
202
+
203
+ ```bash
204
+ python -m kotlin_kernel fix-kernelspec-location
205
+ ```
206
+
207
+ This script replaces the kernel specification files with the detected user path.
208
+
209
+ > **Note:** Don't forget to re-run this script when updating the Kotlin Kernel for notebooks.
210
+
211
+ ## Update the Kotlin Kernel for notebooks
212
+
213
+ See how to update the Kotlin Kernel for Jupyter notebooks using the Kotlin Notebook plugin, Conda, Pip, and Datalore.
214
+
215
+ ### Update the Kotlin Notebook plugin
216
+
217
+ If you use the Kotlin Notebook plugin, update it to the latest version
218
+ in **Settings** | **Plugins** | **Installed** within IntelliJ IDEA.
219
+
220
+ Alternatively, you can download and install the latest plugin version
221
+ from the [JetBrains Marketplace](https://plugins.jetbrains.com/plugin/16340-kotlin-notebook).
222
+
223
+ ### Update with Conda
224
+
225
+ If you use Jupyter Notebook and Conda, run this Conda command to update the stable version package:
226
+
227
+ `conda update -c jetbrains kotlin-jupyter-kernel`
228
+
229
+ Alternatively, run this Conda command to update the package from the developers channel:
230
+
231
+ `conda update -c jetbrains-dev kotlin-jupyter-kernel`
232
+
233
+ To change to a specific Kotlin Kernel version, add the `={VERSION}` parameter to the `kotlin-jupyter-kernel` command. In this command,
234
+ replace the `{VERSION}` parameter with the desired PyPi version of the Kotlin Jupyter Kernel (for example, `0.12.0-167`).
235
+
236
+ You can specify the version in both commands the one from the stable package and the one from the developers channel package. For example, for the
237
+ stable package:
238
+
239
+ `conda install -c jetbrains kotlin-jupyter-kernel={0.12.0-167}`
240
+
241
+ ### Update with Pip
242
+
243
+ If you use Jupyter Notebook and Pip, run this Pip command to update the stable version package:
244
+
245
+ `pip install kotlin-jupyter-kernel --upgrade`
246
+
247
+ Alternatively, run this Conda command to update the package from the developers channel:
248
+
249
+ `pip install -i https://test.pypi.org/simple/ kotlin-jupyter-kernel --upgrade`
250
+
251
+ To change to a specific Kotlin Kernel version, add the `={VERSION}` parameter to the `kotlin-jupyter-kernel` command. In this command,
252
+ replace the `{VERSION}` parameter with the desired PyPi version of the Kotlin Jupyter Kernel (for example, `0.12.0-167`).
253
+
254
+ You can specify the version in both commands the one from the stable package and the one from the developers channel package. For example, for the
255
+ stable package:
256
+
257
+ `pip install kotlin-jupyter-kernel=={0.12.0-167} --ignore-installed`
258
+
259
+ ### Update in Datalore
260
+
261
+ To update the Kotlin Kernel for notebooks in Datalore:
262
+
263
+ 1. Add an `environment.yml` file to the Notebook files containing the following
264
+ snippet:
265
+
266
+ ```yaml
267
+ datalore-env-format-version: "0.2"
268
+ datalore-package-manager: "pip"
269
+ datalore-base-env: "default"
270
+ dependencies:
271
+ - pip:
272
+ - kotlin-jupyter-kernel=={VERSION}
273
+ ```
274
+
275
+ 2. Replace the `{VERSION}` parameter for the latest PyPi version of the Kotlin Jupyter Kernel (for example, `0.12.0-167`).
276
+
277
+ 3. Stop and restart the machine in Datalore.
278
+
279
+ ## Use the Kotlin Kernel for notebooks
280
+
281
+ See how to use the Kotlin Kernel for Jupyter notebooks with the Kotlin Notebook plugin, Jupyter clients, and Datalore.
282
+
283
+ ### Use the Kotlin Notebook
284
+
285
+ After [installing](#install-the-kotlin-notebook-plugin) the Kotlin Notebook plugin in IntelliJ IDEA, create a new notebook by selecting **File** | **New** | **Kotlin Notebook**, or right-click
286
+ on a folder and select **New** | **Kotlin Notebook**.
287
+
288
+ Now you're good to go!
289
+
290
+ ### Use other Jupyter clients
291
+
292
+ You can use our Kotlin Kernel through JupyterLab, Jupyter Notebook, and Jupyter Console clients:
293
+
294
+ 1. Run one of the following commands in the console:
295
+
296
+ * **In JupyterLab:**
297
+
298
+ `jupyter lab`
299
+
300
+ * **In Jupyter Notebook:**
301
+
302
+ `jupyter notebook`
303
+
304
+ * **In Jupyter Console:**
305
+
306
+ `jupyter console --kernel=kotlin`
307
+
308
+ 2. Create a new notebook and set `kotlin` as kernel. This step applies to Jupyter Notebook or JupyterLab, and it's not required for
309
+ Jupyter Console.
310
+
311
+ The default kernel uses the JDK that the environment points in the `KOTLIN_JUPYTER_JAVA_HOME` variable. In case the `KOTLIN_JUPYTER_JAVA_HOME` variable is not set,
312
+ the kernel also uses the JDK from the `JAVA_HOME` variable.
313
+
314
+ The kernel uses the arguments that the environment points in the `KOTLIN_JUPYTER_JAVA_OPTS` variable.
315
+ In case the `KOTLIN_JUPYTER_JAVA_OPTS` variable is not set, the kernel also uses the JVM arguments from the `JAVA_OPTS` variable.
316
+
317
+ Additionally, the kernel uses arguments that the environment points in the `KOTLIN_JUPYTER_JAVA_OPTS_EXTRA` variable.
318
+ The arguments are parsed using the Python [`shlex.split()`](https://docs.python.org/3/library/shlex.html) function.
319
+
320
+ ### Use Datalore
321
+
322
+ To create a Kotlin notebook in Datalore, click on **New notebook** and select **Kotlin** as kernel.
323
+
324
+ ### Create custom kernels
325
+
326
+ You can create a custom Kotlin Kernel for Jupyter Notebook.
327
+ This allows you to tailor the kernel's environment to your specific requirements, such as using a particular JDK, setting JVM arguments, or defining environment variables.
328
+
329
+ To create a custom Kotlin Kernel for Jupyter Notebook, use the `add-kernel` command from the installed `kotlin_kernel` python package:
330
+
331
+ ```bash
332
+ python -m kotlin_kernel add-kernel [--name name] [--jdk jdk_home_dir] [--set-jvm-args] [--jvm-arg arg]* [--env KEY VALUE]* [--force]
333
+ ```
334
+
335
+ In the `add-kernel` script, the `name` argument is required if the `jdk` argument is not specified. Alternatively, if the `jdk` argument is specified,
336
+ but the `name` argument is not, then the name is taken from the `JDK $vendor $version` argument, which is detected from the JDK.
337
+
338
+ Regardless of how the name is determined, the format of the kernel name is `Kotlin ($name)`,
339
+ and the format of the directory name is `kotlin_$name`. The directory name includes spaces in `name`, replaced by underscores. Ensure
340
+ this format is compatible with your file system.
341
+
342
+ JVM arguments are joined with a space (`' '`), supporting multiple arguments within the same entry.
343
+ The new arguments are added to existing ones, unless the `--set-jvm-args` flag is used. In this case, JVM
344
+ arguments are set to the `KOTLIN_JUPYTER_JAVA_OPTS` variable. Both adding and setting arguments work alongside the `KOTLIN_JUPYTER_JAVA_OPTS_EXTRA` variable.
345
+
346
+ While Jupyter Kernel environment variable substitutions are supported in the `env` argument, no replacement occurs
347
+ if the used environment variable doesn't exist.
348
+
349
+ The `add-kernel` script utilizes the `argparse` Python library, supporting the `--help`, `@argfile` (you don't need the `@` symbol in PowerShell), and `--opt=value` arguments.
350
+ The `--jvm-arg=arg` argument is required when passing JVM arguments that start with the `-` symbol.
351
+
352
+ Here's an example of an `add-kernel` script to create a custom Kotlin Kernel for Jupyter Notebook:
353
+
354
+ ```bash
355
+ python -m kotlin_kernel add-kernel --name "JDK 15 Big 2 GPU" --jdk ~/.jdks/openjdk-15.0.2 --jvm-arg=-Xmx8G --env CUDA_VISIBLE_DEVICES 0,1
356
+ ```
357
+
358
+ ## Features
359
+
360
+ Explore the sections below to learn about the features of the Kotlin Kernel for Jupyter notebooks. You can leverage these
361
+ features using Kotlin Notebook in IntelliJ IDEA, Datalore, or other [Jupyter Notebook clients](#jupyter-environments).
362
+
363
+ The features of the Kotlin Kernel for Jupyter notebooks include:
364
+
365
+ * [REPL commands](#repl-commands)
366
+ * [Dependencies resolving](#dependencies-resolving)
367
+ * [Default repositories](#default-repositories)
368
+ * [Line magics](#line-magics)
369
+ * [Supported libraries](#supported-libraries)
370
+ * [Rich output](#rich-output)
371
+ * [Rendering](#rendering)
372
+ * [Autocompletion](#autocompletion)
373
+ * [Error analysis](#error-analysis)
374
+
375
+ <details>
376
+ <summary>Click here to expand the features.</summary>
377
+
378
+ ### REPL commands
379
+
380
+ Our Kotlin Kernel for notebooks comes with a set of REPL commands that let you explore your notebook environment. The following REPL commands are supported:
381
+
382
+ | Command | Description |
383
+ |:--------|:------------|
384
+ | `:help` | Displays help information with details of the notebook version, line magics, and supported libraries. |
385
+ | `:classpath` | Displays the current classpath of your notebook environment, showing a list of locations where the notebook searches for libraries and resources. |
386
+ | `:vars` | Displays information about the declared variables and their values. |
387
+
388
+ ### Dependencies resolving
389
+
390
+ You can easily add dynamic dependencies to your notebook from a remote Maven repository or local ones (local JARs).
391
+ You can add dependencies through annotations or Gradle-like syntax.
392
+
393
+ #### Annotations
394
+
395
+ You can add dynamic dependencies to the notebook using the following annotations:
396
+
397
+ * **`@file:DependsOn(<coordinates>)`:** In this annotation, you need to specify the coordinates of the dependency.
398
+ This annotation adds artifacts (like JAR files) to the notebook's classpath. It supports absolute and relative paths to
399
+ class directories or JARs, as well as Ivy and Maven artifacts:
400
+
401
+ ```kotlin
402
+ @file:DependsOn(“io.ktor:ktor-client-core-jvm:$ktorVersion“)
403
+ ```
404
+
405
+ * **`@file:Repository(<absolute-path>)`:** In this annotation, you need to specify the absolute path of the dependency.
406
+ This annotation adds a directory or an Ivy or Maven repository to the notebook environment. To specify a Maven local
407
+ repository, use:
408
+
409
+ ```kotlin
410
+ @file:Repository("*mavenLocal")
411
+ ```
412
+
413
+ #### Gradle-like syntax
414
+
415
+ You can load any library from the Maven repository using Gradle-like syntax in any cell, specifying repositories, locations, and so on:
416
+
417
+ ```kotlin
418
+ USE {
419
+ repositories {
420
+ maven {
421
+ url = "https://my.secret.repo/maven/"
422
+ credentials {
423
+ username = USER
424
+ password = TOKEN
425
+ }
426
+ }
427
+ }
428
+
429
+ dependencies {
430
+ val ktorVersion = "2.0.3"
431
+
432
+ implementation("my.secret:artifact:1.0-beta")
433
+ implementation("io.ktor:ktor-client-core:$ktorVersion")
434
+ implementation("io.ktor:ktor-client-apache:$ktorVersion")
435
+ }
436
+ }
437
+ ```
438
+
439
+ > **Note:** You can use the same Gradle-like syntax to [integrate new libraries](libraries.md).
440
+
441
+ #### Handling dependencies
442
+
443
+ When adding dependencies, consider the following:
444
+
445
+ * Dependencies in remote repositories are resolved via Maven resolver.
446
+ * Caches are stored in the `~/.m2/repository` folder by default. However, due to network issues or several artifact
447
+ resolutions running in parallel, caches may become corrupted.
448
+ * If you have issues with artifacts resolution, remove caches, restart kernel,
449
+ and try again.
450
+ * While you can utilize Gradle-like syntax, Gradle is not running under the hood, and Gradle metadata is not resolved.
451
+ Therefore, advanced dependency configurations are not available. For example, top-level Multiplatform dependencies are not supported.
452
+ In these cases, you need to use the `-jvm` variant manually.
453
+
454
+ ### Default repositories
455
+
456
+ The following Maven repositories are included by default:
457
+ * [Maven Central](https://repo.maven.apache.org/maven2)
458
+ * [JitPack](https://jitpack.io/)
459
+
460
+ You can directly use libraries and dependencies from these repositories within your Kotlin code running in the Jupyter Notebook environment.
461
+
462
+ ### Line magics
463
+
464
+ Line magics are special commands, starting with the % character, that interact with the notebook on a per-line basis.
465
+ Line magics allow you to import libraries, configure output settings, and perform more operations.
466
+
467
+ You can use the following line magics in your notebooks using the Kotlin Kernel:
468
+
469
+
470
+ | Magic | Description | Usage example |
471
+ |:------|:------------|:--------------|
472
+ | `%use` | Imports supported libraries and injects code from these libraries(artifact resolution, default imports, initialization code, and type renderers). | `%use klaxon(5.5), lets-plot` |
473
+ | `%trackClasspath` | Logs any changes of the current classpath. This command is useful for debugging artifact resolution failures. | `%trackClasspath [on/off]` |
474
+ | `%trackExecution` | Logs pieces of code to be executed. This command is useful for debugging libraries support. | `%trackExecution [all/generated/off]` |
475
+ | `%useLatestDescriptors` | Sets the latest versions of available library descriptors instead of bundled descriptors (used by default). Note that bundled descriptors are preferred because the current kernel version might not support the latest descriptors. For better notebook stability, use bundled descriptors. | `%useLatestDescriptors [on/off]` |
476
+ | `%output` | Configures the output capturing settings. | `%output --max-cell-size=1000 --no-stdout --max-time=100 --max-buffer=400` |
477
+ | `%logLevel` | Sets logging level. | `%logLevel [off/error/warn/info/debug]` |
478
+
479
+ > **Note:** For more information, see [Line magics](magics.md).
480
+
481
+ ### Supported libraries
482
+
483
+ Kotlin Kernel for Jupyter notebooks comes with a set of integrated libraries, which you can import into your notebook by running the `%use` line magic before the library's name within a cell.
484
+
485
+ When you import a library using the `%use` line magic, the following functionality is added to the notebook:
486
+
487
+ * Repositories to search for library artifacts
488
+ * Artifact dependencies
489
+ * Default imports
490
+ * Library initialization code
491
+ * Renderers for special types. For example, charts and data frames
492
+
493
+ This behavior is defined by the [JSON library descriptor](libraries.md#library-integration-methods), which provides a set of properties with default values that can be overridden when the library is imported.
494
+
495
+ To check the descriptors of all supported libraries, see the [libraries repository](https://github.com/Kotlin/kotlin-jupyter-libraries).
496
+
497
+ The major use case for library properties is to specify a particular library version. If the descriptor has only one property, the library version can be
498
+ defined without naming:
499
+
500
+ ```
501
+ %use dataframe(0.10)
502
+ ```
503
+
504
+ If the descriptor has more than one property, you need to use the property name:
505
+
506
+ ```
507
+ %use spark(scala=2.11.10, spark=2.4.2)
508
+
509
+ ```
510
+
511
+ You can include several libraries in a single `%use` statement, separated by commas (`,`):
512
+
513
+ ```
514
+ %use kandy, dataframe, mysql(8.0.15)
515
+ ```
516
+
517
+ You can also specify the source of the library descriptor. By default, it's taken from the [libraries repository](https://github.com/Kotlin/kotlin-jupyter-libraries).
518
+ To try a descriptor from another revision, use the following syntax:
519
+
520
+ ```
521
+ // Uses a specific version from the default repository
522
+ %use lets-plot@0.8.2.5
523
+
524
+ // Uses a specific commit of the library
525
+ %use lets-plot@ref[24a040fe22335648885b106e2f4ddd63b4d49469]
526
+
527
+ // Uses a specific version of the library from a custom repository along with library arguments
528
+ %use dataframe@dev(0.10)
529
+ ```
530
+
531
+ > **Note:** Using a fixed version of a library is preferred over using the `%useLatestDescriptors` line magic.
532
+
533
+ Additionally, you can try resolving the library descriptor from a local file or a remote URL:
534
+
535
+ ```
536
+ // Loads the library from a file
537
+ %use mylib@file[/home/user/lib.json]
538
+
539
+ // Loads the library from a file, and the Kernel detects it's a file
540
+ %use @/home/user/libs/lib.json
541
+
542
+ // Specifies a directory and a file name without extension (the extension file should be JSON)
543
+ %use lib@/home/user/libs
544
+
545
+ // Loads the library descriptor from a remote URL
546
+ %use herlib@url[https://site.com/lib.json]
547
+
548
+ // Loads the library descriptor from a remote URL. The `url[]` part can be omitted if the URL responds with 200(OK)
549
+ %use @https://site.com/lib.json
550
+
551
+ // Loads the library dependencies from a specified JSON file. The library name and URL resolution can be omitted
552
+ %use @file[lib.json]
553
+ ```
554
+
555
+ #### List of supported libraries
556
+
557
+ Here you can find all the supported libraries you can use in you Kotlin notebooks through the `%use` line magic.
558
+
559
+ <details>
560
+ <summary>Click to see the list of supported libraries.</summary>
561
+
562
+ - [2p-kt](https://github.com/tuProlog/2p-kt) - Kotlin Multi-Platform ecosystem for symbolic AI
563
+ - [biokotlin](https://github.com/maize-genetics/BioKotlin) - BioKotlin aims to be a high-performance bioinformatics library that brings the power and speed of compiled programming languages to scripting and big data environments.
564
+ - [combinatoricskt](https://github.com/shiguruikai/combinatoricskt) - A combinatorics library for Kotlin
565
+ - [coroutines](https://github.com/Kotlin/kotlinx.coroutines) - Asynchronous programming and reactive streams support
566
+ - [dataframe](https://github.com/Kotlin/dataframe) - Kotlin framework for structured data processing
567
+ - [datetime](https://github.com/Kotlin/kotlinx-datetime) - Kotlin date/time library
568
+ - [deeplearning4j](https://github.com/eclipse/deeplearning4j) - Deep learning library for the JVM
569
+ - [deeplearning4j-cuda](https://github.com/eclipse/deeplearning4j) - Deep learning library for the JVM (CUDA support)
570
+ - default - Default imports: dataframe and Kandy libraries
571
+ - [develocity-api-kotlin](https://github.com/gabrielfeo/develocity-api-kotlin) - A library to use the Develocity API in Kotlin scripts or projects
572
+ - [exposed](https://github.com/JetBrains/Exposed) - Kotlin SQL framework
573
+ - [fuel](https://github.com/kittinunf/fuel) - HTTP networking library
574
+ - [gradle-enterprise-api-kotlin](https://github.com/gabrielfeo/gradle-enterprise-api-kotlin) - [Deprecated: use develocity-api-kotlin] A library to use the Gradle Enterprise API in Kotlin scripts or projects
575
+ - [gral](https://github.com/eseifert/gral) - Java library for displaying plots
576
+ - [intellij-sdk](https://plugins.jetbrains.com/docs/intellij/welcome.html) - IntelliJ SDK that could be used in embedded mode of Kotlin Notebook
577
+ - [jdsp](https://github.com/psambit9791/jDSP) - Java library for signal processing
578
+ - [jupyter-js](https://github.com/yidafu/kotlin-jupyter-js) - Experimental `%javascript`/`%typescript`/`%jsx` line magic support
579
+ - [kalasim](https://www.kalasim.org) - Discrete event simulator
580
+ - [kaliningraph](https://github.com/breandan/kaliningraph) - Graph library with a DSL for constructing graphs and visualizing the behavior of graph algorithms
581
+ - [kandy](https://github.com/Kotlin/kandy) - Kotlin plotting DSL for Lets-Plot
582
+ - [kandy-echarts](https://github.com/Kotlin/kandy) - Kotlin plotting DSL for Apache ECharts
583
+ - [khttp](https://github.com/jkcclemens/khttp) - HTTP networking library
584
+ - [klaxon](https://github.com/cbeust/klaxon) - JSON parser for Kotlin
585
+ - [kmath](https://github.com/mipt-npm/kmath) - Experimental Kotlin algebra-based mathematical library
586
+ - [kotlin-dl](https://github.com/Kotlin/kotlindl) - KotlinDL library which provides Keras-like API for deep learning
587
+ - [kraphviz](https://github.com/nidi3/graphviz-java) - Graphviz wrapper for JVM
588
+ - [kravis](https://github.com/holgerbrandl/kravis) - Kotlin grammar for data visualization
589
+ - [ksl](https://github.com/rossetti/KSL) - KSL - Kotlin Simulation Library for Monte Carlo and Discrete-Event Simulation
590
+ - [kt-math](https://github.com/gciatto/kt-math) - Kotlin multi-platform port of java.math.*
591
+ - [ktor-client](https://github.com/Kotlin/kotlin-jupyter-http-util) - Asynchronous HTTP client
592
+ - [lets-plot](https://github.com/JetBrains/lets-plot-kotlin) - Kotlin API for Lets-Plot: multiplatform plotting library based on Grammar of Graphics
593
+ - [lets-plot-gt](https://github.com/JetBrains/lets-plot-kotlin) - Lets-Plot visualisation for GeoTools toolkit
594
+ - [lib-ext](https://github.com/Kotlin/kotlin-jupyter) - Extended functionality for Jupyter kernel
595
+ - [londogard-nlp-toolkit](https://github.com/londogard/londogard-nlp-toolkit) - A Natural Language Processing (NLP) toolkit for Kotlin on the JVM
596
+ - [multik](https://github.com/Kotlin/multik) - Multidimensional array library for Kotlin
597
+ - [mysql](https://github.com/mysql/mysql-connector-j) - MySql JDBC Connector
598
+ - [openai](https://openai.com/blog/chatgpt) - OpenAI API for Jupyter Notebooks
599
+ - [plotly](https://github.com/mipt-npm/plotly.kt) - [beta] Plotly.kt jupyter integration for static plots.
600
+ - [plotly-server](https://github.com/mipt-npm/plotly.kt) - [beta] Plotly.kt jupyter integration for dynamic plots.
601
+ - [rdkit](https://www.rdkit.org/) - Open-Source Cheminformatics Software
602
+ - [reflection](https://kotlinlang.org/docs/reflection.html) - Imports for Kotlin Reflection
603
+ - [roboquant](https://roboquant.org) - Algorithmic trading platform written in Kotlin
604
+ - [serialization](https://github.com/Kotlin/kotlin-jupyter-http-util) - Deserialize JSON content using kotlinx.serialization and automatically generate classes for it
605
+ - [smile](https://github.com/haifengl/smile) - Statistical Machine Intelligence and Learning Engine
606
+ - [spark](https://github.com/JetBrains/kotlin-spark-api) - Kotlin API for Apache Spark: unified analytics engine for large-scale data processing
607
+ - [spark-streaming](https://github.com/JetBrains/kotlin-spark-api) - Kotlin API for Apache Spark Streaming: scalable, high-throughput, fault-tolerant stream processing of live data streams
608
+ - [webtau](https://github.com/testingisdocumenting/webtau) - WebTau end-to-end testing across layers
609
+
610
+ </details>
611
+
612
+ ### Rich output
613
+
614
+ By default, our Kotlin Kernel for Jupyter notebooks displays return values in text form. However, you can enrich the output by rendering graphics, HTML, or other MIME-encoded data format.
615
+
616
+ One approach is to send MIME-encoded results to the client using the `MIME` helper function:
617
+
618
+ ```kotlin
619
+ fun MIME(vararg mimeToData: Pair<String, String>): MimeTypedResult
620
+ ```
621
+
622
+ For example:
623
+
624
+ ```kotlin
625
+ MIME("text/html" to "<p>Some <em>HTML</em></p>", "text/plain" to "No HTML for text clients")
626
+ ```
627
+
628
+ Another approach is to use the `HTML` helper function, which provides a simpler way to display HTML content directly:
629
+
630
+ ```kotlin
631
+ fun HTML(text: String): MimeTypedResult
632
+ ```
633
+
634
+ For example:
635
+
636
+ ```kotlin
637
+ HTML("<p>This is an example of <strong>HTML</strong> content rendered using the HTML helper function.</p>")
638
+ ```
639
+
640
+ ### Rendering
641
+
642
+ Rendering is the procedure of transforming a value to a form that is appropriate for displaying it in the Jupyter client.
643
+ The Kotlin Kernel for Jupyter notebook supports various features and mechanisms for rendering values:
644
+
645
+ * **Renderers:** Transform values into other representations. Renderers are controlled via the `RenderersProcessor` method, and you can access it with the [notebook API entry point](https://github.com/Kotlin/kotlin-jupyter/blob/master/docs/libraries.md#supported-integration-features).
646
+ The Kotlin kernel iterates through a list of available renderers, trying to find one that can handle the given data. A library can define one or more renderers.
647
+
648
+ * **`DisplayResult` and `Renderable`:** Objects implementing `DisplayResult` and `Renderable` interfaces are rendered to output JSON.
649
+
650
+ * **Text rendering:** Render objects to strings using text renderers. Text renderers are controlled via the `TextRenderersProcessor` method, and you can access the method with the [notebook API entry point](https://github.com/Kotlin/kotlin-jupyter/blob/master/docs/libraries.md#supported-integration-features). A library can define one or more renderers.
651
+ The Kotlin Kernel iterates until at least one renderer returns a non-null string for a passed argument.
652
+ This kind of renderer can be easily composed with each other. For example, a text renderer for iterables can render its elements with a text renderer processor recursively.
653
+
654
+ * **Throwables rendering:** Throwable renderers behave as regular renderers but handle exceptions and errors generated during cell execution.
655
+
656
+ #### Common rendering semantics
657
+
658
+ Successful value evaluation triggers a rendering process. Initially, the `RenderersProcessor` attempts to convert the value
659
+ into a `Renderable` or `DisplayResult` object. If successful, the result is transformed into JSON output using the `toJson()` method.
660
+ For `Unit` values, no output is generated.
661
+
662
+ If the value cannot be rendered as `Renderable` or `DisplayResult`, the `TextRenderersProcessor` takes over.
663
+ It iterates to render the value to a string using the defined text renderers, seeking a non-null string representation. If no suitable renderer is found,
664
+ the value is transformed into a string using the `toString()` method. The resulting string is wrapped in a `text/plain` MIME JSON.
665
+
666
+ Upon execution failure, an exception is generated. The first applicable throwable renderer
667
+ is chosen for this exception, and the exception is passed to this renderer's `render()` method so the returned value
668
+ is displayed. If no applicable throwable renderer is found, the exception's message and stack trace are printed to standard error.
669
+
670
+ ### Autocompletion
671
+
672
+ When working with the Kotlin notebooks, press `TAB` to get the list of suggested items for completion.
673
+
674
+ In Jupyter Notebook, you don't need to press `TAB`. Completion is requested automatically.
675
+
676
+ Completion works for both globally defined symbols and local symbols,
677
+ which were loaded into the notebook during cell evaluation.
678
+
679
+ ### Error analysis
680
+
681
+ If you use Jupyter Notebook, you'll notice that compilation errors and warnings are underlined in
682
+ red and yellow, correspondingly. If you hover the cursor over underlined text, you'll get
683
+ an error message that can help you to fix the error.
684
+
685
+ This error analysis is achieved by the kernel-level extension of Jupyter Notebook. The extension sends
686
+ error-analysis requests to the kernel and renders their results.
687
+
688
+ </details>
689
+
690
+ ## Debug your Kotlin notebook client
691
+
692
+ 1. Run the `./gradlew installDebug` Gradle command. The debugger port is selected automatically.
693
+ The default port is 1044, and if it's unavailable, the consequent ports are used. If you want an exact port, specify the `-PdebugPort=<port>` Gradle option.
694
+ 2. Run the corresponding command to [open the desired notebook client](#use-other-jupyter-clients).
695
+ 3. Attach a remote debugger to the JVM with the corresponding port (the debug port number is printed in the terminal when the kernel starts).
696
+
697
+ ## Integrate new libraries
698
+
699
+ Read [this article](libraries.md) if you want to integrate new `JVM` libraries in the Kotlin Kernel for Jupyter notebooks.
700
+
701
+ ## Documentation
702
+
703
+ To learn more, explore the available documentation:
704
+
705
+ * [Docs site](https://ileasile.github.io/kotlin-jupyter-docs) with rendered KDoc comments from the codebase.
706
+ * [Docs about integrating new libraries](libraries.md). If you are a library author, you may be interested in the `api` module in our project. There is
707
+ also a `lib` module that contains entities available from the Notebook cells, and a `shared-compiler` module for Jupyter REPL integration
708
+ into a standalone application or IDEA plugin.
709
+ * Explore the Kotlin Notebook docs to learn about [features](https://www.jetbrains.com/help/idea/kotlin-notebook.html), [use cases](https://kotlinlang.org/docs/kotlin-notebook-overview.html), and [tutorials](https://kotlinlang.org/docs/get-started-with-kotlin-notebooks.html).
710
+
711
+ ## Contribute
712
+
713
+ We welcome contributions to further enhance our project! If you come across any issues or have feature requests, please don't hesitate to [file an issue](https://github.com/Kotlin/kotlin-jupyter/issues).
714
+
715
+ For issues specifically related to the Kotlin Notebook plugin, utilize [this tracker](https://youtrack.jetbrains.com/issues/KTNB).
716
+
717
+ Pull requests are highly appreciated! When submitting a pull request, ensure it corresponds to an existing issue.
718
+
719
+ If you are planning a substantial change, we recommend discussing it with a [project maintainer](https://github.com/ileasile).
720
+ You can reach out to me through [email](mailto:ilya.muradyan@jetbrains.com), [Kotlin Slack](https://kotlinlang.slack.com/archives/C05333T208Y), or [Telegram](https://t.me/ileasile).
721
+
722
+ We look forward to your contributions!