Skip to content

Commit

Permalink
Cleanup code and docs.
Browse files Browse the repository at this point in the history
  • Loading branch information
alshan committed Nov 18, 2024
1 parent 9f9865a commit 09efb9b
Show file tree
Hide file tree
Showing 11 changed files with 31 additions and 35 deletions.
6 changes: 2 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,9 @@ In this case the latest `library descriptor` will be pulled from the [Kotlin Jup
#### Library Descriptor Parameters

```
%use lets-plot(api=4.9.0, lib=4.5.1, js=4.5.1, isolatedFrame=false)
%use lets-plot(v=4.9.0, isolatedFrame=false)
```
- `api` - version of the Lets-Plot Kotlin API.
- `lib` - version of the Lets-Plot Multiplatform (JARs).
- `js` - version of the Lets-PLot Multiplatform JavaScript bundle.
- `v` - version of the Lets-Plot Kotlin API.
- `isolatedFrame` - If `false`: load JS just once per notebook (default in Jupyter).
If `true`: include Lets-Plot JS in each output (default in [Datalore](https://datalore.jetbrains.com/) notebooks).

Expand Down
9 changes: 5 additions & 4 deletions devdocs/JUPYTER_KOTLIN_KERNEL.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,12 @@ Otherwise, Kotlin Kernel uses 'bundled' descriptors installed to:
## Conducting experiments with Kotlin Kernel locally.

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

#### 1) Publish artifacts to the local dev-repo:

`$ ./gradlew publishLetsPlotKotlinKernelPublicationToMavenLocalRepository`
`$ ./gradlew publishJvmPublicationToMavenLocalRepository`
`$ ./gradlew publishLetsPlotKotlinGeoToolsPublicationToMavenLocalRepository`
`$ ./gradlew publishletsPlotKotlinJupyterPublicationToMavenLocalRepository`
`$ ./gradlew publishletsPlotKotlinGeotoolsJupyterPublicationToMavenLocalRepository`
Expand Down Expand Up @@ -87,9 +90,7 @@ The kernel can download a newer descriptor at any moment.
- configure the artifacts version (published Lets-Plot JS):
```
"properties": {
"api": "3.1.2-alpha2",
"lib": "2.3.0-rc2",
"js": "2.3.0rc2",
"v": "3.1.2-alpha2",
"isolatedFrame": ""
},
```
Expand Down
3 changes: 3 additions & 0 deletions future_changes.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
## [4.9.1] - 202y-mm-dd

This release is 100% compatible with Lets-Plot [v 4.5.1](https://github.com/JetBrains/lets-plot/releases/tag/v4.5.1),
GeoTools [v 32.1](https://github.com/geotools/geotools/releases/tag/32.0)

### Added


Expand Down
10 changes: 1 addition & 9 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,4 @@ jupyterApi.version=0.12.0-313

# Also update JS version in <home>/demo/js-frontend-app/src/main/resources/index.html
letsPlot.version=4.5.1

# The latest GeoTools 30-RC do not compile due to
# "renaming of all "org.opengis" packages into "org.geotools.api" ones"
# See release notes: http://geotoolsnews.blogspot.com/2023/09/geotools-30-rc-released.html
#
# The most recent compatible version is 29.2
# See Sourceforge: https://sourceforge.net/projects/geotools/files/
#geotools.version=[23,)
geotools.version=[30,)
geotools.version=[32.1]
4 changes: 3 additions & 1 deletion plot-api/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,10 @@ kotlin {

named("jvmMain") {
dependencies {
implementation("io.github.microutils:kotlin-logging:$kotlinLoggingVersion")
// implementation("io.github.microutils:kotlin-logging:$kotlinLoggingVersion")
api("org.jetbrains.lets-plot:lets-plot-common:$letsPlotVersion")
api("io.github.microutils:kotlin-logging-jvm:$kotlinLoggingVersion")

// Use "-jvm" variant to work around the issue where LPK JS (IR) artefact becomes dependent on
// the "kotlinx-datetime".
// See also:
Expand Down
6 changes: 4 additions & 2 deletions toolkit/geotools-jupyter/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,17 @@ repositories {
val geoToolsVersion = extra["geotools.version"] as String

dependencies {
implementation(projects.plotApi)
compileOnly(projects.plotApi)
// basic LPK jupyter integration
implementation(projects.jupyter)
compileOnly(projects.jupyter)

// geotools implementations
implementation(projects.geotools)
implementation("org.geotools:gt-main:$geoToolsVersion")
implementation("org.geotools:gt-geojson:$geoToolsVersion")

testImplementation(projects.plotApi)
testImplementation(projects.jupyter)
testImplementation(kotlin("test"))
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,10 @@ package org.jetbrains.letsPlot.toolkit.geotools.jupyter
import org.jetbrains.kotlinx.jupyter.api.Notebook
import org.jetbrains.kotlinx.jupyter.api.libraries.JupyterIntegration
import org.jetbrains.kotlinx.jupyter.api.libraries.repositories
import org.jetbrains.letsPlot.export.VersionChecker

@Suppress("unused")
class Integration(private val notebook: Notebook, private val options: MutableMap<String, String?>) :
class Integration(private val notebook: Notebook, options: MutableMap<String, String?>) :
JupyterIntegration() {
private val api = options["api"] ?: VersionChecker.letsPlotKotlinAPIVersion
override fun Builder.onLoaded() {
repositories {
maven("https://repo.osgeo.org/repository/release")
Expand Down
3 changes: 2 additions & 1 deletion toolkit/geotools/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,12 @@ plugins {
val geoToolsVersion = extra["geotools.version"] as String

dependencies {
implementation(projects.plotApi)
compileOnly(projects.plotApi)

compileOnly("org.geotools:gt-main:$geoToolsVersion")
compileOnly("org.geotools:gt-geojson:$geoToolsVersion")

testImplementation(projects.plotApi)
testImplementation(kotlin("test"))
testImplementation("org.geotools:gt-main:$geoToolsVersion")
testImplementation("org.geotools:gt-geojson:$geoToolsVersion")
Expand Down
2 changes: 1 addition & 1 deletion toolkit/json/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ plugins {
val serializationVersion = extra["serialization.version"] as String

dependencies {
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:$serializationVersion")
api("org.jetbrains.kotlinx:kotlinx-serialization-json:$serializationVersion")

testImplementation(kotlin("test"))
}
Expand Down
6 changes: 3 additions & 3 deletions toolkit/jupyter/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ dependencies {
// All LP/LPK implementations to be loaded in notebook
implementation(projects.plotApi)

implementation("org.jetbrains.lets-plot:lets-plot-common:$letsPlotVersion")
// implementation("org.jetbrains.lets-plot:lets-plot-common:$letsPlotVersion")
implementation("org.jetbrains.lets-plot:platf-awt-jvm:$letsPlotVersion")
implementation("org.jetbrains.lets-plot:lets-plot-image-export:$letsPlotVersion")
implementation("io.github.microutils:kotlin-logging-jvm:$kotlinLoggingVersion")
// implementation("io.github.microutils:kotlin-logging-jvm:$kotlinLoggingVersion")

implementation(projects.json)
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.7.3")
// implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.7.3")

testImplementation(kotlin("test"))
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import org.jetbrains.kotlinx.jupyter.api.HTML
import org.jetbrains.kotlinx.jupyter.api.Notebook
import org.jetbrains.kotlinx.jupyter.api.declare
import org.jetbrains.kotlinx.jupyter.api.libraries.JupyterIntegration
import org.jetbrains.kotlinx.jupyter.api.libraries.repositories
import org.jetbrains.kotlinx.jupyter.api.libraries.resources
import org.jetbrains.letsPlot.Figure
import org.jetbrains.letsPlot.LetsPlot
Expand All @@ -13,7 +12,7 @@ import org.jetbrains.letsPlot.export.VersionChecker
import org.jetbrains.letsPlot.frontend.NotebookFrontendContext

@Suppress("unused")
internal class Integration(private val notebook: Notebook, private val options: MutableMap<String, String?>) :
internal class Integration(private val notebook: Notebook, options: MutableMap<String, String?>) :
JupyterIntegration() {

// used by kandy-lets-plot
Expand All @@ -24,8 +23,8 @@ internal class Integration(private val notebook: Notebook, private val options:
// If used via Kotlin Notebook plugin as a dependency,
// provide defaults (versions from `VersionChecker`
// and empty `isolatedFrame`)
private val api = options["api"] ?: VersionChecker.letsPlotKotlinAPIVersion
private val js = VersionChecker.letsPlotJsVersion
private val lpkVersion = options["v"] ?: VersionChecker.letsPlotKotlinAPIVersion
private val lpJsVersion = VersionChecker.letsPlotJsVersion
private val isolatedFrame = options["isolatedFrame"] ?: ""


Expand Down Expand Up @@ -56,12 +55,12 @@ internal class Integration(private val notebook: Notebook, private val options:

onLoaded {
val isolatedFrameParam = if (isolatedFrame.isNotEmpty()) isolatedFrame.toBoolean() else null
frontendContext = LetsPlot.setupNotebook(js, isolatedFrameParam) { display(HTML(it), null) }
LetsPlot.apiVersion = api
frontendContext = LetsPlot.setupNotebook(lpJsVersion, isolatedFrameParam) { display(HTML(it), null) }
LetsPlot.apiVersion = lpkVersion
// Load library JS
display(HTML(frontendContext.getConfigureHtml()), null)
// add figure renders AFTER frontendContext initialization
addRenders(js)
addRenders(lpJsVersion)
declare("letsPlotNotebookConfig" to config)
}
}
Expand Down

0 comments on commit 09efb9b

Please sign in to comment.