Skip to content

Configure writerside to include tables #324

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

Merged
merged 47 commits into from
Apr 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
cd0762e
prototype explainer
koperagen Mar 8, 2023
149348e
disable import-ordering because it seems to have additional requireme…
koperagen Mar 14, 2023
6effa86
process dataframe-like objects in call chains
koperagen Mar 14, 2023
3fef07e
Configure writerside to include tables
koperagen Mar 24, 2023
1605ba4
Add tables across docs
koperagen Mar 31, 2023
8352ed0
Add compiler plugin for samples transformation
koperagen Apr 5, 2023
cd7b1af
configure pipeline for updating samples in docs
koperagen Apr 6, 2023
ce4379d
refactor script
koperagen Apr 6, 2023
af2a32b
resize iframes in all possible states
koperagen Apr 6, 2023
51fb980
use custom writerside image to build docs with <dataFrame> element
koperagen Apr 6, 2023
c2866e0
traverse newly added nodes to find iframes
koperagen Apr 7, 2023
344cda3
require annotation on containing function to perform IR transformation
koperagen Apr 7, 2023
0691263
rework html for outputs and disable those that need additional work
koperagen Apr 7, 2023
45df3df
improve visualization for Update
koperagen Apr 10, 2023
9efd526
fix plugin for member functions and update outputs
koperagen Apr 10, 2023
0a9d3fc
automatically remove disabled tests from snippets
koperagen Apr 10, 2023
a33c1e3
generate html with stable ids to have nice diffs
koperagen Apr 10, 2023
72e215b
support samples with DataRow outputs
koperagen Apr 10, 2023
78a1b55
use extension properties API for summary
koperagen Apr 10, 2023
8583102
fix some samples with long statements and remove other for now
koperagen Apr 10, 2023
2d326a6
update sample
koperagen Apr 10, 2023
de41778
update style to support dark theme
koperagen Apr 10, 2023
6b18e39
cleanup js
koperagen Apr 10, 2023
00642ed
update samples and generated sources
koperagen Apr 11, 2023
f26a8c1
fix escaping
koperagen Apr 11, 2023
64ae5b6
format code
koperagen Apr 11, 2023
66ee93a
revert html escape changes
koperagen Apr 11, 2023
f28bd30
fix "split" step visualization
koperagen Apr 12, 2023
66bcb51
disable example that looks bad for now
koperagen Apr 12, 2023
97229bc
fix escaping for embedding into iframe srcdoc
koperagen Apr 12, 2023
e2921ef
disable remaining logging
koperagen Apr 12, 2023
6488b9d
fix linter and control output writing with env variable
koperagen Apr 13, 2023
843a96a
remove irrelevant code
koperagen Apr 13, 2023
5179987
update test
koperagen Apr 13, 2023
8775465
clean up
koperagen Apr 13, 2023
7f3ba71
remove unused code / potential features
koperagen Apr 13, 2023
fe6716e
stable "shuffle" test
koperagen Apr 13, 2023
d8c4bc1
rollback from korro dev for now
koperagen Apr 13, 2023
2ee3b8c
Add language references to DataFrameHtmlData
koperagen Apr 24, 2023
179f687
remove outdated code
koperagen Apr 24, 2023
791072c
remove unused code
koperagen Apr 24, 2023
67cdf05
fix some formatting issues
koperagen Apr 24, 2023
3be39fe
add linter
koperagen Apr 26, 2023
241bcd4
remove unused code
koperagen Apr 26, 2023
ed8e69c
rename test task
koperagen Apr 26, 2023
0485832
rework plugin contract
koperagen Apr 26, 2023
a19dd96
fix formatting
koperagen Apr 26, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v3
- name: Build Writerside docs using Docker
uses: JetBrains/writerside-github-action@v3
uses: ./.github/writerside-build
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
Expand Down
10 changes: 10 additions & 0 deletions .github/writerside-build/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Container image that runs your code
FROM registry.jetbrains.team/p/writerside/builder/writerside-builder:2.1.1256-p3333

# Copies your code file from your action repository to the filesystem path `/` of the container
COPY entrypoint.sh /entrypoint.sh

RUN chmod +x /entrypoint.sh

# Code file to execute when the docker container starts up (`entrypoint.sh`)
ENTRYPOINT ["/entrypoint.sh"]
6 changes: 6 additions & 0 deletions .github/writerside-build/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
name: Build Writerside docs using Docker
description: Build Writerside documentation artifacts

runs:
using: 'docker'
image: 'Dockerfile'
6 changes: 6 additions & 0 deletions .github/writerside-build/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash

set -e
/opt/builder/bin/idea.sh helpbuilderinspect -source-dir . -product $PRODUCT --runner github -output-dir artifacts/ || true
echo "Test existing of $ARTIFACT artifact"
test -e artifacts/$ARTIFACT
86 changes: 81 additions & 5 deletions core/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import com.google.devtools.ksp.gradle.KspTaskJvm
import com.google.devtools.ksp.gradle.KspTask
import nl.jolanrensen.docProcessor.defaultProcessors.*
import nl.jolanrensen.docProcessor.gradle.creatingProcessDocTask
import org.gradle.jvm.tasks.Jar
Expand Down Expand Up @@ -33,9 +34,27 @@ repositories {
maven(jupyterApiTCRepo)
}

