diff --git a/.travis.yml b/.travis.yml index 336df1a..6421a05 100644 --- a/.travis.yml +++ b/.travis.yml @@ -15,7 +15,7 @@ stages: if: (branch = master AND type = push) OR (tag IS present) jobs: include: - - scala: 2.11.8 - - scala: 2.12.1 + - scala: 2.11.12 + - scala: 2.12.6 - stage: release script: sbt ci-release diff --git a/jupyter-scala/src/main/scala/plotly/JupyterScala.scala b/almond/src/main/scala/plotly/Almond.scala similarity index 92% rename from jupyter-scala/src/main/scala/plotly/JupyterScala.scala rename to almond/src/main/scala/plotly/Almond.scala index b2a0155..ced6022 100644 --- a/jupyter-scala/src/main/scala/plotly/JupyterScala.scala +++ b/almond/src/main/scala/plotly/Almond.scala @@ -1,17 +1,16 @@ package plotly -import jupyter.api.Publish +import java.lang.{Boolean => JBoolean, Double => JDouble, Integer => JInt} -import java.lang.{ Integer => JInt, Double => JDouble, Boolean => JBoolean } +import almond.interpreter.api.OutputHandler import scala.util.Random - import plotly.element._ import plotly.layout._ -object JupyterScala { +object Almond { - def init(offline: Boolean = false)(implicit publish: Publish): Unit = { + def init(offline: Boolean = false)(implicit publish: OutputHandler): Unit = { // offline mode like in plotly-python @@ -55,7 +54,7 @@ object JupyterScala { data: Seq[Trace], layout: Layout )(implicit - publish: Publish + publish: OutputHandler ): Unit = { val baseJs = Plotly.jsSnippet(div, data, layout) @@ -75,7 +74,7 @@ object JupyterScala { layout: Layout = Layout(), div: String = "" )(implicit - publish: Publish + publish: OutputHandler ): String = { val div0 = @@ -123,7 +122,7 @@ object JupyterScala { boxmode: BoxMode = null, div: String = "" )(implicit - publish: Publish + publish: OutputHandler ): String = plot( Layout( @@ -161,9 +160,9 @@ object JupyterScala { layout: Layout, div: String )(implicit - publish: Publish + publish: OutputHandler ): String = - JupyterScala.plot(Seq(data), layout, div = div) + Almond.plot(Seq(data), layout, div = div) } implicit class DataSeqOps(val data: Seq[Trace]) extends AnyVal { @@ -196,7 +195,7 @@ object JupyterScala { boxmode: BoxMode = null, div: String = "" )(implicit - publish: Publish + publish: OutputHandler ): String = plot( Layout( @@ -234,9 +233,9 @@ object JupyterScala { layout: Layout, div: String )(implicit - publish: Publish + publish: OutputHandler ): String = - JupyterScala.plot(data, layout, div = div) + Almond.plot(data, layout, div = div) } } diff --git a/build.sbt b/build.sbt index 22d137c..cce0b94 100644 --- a/build.sbt +++ b/build.sbt @@ -132,13 +132,13 @@ lazy val tests = project ) ) -lazy val `jupyter-scala` = project +lazy val almond = project .dependsOn(coreJvm, renderJvm) .settings( shared, plotlyPrefix, libs ++= Seq( - Deps.jupyterScalaApi % "provided" + Deps.almondScalaApi % "provided" ) ) @@ -155,7 +155,7 @@ lazy val `plotly-scala` = project renderJs, demo, tests, - `jupyter-scala` + almond ) .settings( shared, diff --git a/project/Deps.scala b/project/Deps.scala index 2a88961..8d8b795 100644 --- a/project/Deps.scala +++ b/project/Deps.scala @@ -7,16 +7,15 @@ object Deps { import Def.setting - private val jupyterScalaVersion = "0.4.0" private val circeVersion = "0.9.1" + def almondScalaApi = "sh.almond" % "scala-kernel-api" % "0.1.5" cross CrossVersion.full def circeCore = setting("io.circe" %%% "circe-core" % circeVersion) def circeLiteral = setting("io.circe" %% "circe-literal" % circeVersion) def circeScalaJs = setting("io.circe" %%% "circe-scalajs" % circeVersion) def circeParser = setting("io.circe" %%% "circe-parser" % circeVersion) def jodaTime = "joda-time" % "joda-time" % "2.9.1" - def jupyterScalaApi = "org.jupyter-scala" % "scala-api" % jupyterScalaVersion cross CrossVersion.full def rhino = "org.mozilla" % "rhino" % "1.7.7.1" def shapeless = setting("com.chuusai" %%% "shapeless" % "2.3.2") def scalacheckShapeless = setting("com.github.alexarchambault" %%% "scalacheck-shapeless_1.13" % "1.1.7") diff --git a/project/Settings.scala b/project/Settings.scala index 2452cd6..9392bed 100644 --- a/project/Settings.scala +++ b/project/Settings.scala @@ -10,7 +10,7 @@ object Settings { lazy val generateCustomSources = Seq( customSourceGenerators := { - var dir = target.value + val dir = target.value val f = dir / "Properties.scala" dir.mkdirs() @@ -87,8 +87,8 @@ object Settings { sourceGenerators.in(Compile) += customSourceGenerators.taskValue ) - private val scala212 = "2.12.1" - private val scala211 = "2.11.8" + private val scala212 = "2.12.6" + private val scala211 = "2.11.12" lazy val shared = Seq( crossScalaVersions := Seq(scala212, scala211), diff --git a/project/plugins.sbt b/project/plugins.sbt index 3785dcf..ce9045b 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -2,6 +2,5 @@ addSbtPlugin("com.geirsson" % "sbt-ci-release" % "1.2.1") addSbtPlugin("org.scala-js" % "sbt-scalajs" % "0.6.23") addSbtPlugin("com.jsuereth" % "sbt-pgp" % "1.1.1") addSbtPlugin("com.typesafe" % "sbt-mima-plugin" % "0.3.0") -addSbtPlugin("com.dwijnand" % "sbt-travisci" % "1.1.1") addSbtCoursier