Skip to content

Commit

Permalink
Merge pull request #1179 from alexarchambault/bump-ammonite
Browse files Browse the repository at this point in the history
Update Ammonite (fork) to 3.0.0-M0-45-9c598c7c
  • Loading branch information
alexarchambault authored Jul 5, 2023
2 parents b4bd8e3 + b3f6947 commit 59d5d17
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 18 deletions.
2 changes: 1 addition & 1 deletion project/deps.sc
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import mill._
import mill.scalalib._

object Versions {
def ammonite = "3.0.0-M0-41-26a93d9c"
def ammonite = "3.0.0-M0-45-9c598c7c"
def caseApp = "2.1.0-M24"
def coursier = "2.1.5"
def jsoniterScala = "2.13.5"
Expand Down
50 changes: 33 additions & 17 deletions project/jupyterserver.sc
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,35 @@ import java.nio.file._
def kernelId = "scala-debug"
def specialKernelId = "scala-special-debug"

def writeKernelJson(launcher: Path, jupyterDir: Path, kernelId: String, name: String): Unit = {
def writeKernelJson(
launcher: Path,
jupyterDir: Path,
kernelId: String,
name: String,
extraArgs: String*
): Unit = {
val launcherPath = launcher.toAbsolutePath.toString
val dir = jupyterDir.resolve(s"kernels/$kernelId")
Files.createDirectories(dir)
val kernelJson = s"""{
"language": "scala",
"display_name": "$name",
"argv": [
"$launcherPath",
"--log", "debug",
"--connection-file", "{connection_file}",
"--variable-inspector",
"--toree-magics",
"--use-notebook-coursier-logger",
"--silent-imports",
"--quiet=false",
"--use-notebook-coursier-logger"
]
}"""
val baseArgs = Seq(
launcherPath.toString,
"--log",
"debug",
"--connection-file",
"{connection_file}",
"--variable-inspector",
"--toree-magics",
"--use-notebook-coursier-logger",
"--silent-imports",
"--use-notebook-coursier-logger"
)
val kernelJson = ujson.Obj(
"language" -> ujson.Str("scala"),
"display_name" -> ujson.Str(name),
"argv" -> ujson.Arr(
(baseArgs ++ extraArgs).map(ujson.Str(_)): _*
)
).render()
Files.write(dir.resolve("kernel.json"), kernelJson.getBytes("UTF-8"))
System.err.println(s"JUPYTER_PATH=$jupyterDir")
}
Expand All @@ -34,7 +44,13 @@ def jupyterServer(
): Unit = {

writeKernelJson(launcher, jupyterDir, kernelId, "Scala (sources)")
writeKernelJson(specialLauncher, jupyterDir, specialKernelId, "Scala (special, sources)")
writeKernelJson(
specialLauncher,
jupyterDir,
specialKernelId,
"Scala (special, sources)",
"--quiet=false"
)

os.makeDir.all(os.pwd / "notebooks")
val jupyterCommand = Seq("jupyter", "lab", "--notebook-dir", "notebooks")
Expand Down

0 comments on commit 59d5d17

Please sign in to comment.