Skip to content

Commit

Permalink
Fix wrong resource name for static page generation
Browse files Browse the repository at this point in the history
  • Loading branch information
altavir committed Dec 11, 2024
1 parent 0f351fc commit 90e069b
Show file tree
Hide file tree
Showing 7 changed files with 41 additions and 86 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Removed

### Fixed
- Wrong script reference for static file generation

### Security

Expand Down
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ val plotlyVersion by extra("2.29.0")

allprojects {
group = "space.kscience"
version = "0.7.1"
version = "0.7.1.1"
}

apiValidation {
Expand Down
6 changes: 3 additions & 3 deletions examples/compose-demo/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ repositories {
maven("https://jogamp.org/deployment/maven")
}

kotlin{
kotlin {
jvm()
jvmToolchain(17)
sourceSets{
jvmMain{
sourceSets {
jvmMain {
dependencies {
implementation(compose.runtime)
implementation(compose.foundation)
Expand Down
71 changes: 34 additions & 37 deletions examples/notebooks/plotlykt-server-demo.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -2,35 +2,30 @@
"cells": [
{
"cell_type": "code",
"execution_count": null,
"outputs": [],
"source": [
"import space.kscience.plotly.server.PlotlyServerIntegration\n",
"import space.kscience.plotly.server.jupyter\n",
"\n",
"val integration = PlotlyServerIntegration()\n",
"integration.getDefinitions(notebook).forEach {\n",
" USE(it)\n",
"}"
"USE(PlotlyServerIntegration())"
],
"metadata": {
"collapsed": false
}
},
"outputs": [],
"execution_count": null
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"import kotlin.math.*"
]
],
"outputs": [],
"execution_count": null
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"val x1 = (0..100).map { it.toDouble() / 100.0 }\n",
"val y1 = x1.map { sin(2.0 * PI * it) }\n",
Expand Down Expand Up @@ -67,13 +62,13 @@
" }\n",
"}\n",
"fragment"
]
],
"outputs": [],
"execution_count": null
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"Plotly.plot {\n",
" traces(trace1, trace2)\n",
Expand All @@ -83,13 +78,13 @@
" yaxis.title = \"y axis name\"\n",
" }\n",
"}"
]
],
"outputs": [],
"execution_count": null
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"val x = (0..100).map { it.toDouble() / 100.0 }\n",
"val y = x.map { sin(2.0 * PI * it) }\n",
Expand All @@ -107,13 +102,13 @@
"}\n",
"\n",
"dynamicPlot"
]
],
"outputs": [],
"execution_count": null
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"import kotlinx.coroutines.*\n",
"\n",
Expand All @@ -126,52 +121,54 @@
" trace.y.set(dynamicY)\n",
" }\n",
"}"
]
],
"outputs": [],
"execution_count": null
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"job.cancel()"
]
],
"outputs": [],
"execution_count": null
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"dynamicPlot.layout.xaxis.title = \"крокозябра\""
]
],
"outputs": [],
"execution_count": null
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"Plotly.jupyter.port = 8884"
]
],
"outputs": [],
"execution_count": null
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"Plotly.jupyter.port"
]
],
"outputs": [],
"execution_count": null
},
{
"cell_type": "code",
"execution_count": null,
"outputs": [],
"source": [],
"metadata": {
"collapsed": false
}
},
"outputs": [],
"execution_count": null
}
],
"metadata": {
Expand Down
44 changes: 0 additions & 44 deletions plotlykt-core/src/commonMain/kotlin/space/kscience/plotly/dfExt.kt
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,6 @@ import kotlin.time.toDuration
//extensions for DataForge


private fun MutableMeta.getIndexedProviders(name: Name): Map<String?, MutableMeta> {
val parent = get(name.cutLast()) ?: return emptyMap()
return parent.items.keys.filter {
it.body == name.lastOrNull()?.body
}.map {
it.index
}.associate { index ->
if (index == null) {
"" to getOrCreate(name)
} else {
index to getOrCreate(name.withIndex(index))
}
}
}

/**
* List of values delegate
*/
Expand Down Expand Up @@ -201,35 +186,6 @@ internal fun Scheme.duration(
}
}

///**
// * Infer type of value and set
// */
//public operator fun MutableMeta.set(name: String, value: Any?) {
// when (value) {
// null -> this[name] = null
// is Meta -> this[name] = value
// is Value -> set(Name.parse(name), value)
// is String -> this[name] = value.asValue()
// is Number -> this[name] = value.asValue()
// is Boolean -> this[name] = value.asValue()
// is Iterable<*> -> {
// if (value.all { it is Meta }) {
// this.setIndexed(Name.parse(name), value.map { it as Meta })
// } else {
// this[name] = value.map { Value.of(it) }.asValue()
// }
// }
// }
//}

///**
// * A patch to cover API no longer existing in DataForge
// */
//@Deprecated("Use specialized meta methods instead")
//public operator fun Scheme.set(name: String, value: Any?) {
// meta[name] = value
//}

/**
* Append the observable note to same-name-siblings and observe its changes.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import java.nio.file.Path
import java.nio.file.StandardOpenOption


internal const val PLOTLY_SCRIPT_PATH = "/js/plotly.min.js"
internal const val PLOTLY_SCRIPT_PATH = "/js/plotly-kt.js"
//const val PLOTLY_PROMISE_NAME = "promiseOfPlotly"
/**
* Check if the asset exists in given local location and put it there if it does not
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ public class PlotlyIntegration : JupyterIntegration(), PlotlyRenderer {

resources {
js("plotly-kt") {
url("https://cdn.plot.ly/plotly-2.29.1.min.js")
classPath("js/plotly-kt.js")
}
}
Expand Down

0 comments on commit 90e069b

Please sign in to comment.