kotlin.sourceSets {
main {
kotlin.srcDir("build/generated/ksp/main/kotlin/")
}
test {
kotlin.srcDir("build/generated/ksp/test/kotlin/")
}
}

sourceSets {
create("samples") {
kotlin.srcDir("src/test/kotlin")
}
}

dependencies {
val kotlinCompilerPluginClasspathSamples by configurations.getting

api(libs.kotlin.reflect)
implementation(libs.kotlin.stdlib)
kotlinCompilerPluginClasspathSamples(project(":plugins:expressions-converter"))
implementation(libs.kotlin.stdlib.jdk8)

api(libs.commonsCsv)
Expand All @@ -53,13 +72,69 @@ dependencies {
testImplementation(libs.jsoup)
}

kotlin.sourceSets {
main {
kotlin.srcDir("build/generated/ksp/main/kotlin/")
val samplesImplementation by configurations.getting {
extendsFrom(configurations.testImplementation.get())
}

val myKotlinCompileTask = tasks.named<org.jetbrains.kotlin.gradle.tasks.KotlinCompile>("compileSamplesKotlin") {
friendPaths.from(sourceSets["main"].output.classesDirs)
source(sourceSets["test"].kotlin)
destinationDirectory.set(file("$buildDir/classes/testWithOutputs/kotlin"))
}

tasks.withType<KspTask> {
// "test" classpath is re-used, so repeated generation should be disabled
if (name == "kspSamplesKotlin") {
dependsOn("kspTestKotlin")
enabled = false
}
test {
kotlin.srcDir("build/generated/ksp/test/kotlin/")
}

tasks.named("lintKotlinSamples") {
onlyIf { false }
}

val samplesTest = tasks.register<Test>("samplesTest") {
group = "Verification"
description = "Runs the custom tests."

dependsOn(myKotlinCompileTask)

doFirst {
delete {
delete(fileTree(File(buildDir, "dataframes")))
}
}

environment("DATAFRAME_SAVE_OUTPUTS", "")

filter {
includeTestsMatching("org.jetbrains.kotlinx.dataframe.samples.api.*")
}

ignoreFailures = true

testClassesDirs = fileTree("$buildDir/classes/testWithOutputs/kotlin")
classpath = files("$buildDir/classes/testWithOutputs/kotlin") + configurations["samplesRuntimeClasspath"] + sourceSets["main"].runtimeClasspath
}

val clearSamplesOutputs by tasks.creating {
group = "documentation"

doFirst {
delete {
delete(fileTree(File(projectDir, "../docs/StardustDocs/snippets")))
}
}
}

val copySamplesOutputs = tasks.register<JavaExec>("copySamplesOutputs") {
group = "documentation"
mainClass.set("org.jetbrains.kotlinx.dataframe.explainer.SampleAggregatorKt")

dependsOn(samplesTest)
dependsOn(clearSamplesOutputs)
classpath = sourceSets.test.get().runtimeClasspath
}

val generatedSourcesFolderName = "generated-sources"
Expand Down Expand Up @@ -175,6 +250,7 @@ kotlinter {
"filename",
"comment-spacing",
"curly-spacing",
"experimental:annotation-spacing"
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ internal fun tableJs(columns: List<ColumnDataForJs>, id: Int, rootId: Int, nrow:
}

internal var tableInSessionId = 0
internal val sessionId = (Random().nextInt() % 128) shl 24
internal var sessionId = (Random().nextInt() % 128) shl 24
internal fun nextTableId() = sessionId + (tableInSessionId++)

internal fun AnyFrame.toHtmlData(
Expand Down Expand Up @@ -217,7 +217,11 @@ public fun <T> DataFrame<T>.toHTML(
* Container for HTML page data in form of String
* Can be used to compose rendered dataframe tables with additional HTML elements
*/
public data class DataFrameHtmlData(val style: String = "", val body: String = "", val script: String = "") {
public data class DataFrameHtmlData(
@Language("css") val style: String = "",
@Language("html", prefix = "<body>", suffix = "</body>") val body: String = "",
@Language("js") val script: String = ""
) {
@Language("html")
override fun toString(): String = """
<html>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,7 @@ internal fun convertToDataFrame(dataframeLike: Any): AnyFrame =
is PivotGroupBy<*> -> dataframeLike.frames()
is ReducedPivotGroupBy<*> -> dataframeLike.values()
is SplitWithTransform<*, *, *> -> dataframeLike.into()
is Split<*, *> -> dataframeLike.toDataFrame()
is Merge<*, *, *> -> dataframeLike.into("merged")
is Gather<*, *, *, *> -> dataframeLike.into("key", "value")
is Update<*, *> -> dataframeLike.df
Expand Down
Loading