Skip to content

Commit 7f41024

Browse files
committed
Cleanup devdocs.
1 parent 235ebc9 commit 7f41024

File tree

1 file changed

+43
-57
lines changed

1 file changed

+43
-57
lines changed

devdocs/JUPYTER_KOTLIN_KERNEL.md

Lines changed: 43 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -1,84 +1,64 @@
1-
## Install:
2-
`$ pip install kotlin-jupyter-kernel`
3-
4-
## Install dev:
5-
`$ pip install -i https://test.pypi.org/simple/ kotlin-jupyter-kernel`
6-
7-
## Build and install Kernel from sources:
8-
Github: https://github.com/Kotlin/kotlin-jupyter
1+
## Installing Kotlin Kernel
92

10-
`$ ./gradlew install`
11-
12-
If built successfully it will install the kernel to:
13-
> ~/.ipython/kernels/kotlin
3+
`$ pip install kotlin-jupyter-kernel`
144

15-
Normally the kernel is installed to conda env.
5+
## Library Descriptors Location
166

17-
## Library descriptors location
187
Lets-Plot library descriptors are files:
198
- lets-plot.json
209
- lets-plot-gt.json
2110

2211
After installing kotlin kernel the "bundled" library descriptors are located in
2312

24-
a) After installing via `$ pip install`:
2513
> /opt/anaconda3/envs/<env name>/lib/python3.7/site-packages/run_kotlin_kernel/libraries/
2614
27-
b) After installing from local sources via `$ ./gradlew install`:
28-
> ~/.jupyter_kotlin/cache/libraries/
29-
30-
> [!NOTE]
31-
> If the `%useLatestDescriptors` **_line magic_** is included in Jupyter notebook,
15+
> **Note:** If the `%useLatestDescriptors` **_line magic_** is included in Jupyter notebook,
16+
>
3217
> Kotlin kernel will pull the latest repository version of descriptors and store them in this location:
33-
>
3418
> ~/.jupyter_kotlin/cache/
19+
>
3520
21+
## Notebook Tips and Tricks
3622

37-
## About library descriptors (lets-plot.json, lets-plot-gt.json)
38-
39-
- edit descriptor: to conduct local experiments (see more info below).
40-
- remove descriptor: force the kernel to pull current published version of descriptor from 'master' at https://github.com/Kotlin/kotlin-jupyter.
41-
42-
43-
--------
44-
In notebook
45-
46-
`:classpath` - shows all resolved jars.
47-
48-
`%useLatestDescriptors` - will force Kotlin Kernel to pull and apply the latest repository version of all library descriptors.
49-
Descriptors location:
50-
~/.jupyter_kotlin/cache
23+
- show all resolved jars:
24+
```
25+
:classpath
26+
```
5127

52-
Otherwise, Kotlin Kernel uses 'bundled' descriptors installed to:
53-
> /opt/anaconda3/envs/<env name>/lib/python3.7/site-packages/run_kotlin_kernel/libraries
28+
- force the Kotlin Kernel to pull from the repository and apply the latest versions of all library descriptors::
29+
```
30+
%useLatestDescriptors
31+
```
5432

55-
## Conducting experiments with Kotlin Kernel locally.
33+
- substitute the Kernel's version of the `lets-plot` library descriptor with your own descriptor:
34+
```
35+
//%use lets-plot
36+
%use @/Users/me/Projects/lets-plot-kotlin/lets-plot-dev.json
37+
```
38+
39+
## Conducting Experiments with Kotlin Kernel Locally
5640

5741
Clear Maven cache:
5842
`$ rm -rf ~/.m2/repository/org/jetbrains/lets-plot`
5943

60-
#### 1) Publish artifacts to the local dev-repo:
61-
62-
`./gradlew publishJvmPublicationToMavenLocalRepository`
63-
`./gradlew publishLetsPlotKotlinGeoToolsPublicationToMavenLocalRepository`
64-
`./gradlew publishletsPlotKotlinJupyterPublicationToMavenLocalRepository`
65-
`./gradlew publishletsPlotKotlinGeotoolsJupyterPublicationToMavenLocalRepository`
66-
`./gradlew publishLetsPlotKotlinJsonPublicationToMavenLocalRepository`
44+
#### Publish artifacts to the local dev-repo:
45+
46+
```bash
47+
./gradlew publishJvmPublicationToMavenLocalRepository
48+
./gradlew publishLetsPlotKotlinGeoToolsPublicationToMavenLocalRepository
49+
./gradlew publishletsPlotKotlinJupyterPublicationToMavenLocalRepository
50+
./gradlew publishletsPlotKotlinGeotoolsJupyterPublicationToMavenLocalRepository
51+
./gradlew publishLetsPlotKotlinJsonPublicationToMavenLocalRepository
52+
```
6753

6854
It will publish all artifacts to `<project root>/.maven-publish-dev-repo/` folder.
6955

70-
#### 2) Edit "lets-plot.json" (see info above about its location):
71-
72-
**Note:** when editing descriptor in "~/.jupyter_kotlin/cache" always check that you are using the latest descriptor.
73-
The kernel can download a newer descriptor at any moment.
74-
75-
76-
**Alternatively**, if you do not want to rely on a "cached" descriptor, you can load any of your library descriptors using the **_line magic_**:
77-
```
78-
//%use lets-plot
79-
%use @/Users/me/Projects/lets-plot-kotlin/lets-plot-dev.json
80-
```
56+
#### Edit the library descriptor (lets-plot.json or lets-plot-gt.json):
8157

58+
> **Tip:** To make sure you have the latest version of the descriptor in "~/.jupyter_kotlin/cache",
59+
> execute the `%use lets-plot` statement in the notebook.
60+
> The kernel will download a newer descriptor if available.
61+
8262
- add _Maven Local_ or _Sonatype SNAPSHOT_ repository or both:
8363
```
8464
"repositories": [
@@ -87,15 +67,21 @@ The kernel can download a newer descriptor at any moment.
8767
],
8868
```
8969

90-
- configure the artifacts version (published Lets-Plot JS):
70+
- configure the Lets-Plot Kotlin version (the one that is set in `build.gradle.kts`):
9171
```
9272
"properties": {
9373
"v": "3.1.2-alpha2",
9474
"isolatedFrame": ""
9575
},
9676
```
77+
9778
- if experimenting with Lets-Plot JS which is not published:
9879
- Set "js" version to "dev";
80+
> **TBD:** Currently there is no clean way to configure "dev" version for JS.
81+
> The "dirty" way is to add "dev" to the "js" version right in the `VersionChecker.kt`.
82+
>
83+
> See the `letsPlotJsVersion` property in the `VersionChecker.kt` file.
84+
>
9985
- Build "dev" JS package (see [lets-plot/js-package/README.md](https://github.com/JetBrains/lets-plot/blob/master/js-package/README.md));
10086
- Activate any "env" containing Python;
10187
- Start local HTTP-server serving the JS dev-version:

0 commit comments

Comments
 (0)