Skip to content

Commit

Permalink
dataforge 0.7.1
Browse files Browse the repository at this point in the history
  • Loading branch information
altavir committed Dec 5, 2023
1 parent b75bef2 commit e4a8ff3
Show file tree
Hide file tree
Showing 14 changed files with 95 additions and 36 deletions.
14 changes: 3 additions & 11 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
import space.kscience.gradle.isInDevelopment
import space.kscience.gradle.useApache2Licence
import space.kscience.gradle.useSPCTeam

plugins {
id("space.kscience.gradle.project")
}

val dataforgeVersion by extra("0.6.2")
val dataforgeVersion by extra("0.7.1")
val plotlyVersion by extra("2.24.1")

allprojects {
group = "space.kscience"
version = "0.6.0"
version = "0.6.1"
}

apiValidation {
Expand All @@ -24,14 +23,7 @@ ksciencePublish{
useApache2Licence()
useSPCTeam()
}
github("plotly.kt", "SciProgCentre")
space(
if (isInDevelopment) {
"https://maven.pkg.jetbrains.space/spc/p/sci/dev"
} else {
"https://maven.pkg.jetbrains.space/spc/p/sci/maven"
}
)
repository("spc","https://maven.sciprog.center/kscience")
sonatype("https://oss.sonatype.org")
}

Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ kotlin.mpp.stability.nowarn=true
kotlin.jupyter.add.scanner=false
kotlin.incremental.js.ir=true

toolsVersion=0.14.9-kotlin-1.8.20
toolsVersion=0.15.2-kotlin-1.9.21
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
67 changes: 67 additions & 0 deletions plotlykt-core/api/plotlykt-core.api

Large diffs are not rendered by default.

10 changes: 8 additions & 2 deletions plotlykt-core/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ plugins {
val dataforgeVersion: String by rootProject.extra
val plotlyVersion: String by rootProject.extra


kotlin{
applyDefaultHierarchyTemplate()
}

kscience {
fullStack(bundleName = "js/plotly-kt.js")
native()
Expand All @@ -15,15 +20,16 @@ kscience {
api(spclibs.kotlinx.html)
}

dependencies(jsMain) {
jsMain{
api(npm("plotly.js", plotlyVersion))
}

dependencies(nativeMain) {
nativeMain {
implementation("com.squareup.okio:okio:3.3.0")
}
}


readme {
maturity = space.kscience.gradle.Maturity.DEVELOPMENT
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import space.kscience.plotly.models.Trace
*/
@DFBuilder
public class Plot(
override val meta: ObservableMutableMeta = MutableMeta(),
override val meta: ObservableMutableMeta = ObservableMutableMeta(),
) : Configurable, MetaRepr, Described {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import kotlin.time.toDuration


private fun MutableMeta.getIndexedProviders(name: Name): Map<String?, MutableMeta> {
val parent = getMeta(name.cutLast()) ?: return emptyMap()
val parent = get(name.cutLast()) ?: return emptyMap()
return parent.items.keys.filter {
it.body == name.lastOrNull()?.body
}.map {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ import kotlinx.serialization.json.JsonArray
import kotlinx.serialization.json.jsonObject
import org.junit.jupiter.api.Test
import space.kscience.dataforge.meta.ListValue
import space.kscience.dataforge.meta.MutableMeta
import space.kscience.dataforge.meta.asObservable
import space.kscience.dataforge.meta.ObservableMutableMeta
import space.kscience.plotly.models.ShapeType
import space.kscience.plotly.models.TraceType
import kotlin.test.assertEquals
Expand All @@ -15,15 +14,15 @@ import kotlin.test.assertTrue
class PlotSerializationTest {
@Test
fun deserialization() {
val meta = MutableMeta {
val meta = ObservableMutableMeta {
"data" put {
"x" put ListValue(1, 2, 3)
"y" put ListValue(5, 6, 7)
"type" put "scatter"
}
}

val plot = Plot(meta.asObservable())
val plot = Plot(meta)
assertEquals(1, plot.data.size)
assertEquals(TraceType.scatter, plot.data[0].type)
assertEquals(1.0, plot.data[0].x.doubles[0])
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package space.kscience.plotly.models.geo

import space.kscience.dataforge.meta.*
import space.kscience.dataforge.names.asName
import space.kscience.plotly.models.Color
import space.kscience.plotly.models.Layout
import space.kscience.plotly.models.color
Expand Down Expand Up @@ -68,5 +67,5 @@ public class Geo : Scheme() {
public var Layout.geo: Geo
get() = Geo.write(meta.getOrCreate("geo"))
set(value){
meta.setMeta("geo".asName(), value.meta)
meta["geo"] = value.meta
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package space.kscience.plotly.models.geo

import space.kscience.dataforge.meta.*
import space.kscience.dataforge.names.asName
import space.kscience.plotly.Plot
import space.kscience.plotly.models.Layout

Expand Down Expand Up @@ -60,7 +59,7 @@ public fun GeoMapBox.useOpenStreetMap() {
public var Layout.mapbox: GeoMapBox
get() = GeoMapBox.write(meta.getOrCreate("mapbox"))
set(value) {
meta.setMeta("mapbox".asName(), value.meta)
meta["mapbox"] = value.meta
}

public fun Plot.openStreetMap(block: GeoMapBox.() -> Unit) {
Expand Down
4 changes: 0 additions & 4 deletions plotlykt-script/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,6 @@ plugins {
`maven-publish`
}

kscience{
application()
}

repositories {
maven("https://dl.bintray.com/kotlin/ktor/")
}
Expand Down
1 change: 1 addition & 0 deletions plotlykt-server/api/plotlykt-server.api
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ public final class space/kscience/plotly/server/PlotlyUpdateMode : java/lang/Enu
public static final field NONE Lspace/kscience/plotly/server/PlotlyUpdateMode;
public static final field PULL Lspace/kscience/plotly/server/PlotlyUpdateMode;
public static final field PUSH Lspace/kscience/plotly/server/PlotlyUpdateMode;
public static fun getEntries ()Lkotlin/enums/EnumEntries;
public static fun valueOf (Ljava/lang/String;)Lspace/kscience/plotly/server/PlotlyUpdateMode;
public static fun values ()[Lspace/kscience/plotly/server/PlotlyUpdateMode;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public class MetaChangeCollector {

public suspend fun collect(name: Name, newItem: Meta?) {
mutex.withLock {
state.setMeta(name, newItem)
state[name] = newItem
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ public class PlotlyServer internal constructor(

override val coroutineContext: CoroutineContext get() = routing.application.coroutineContext

override val meta: ObservableMutableMeta = MutableMeta()
override val meta: ObservableMutableMeta = ObservableMutableMeta()
public var updateMode: PlotlyUpdateMode by meta.enum(PlotlyUpdateMode.PUSH, key = UPDATE_MODE_KEY)
public var updateInterval: Int by meta.int(300, key = UPDATE_INTERVAL_KEY)
public var embedData: Boolean by meta.boolean(false)
Expand Down Expand Up @@ -204,11 +204,11 @@ public class PlotlyServer internal constructor(
encodedPath = origin.uri
}.build()
call.respondHtml {
val normalizedRoute = if (rootRoute.endsWith("/")) {
rootRoute
} else {
"$rootRoute/"
}
// val normalizedRoute = if (rootRoute.endsWith("/")) {
// rootRoute
// } else {
// "$rootRoute/"
// }

head {
meta {
Expand Down

0 comments on commit e4a8ff3

Please sign in to comment.