Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Library configuration improvements #34

Merged
merged 12 commits into from
Dec 23, 2019
Merged
14 changes: 7 additions & 7 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ allprojects {
project.getProperty('installPath') :
Paths.get(System.properties['user.home'].toString(), ".ipython", "kernels", "kotlin").toAbsolutePath().toString()
ext.debugPort = 1044
ext.configFile = "config.json"
ext.debuggerConfig = "-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=$debugPort"
}

Expand All @@ -69,6 +68,7 @@ dependencies {

compile "org.apache.maven:maven-core:3.0.3"
compile 'org.slf4j:slf4j-api:1.7.25'
compile "khttp:khttp:1.0.0"
compile 'org.zeromq:jeromq:0.3.5'
compile 'com.beust:klaxon:5.2'
runtime 'org.slf4j:slf4j-simple:1.7.25'
Expand Down Expand Up @@ -117,7 +117,7 @@ void createTaskForSpecs(Boolean debug) {
} .join(File.pathSeparator)
spec = substitute(spec, "RUNTIME_CLASSPATH", libsCp)
spec = substitute(spec, "DEBUGGER_CONFIG", debug ? "\"$debuggerConfig\"," : "")
spec = substitute(spec, "LIBRARIES_PATH", "$installPath$sep$configFile")
spec = substitute(spec, "KERNEL_HOME", "$installPath")
File installDir = new File("$installPath")
if (!installDir.exists()) {
installDir.mkdirs();
Expand All @@ -138,9 +138,9 @@ static String substitute(String spec, String template, String val) {
return spec.replace("\${$template}", val.replace("\\", "\\\\"))
}

task copyLibrariesConfig(type: Copy, dependsOn: cleanInstallDir) {
from configFile
into installPath
task copyLibraries(type: Copy, dependsOn: cleanInstallDir) {
from "libraries"
into Paths.get(installPath, "libraries").toString()
}

createTaskForSpecs(true)
Expand All @@ -151,8 +151,8 @@ task installLibs(type: Copy, dependsOn: cleanInstallDir) {
from configurations.deploy
}

task install(dependsOn: [installKernel, installLibs, createSpecs, copyLibrariesConfig]) {
task install(dependsOn: [installKernel, installLibs, createSpecs, copyLibraries]) {
}

task installDebug(dependsOn: [installKernel, installLibs, createDebugSpecs, copyLibrariesConfig]) {
task installDebug(dependsOn: [installKernel, installLibs, createDebugSpecs, copyLibraries]) {
}
184 changes: 0 additions & 184 deletions config.json

This file was deleted.

2 changes: 1 addition & 1 deletion kernelspec/kernel.json.template
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"argv": [ "java", "-jar", ${DEBUGGER_CONFIG} "${KERNEL_JAR_PATH}", "{connection_file}", "-cp=${RUNTIME_CLASSPATH}", "-libs=${LIBRARIES_PATH}"],
"argv": [ "java", "-jar", ${DEBUGGER_CONFIG} "${KERNEL_JAR_PATH}", "{connection_file}", "-cp=${RUNTIME_CLASSPATH}", "-home=${KERNEL_HOME}"],
"display_name": "Kotlin",
"language": "kotlin"
}
21 changes: 21 additions & 0 deletions libraries/gral.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"arguments": [
"v=0.11"
],
"link": "https://github.com/eseifert/gral",
"dependencies": [
"de.erichseifert.gral:gral-core:$v"
],
"imports": [
"de.erichseifert.gral.data.*",
"de.erichseifert.gral.data.filters.*",
"de.erichseifert.gral.graphics.*",
"de.erichseifert.gral.plots.*",
"de.erichseifert.gral.plots.lines.*",
"de.erichseifert.gral.plots.points.*",
"de.erichseifert.gral.util.*"
],
"init": [
"fun<T: Drawable> T.show(sizeX: Double, sizeY: Double): Any {\n val writer = de.erichseifert.gral.io.plots.DrawableWriterFactory.getInstance().get(\"image/svg+xml\")\n\n val buf = java.io.ByteArrayOutputStream()\n\n writer.write(this, buf, sizeX, sizeY)\n\n return MIME(writer.mimeType to buf.toString())\n}"
]
}
12 changes: 12 additions & 0 deletions libraries/klaxon.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"arguments": [
"v=5.2"
],
"link": "https://github.com/cbeust/klaxon",
"dependencies": [
"com.beust:klaxon:$v"
],
"imports": [
"com.beust.klaxon.*"
]
}
17 changes: 17 additions & 0 deletions libraries/kmath.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"arguments": [
"v=0.1.3"
],
"link": "https://github.com/mipt-npm/kmath",
"repositories": [
"https://dl.bintray.com/mipt-npm/scientifik"
],
"dependencies": [
"scientifik:kmath-core-jvm:$v"
],
"imports": [
"scientifik.kmath.linear.*",
"scientifik.kmath.operations.*",
"scientifik.kmath.structures.*"
]
}
17 changes: 17 additions & 0 deletions libraries/koma.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"arguments": [
"v=0.12"
],
"link": "http://koma.kyonifer.com/index.html",
"repositories": [
"https://dl.bintray.com/kyonifer/maven"
],
"dependencies": [
"com.kyonifer:koma-core-ejml:$v",
"com.kyonifer:koma-plotting:$v"
],
"imports": [
"koma.*",
"koma.extensions.*"
]
}
12 changes: 12 additions & 0 deletions libraries/kotlin-statistics.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"arguments": [
"v=-SNAPSHOT"
],
"link": "https://github.com/thomasnield/kotlin-statistics",
"dependencies": [
"com.github.thomasnield:kotlin-statistics:$v"
],
"imports": [
"org.nield.kotlinstatistics.*"
]
}
21 changes: 21 additions & 0 deletions libraries/krangl.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"arguments": [
"v=-SNAPSHOT"
],
"link": "https://github.com/holgerbrandl/krangl",
"dependencies": [
"com.github.holgerbrandl:krangl:$v"
],
"imports": [
"krangl.*"
],
"init": [
"fun krangl.DataFrame.toHTML(limit: Int = 20, truncate: Int = 50) : String\n{val sb = StringBuilder()\nsb.append(\"<html><body>\")\nsb.append(\"<table><tr>\")\ncols.forEach { sb.append(\"<th style=\\\"text-align:left\\\">${it.name}</th>\") }\nsb.append(\"</tr>\")\nrows.take(limit).forEach {\n sb.append(\"<tr>\")\n it.values.map{it.toString()}.forEach { \n val truncated = if (truncate > 0 && it.length > truncate) {\n if (truncate < 4) it.substring(0, truncate)\n else it.substring(0, truncate - 3) + \"...\"\n } else {\n it\n }\n sb.append(\"\"\"<td style=\"text-align:left\" title=\"$it\">$truncated</td>\"\"\") \n }\n sb.append(\"</tr>\")\n}\nsb.append(\"</table>\")\nif(limit < rows.count())\n sb.append(\"<p>... only showing top $limit rows</p>\")\nsb.append(\"</body></html>\")\nreturn sb.toString()}"
],
"renderers": [
{
"class": "krangl.SimpleDataFrame",
"result": "HTML($it.toHTML())"
}
]
}
18 changes: 18 additions & 0 deletions libraries/kravis.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"arguments": [
"v=-SNAPSHOT"
],
"link": "https://github.com/holgerbrandl/kravis",
"dependencies": [
"com.github.holgerbrandl:kravis:$v"
],
"imports": [
"kravis.*"
],
"renderers": [
{
"class": "kravis.GGPlot",
"result": "$it.show()"
}
]
}
31 changes: 31 additions & 0 deletions libraries/lets-plot.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"arguments": [
"core=1.0.1-SNAPSHOT",
"kotlin=0.0.8-SNAPSHOT"
],
"link": "https://github.com/JetBrains/lets-plot-kotlin",
"repositories": [
"https://jetbrains.bintray.com/lets-plot-maven"
],
"dependencies": [
"org.jetbrains.lets-plot:lets-plot-common:$core",
"org.jetbrains.lets-plot:lets-plot-kotlin-api:$kotlin",
"org.jetbrains.lets-plot:kotlin-frontend-api:$kotlin",
"org.jetbrains.lets-plot:lets-plot-jfx:$core"
],
"imports": [
"jetbrains.letsPlot.*",
"jetbrains.letsPlot.geom.*",
"jetbrains.letsPlot.stat.*"
],
"init": [
"fun jetbrains.letsPlot.intern.Plot.getHtml() = jetbrains.letsPlot.intern.frontendContext.FrontendContextUtil.getHtml(this)",
"DISPLAY(HTML(jetbrains.datalore.jupyter.configureScript()))"
],
"renderers": [
{
"class": "jetbrains.letsPlot.intern.Plot",
"result": "HTML(($it as jetbrains.letsPlot.intern.Plot).getHtml())"
}
]
}
Loading