Skip to content

Commit 3709a8d

Browse files
committed
Merge branch 'master' into load-jupyter-from-core
2 parents 334a6d9 + 8531244 commit 3709a8d

File tree

193 files changed

+12326
-5869
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

193 files changed

+12326
-5869
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,6 @@
99
build
1010
.ipynb_checkpoints
1111
local.properties
12+
13+
# macOS
14+
.DS_Store

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
[![JetBrains incubator project](https://jb.gg/badges/incubator.svg)](https://confluence.jetbrains.com/display/ALL/JetBrains+on+GitHub)
33
[![Kotlin component beta stability](https://img.shields.io/badge/project-beta-kotlin.svg?colorA=555555&colorB=DB3683&label=&logo=kotlin&logoColor=ffffff&logoWidth=10)](https://kotlinlang.org/docs/components-stability.html)
44
[![Kotlin](https://img.shields.io/badge/kotlin-2.0.20-blue.svg?logo=kotlin)](http://kotlinlang.org)
5-
[![Dynamic XML Badge](https://img.shields.io/badge/dynamic/xml?url=https%3A%2F%2Frepo1.maven.org%2Fmaven2%2Forg%2Fjetbrains%2Fkotlinx%2Fdataframe%2Fmaven-metadata.xml&query=%2F%2Fversion%5Bnot%28contains%28text%28%29%2C%22dev%22%29%29%20and%20not%28text%28%29%3D%221727%22%29%20%5D%5Blast%28%29%5D&label=Release%20version)](https://search.maven.org/artifact/org.jetbrains.kotlinx/dataframe)
5+
[![Dynamic XML Badge](https://img.shields.io/badge/dynamic/xml?url=https%3A%2F%2Frepo1.maven.org%2Fmaven2%2Forg%2Fjetbrains%2Fkotlinx%2Fdataframe%2Fmaven-metadata.xml&query=%2F%2Fversion%5Bnot%28contains%28text%28%29%2C%22dev%22%29%29%5D%5Blast%28%29%5D&label=Release%20version)](https://search.maven.org/artifact/org.jetbrains.kotlinx/dataframe)
66
[![Dynamic XML Badge](https://img.shields.io/badge/dynamic/xml?url=https%3A%2F%2Frepo1.maven.org%2Fmaven2%2Forg%2Fjetbrains%2Fkotlinx%2Fdataframe%2Fmaven-metadata.xml&query=%2F%2Fversion%5Bcontains%28text%28%29%2C%22dev%22%29%5D%5Blast%28%29%5D&label=Dev%20version&color=yellow
77
)](https://search.maven.org/artifact/org.jetbrains.kotlinx/dataframe)
88
[![GitHub License](https://img.shields.io/badge/license-Apache%20License%202.0-blue.svg?style=flat)](http://www.apache.org/licenses/LICENSE-2.0)

build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ val modulesUsingJava11 = with(projects) {
158158
dataframeGeoJupyter,
159159
examples.ideaExamples.titanic,
160160
examples.ideaExamples.unsupportedDataSources,
161-
tests,
161+
samples,
162162
plugins.dataframeGradlePlugin,
163163
)
164164
}.map { it.path }

core/README.md

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,29 @@ At the moment, these integrations are still part of the `:core` module:
1010
- (deprecated) csv/tsv
1111
- html
1212

13-
### Korro code samples
13+
### KoDEx
14+
15+
The code you're working on needs to be edited in [src](src), but the KDocs are processed by
16+
[KoDEx](https://github.com/Jolanrensen/kodex) when the project is published (or the task
17+
is run manually). The generated sources with adjusted KDocs will be overwritten
18+
in [generated-sources](generated-sources).
19+
See the [KDoc Preprocessing Guide](../KDOC_PREPROCESSING.md) for more information.
20+
21+
KDocs can also be exported to HTML, for them to be reused on the website.
22+
Elements annotated with `@ExportAsHtml` will have their generated content be copied over to
23+
[docs/StardustDocs/resources/snippets/kdocs](../docs/StardustDocs/resources/snippets/kdocs).
24+
25+
### ~~Korro~~ (NOTE: This is being moved to [:samples](../samples))
26+
27+
> [Should be removed and moved to `:samples` module](https://github.com/Kotlin/dataframe/issues/898).
28+
29+
Tests in this module contain code samples used for import into documentation
30+
using [Korro](https://github.com/devcrocod/korro).
1431

15-
Code samples for the documentation website reside
16-
in [core/.../test/.../samples/api](./src/test/kotlin/org/jetbrains/kotlinx/dataframe/samples/api) (for samples that depend solely on `dataframe-core`),
17-
and [tests/.../samples/api](../tests/src/test/kotlin/org/jetbrains/kotlinx/dataframe/samples/api) (for samples can depend on other I/O modules)
18-
and they are copied over to Markdown files in [docs/StardustDocs/topics](../docs/StardustDocs/topics)
19-
by [Korro](https://github.com/devcrocod/korro).
2032

21-
### ~~Explainer dataframes~~ NOTE: This is being moved to [tests](../tests)
33+
### ~~Explainer dataframes~~ (NOTE: This is being moved to [:samples](../samples))
34+
35+
> [Should be removed and migrated to SampleHelper](https://github.com/Kotlin/dataframe/issues/898).
2236
2337
Aside from code samples, `@TransformDataFrameExpressions` annotated test functions also generate sample
2438
dataframe HTML files that can be used as iFrames on the documentation website.
@@ -31,15 +45,3 @@ retrieves the intermediate DataFrame expressions thanks to our "explainer" compi
3145
We can also generate "normal" DataFrame samples for the website. This can be done using the
3246
[OtherSamples class](./src/test/kotlin/org/jetbrains/kotlinx/dataframe/samples/api/OtherSamples.kt). Generated
3347
HTML files will be stored in [docs/StardustDocs/resources/snippets/manual](../docs/StardustDocs/resources/snippets/manual).
34-
35-
### KoDEx
36-
37-
The code you're working on needs to be edited in [src](src), but the KDocs are processed by
38-
[KoDEx](https://github.com/Jolanrensen/kodex) when the project is published (or the task
39-
is run manually). The generated sources with adjusted KDocs will be overwritten
40-
in [generated-sources](generated-sources).
41-
See the [KDoc Preprocessing Guide](../KDOC_PREPROCESSING.md) for more information.
42-
43-
KDocs can also be exported to HTML, for them to be reused on the website.
44-
Elements annotated with `@ExportAsHtml` will have their generated content be copied over to
45-
[docs/StardustDocs/resources/snippets/kdocs](../docs/StardustDocs/resources/snippets/kdocs).

core/api/core.api

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4502,6 +4502,7 @@ public final class org/jetbrains/kotlinx/dataframe/api/TypeConversionsKt {
45024502
public static final fun toColumnOf (Lorg/jetbrains/kotlinx/dataframe/columns/ColumnPath;)Lorg/jetbrains/kotlinx/dataframe/columns/ColumnAccessor;
45034503
public static final fun toDataFrame (Lorg/jetbrains/kotlinx/dataframe/DataRow;)Lorg/jetbrains/kotlinx/dataframe/DataFrame;
45044504
public static final fun toDataFrame (Lorg/jetbrains/kotlinx/dataframe/columns/BaseColumn;)Lorg/jetbrains/kotlinx/dataframe/DataFrame;
4505+
public static final fun toDataRow (Ljava/util/Map;)Lorg/jetbrains/kotlinx/dataframe/DataRow;
45054506
public static final fun toDoubleArray (Lorg/jetbrains/kotlinx/dataframe/DataColumn;)[D
45064507
public static final fun toFloatArray (Lorg/jetbrains/kotlinx/dataframe/DataColumn;)[F
45074508
public static final fun toFrameColumn (Ljava/lang/Iterable;Ljava/lang/String;)Lorg/jetbrains/kotlinx/dataframe/columns/FrameColumn;
@@ -6581,8 +6582,6 @@ public final class org/jetbrains/kotlinx/dataframe/keywords/ModifierKeywords : j
65816582
public static final field EXTERNAL Lorg/jetbrains/kotlinx/dataframe/keywords/ModifierKeywords;
65826583
public static final field FINAL Lorg/jetbrains/kotlinx/dataframe/keywords/ModifierKeywords;
65836584
public static final field FUN Lorg/jetbrains/kotlinx/dataframe/keywords/ModifierKeywords;
6584-
public static final field HEADER Lorg/jetbrains/kotlinx/dataframe/keywords/ModifierKeywords;
6585-
public static final field IMPL Lorg/jetbrains/kotlinx/dataframe/keywords/ModifierKeywords;
65866585
public static final field IN Lorg/jetbrains/kotlinx/dataframe/keywords/ModifierKeywords;
65876586
public static final field INFIX Lorg/jetbrains/kotlinx/dataframe/keywords/ModifierKeywords;
65886587
public static final field INLINE Lorg/jetbrains/kotlinx/dataframe/keywords/ModifierKeywords;
@@ -6636,8 +6635,6 @@ public final class org/jetbrains/kotlinx/dataframe/keywords/SoftKeywords : java/
66366635
public static final field FINAL Lorg/jetbrains/kotlinx/dataframe/keywords/SoftKeywords;
66376636
public static final field FINALLY Lorg/jetbrains/kotlinx/dataframe/keywords/SoftKeywords;
66386637
public static final field GET Lorg/jetbrains/kotlinx/dataframe/keywords/SoftKeywords;
6639-
public static final field HEADER Lorg/jetbrains/kotlinx/dataframe/keywords/SoftKeywords;
6640-
public static final field IMPL Lorg/jetbrains/kotlinx/dataframe/keywords/SoftKeywords;
66416638
public static final field IMPORT Lorg/jetbrains/kotlinx/dataframe/keywords/SoftKeywords;
66426639
public static final field INFIX Lorg/jetbrains/kotlinx/dataframe/keywords/SoftKeywords;
66436640
public static final field INIT Lorg/jetbrains/kotlinx/dataframe/keywords/SoftKeywords;

core/build.gradle.kts

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import nl.jolanrensen.kodex.gradle.creatingRunKodexTask
55
import org.gradle.jvm.tasks.Jar
66
import org.gradle.kotlin.dsl.withType
77
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
8-
import xyz.ronella.gradle.plugin.simple.git.task.GitTask
98

109
plugins {
1110
with(libs.plugins) {
@@ -16,7 +15,6 @@ plugins {
1615
// alias(kover)
1716
alias(ktlint)
1817
alias(kodex)
19-
alias(simpleGit)
2018
alias(buildconfig)
2119
alias(binary.compatibility.validator)
2220

@@ -152,23 +150,13 @@ val clearSamplesOutputs by tasks.registering {
152150
}
153151
}
154152

155-
val addSamplesToGit by tasks.registering(GitTask::class, fun GitTask.() {
156-
directory = file(".")
157-
command = "add"
158-
args = listOf("-A", "../docs/StardustDocs/resources/snippets")
159-
})
160-
161153
val copySamplesOutputs = tasks.register<JavaExec>("copySamplesOutputs") {
162154
group = "documentation"
163155
mainClass = "org.jetbrains.kotlinx.dataframe.explainer.SampleAggregatorKt"
164156

165157
dependsOn(clearSamplesOutputs)
166158
dependsOn(samplesTest)
167159
classpath = sourceSets.test.get().runtimeClasspath
168-
169-
doLast {
170-
addSamplesToGit.get().executeCommand()
171-
}
172160
}
173161

174162
tasks.withType<KorroTask> {

core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/ColumnReferenceApi.kt

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,26 +4,37 @@ import org.jetbrains.kotlinx.dataframe.DataColumn
44
import org.jetbrains.kotlinx.dataframe.columns.ColumnReference
55
import org.jetbrains.kotlinx.dataframe.columns.ValueColumn
66
import org.jetbrains.kotlinx.dataframe.impl.asList
7+
import org.jetbrains.kotlinx.dataframe.util.DEPRECATED_ACCESS_API
78
import kotlin.reflect.typeOf
89

910
internal val ColumnReference<*>.name: String get() = name()
1011

12+
@Suppress("DEPRECATION_ERROR")
13+
@Deprecated(DEPRECATED_ACCESS_API, level = DeprecationLevel.ERROR)
1114
public inline fun <reified T> ColumnReference<T>.withValues(vararg values: T): ValueColumn<T> =
1215
withValues(values.asIterable())
1316

17+
@Deprecated(DEPRECATED_ACCESS_API, level = DeprecationLevel.ERROR)
1418
public inline fun <reified T> ColumnReference<T>.withValues(values: Iterable<T>): ValueColumn<T> =
1519
DataColumn.createValueColumn(name(), values.asList(), typeOf<T>())
1620

21+
@Deprecated(DEPRECATED_ACCESS_API, level = DeprecationLevel.ERROR)
1722
public infix fun <C : Comparable<C>> ColumnReference<C>.gt(value: C): ColumnReference<Boolean> = map { it > value }
1823

24+
@Deprecated(DEPRECATED_ACCESS_API, level = DeprecationLevel.ERROR)
1925
public infix fun <C : Comparable<C>> ColumnReference<C>.lt(value: C): ColumnReference<Boolean> = map { it < value }
2026

27+
@Deprecated(DEPRECATED_ACCESS_API, level = DeprecationLevel.ERROR)
2128
public infix fun <C> ColumnReference<C>.eq(value: C): ColumnReference<Boolean> = map { it == value }
2229

30+
@Deprecated(DEPRECATED_ACCESS_API, level = DeprecationLevel.ERROR)
2331
public infix fun <C> ColumnReference<C>.neq(value: C): ColumnReference<Boolean> = map { it != value }
2432

33+
@Deprecated(DEPRECATED_ACCESS_API, level = DeprecationLevel.ERROR)
2534
public fun ColumnReference<String?>.length(): ColumnReference<Int> = map { it?.length ?: 0 }
2635

36+
@Deprecated(DEPRECATED_ACCESS_API, level = DeprecationLevel.ERROR)
2737
public fun ColumnReference<String?>.lowercase(): ColumnReference<String?> = map { it?.lowercase() }
2838

39+
@Deprecated(DEPRECATED_ACCESS_API, level = DeprecationLevel.ERROR)
2940
public fun ColumnReference<String?>.uppercase(): ColumnReference<String?> = map { it?.uppercase() }

core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/add.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -320,8 +320,10 @@ public class AddDsl<T>(
320320
add(dsl.columns.toColumnGroup(name))
321321
}
322322

323+
@Interpretable("AddDslAddGroup")
323324
public fun group(body: AddDsl<T>.() -> Unit): AddGroup<T> = AddGroup(body)
324325

326+
@Interpretable("AddDslAddGroupInto")
325327
public infix fun AddGroup<T>.into(groupName: String): Unit = group(groupName, body)
326328

327329
@Deprecated(DEPRECATED_ACCESS_API)

core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/any.kt

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,51 @@ package org.jetbrains.kotlinx.dataframe.api
22

33
import org.jetbrains.kotlinx.dataframe.DataColumn
44
import org.jetbrains.kotlinx.dataframe.DataFrame
5+
import org.jetbrains.kotlinx.dataframe.DataRow
56
import org.jetbrains.kotlinx.dataframe.Predicate
67
import org.jetbrains.kotlinx.dataframe.RowFilter
78
import org.jetbrains.kotlinx.dataframe.columns.values
89

910
// region DataColumn
1011

12+
/**
13+
* Returns `true` if at least one element in this [DataColumn] satisfies the given [predicate].
14+
*
15+
* This is a convenience alias that delegates to [Iterable.any] on the column's [values].
16+
*
17+
* @param predicate A lambda function that takes a value from the column
18+
* and returns `true` if it matches the condition.
19+
* @return `true` if at least one element matches the [predicate], `false` otherwise.
20+
* @see [DataColumn.all]
21+
* @see [DataColumn.filter]
22+
* @see [DataColumn.count]
23+
*/
1124
public fun <T> DataColumn<T>.any(predicate: Predicate<T>): Boolean = values.any(predicate)
1225

1326
// endregion
1427

1528
// region DataFrame
1629

30+
/**
31+
* Returns `true` if at least one row in this [DataFrame] satisfies the given [predicate].
32+
*
33+
* The [predicate] is a [RowFilter][org.jetbrains.kotlinx.dataframe.RowFilter] — a lambda that receives each [DataRow][org.jetbrains.kotlinx.dataframe.DataRow] as both `this` and `it`
34+
* and is expected to return a [Boolean] value.
35+
*
36+
* It allows you to define conditions using the row's values directly,
37+
* including through [extension properties][org.jetbrains.kotlinx.dataframe.documentation.ExtensionPropertiesAPIDocs] for convenient and type-safe access.
38+
*
39+
* ### Example
40+
* ```kotlin
41+
* // Check if there is at least one row where "age" is greater than 18
42+
* val hasAdults = df.any { age > 18 }
43+
* ```
44+
*
45+
* @param predicate A [RowFilter] lambda that takes a [DataRow] (as both `this` and `it`)
46+
* and returns `true` if the row should be considered a match.
47+
* @return `true` if at least one row satisfies the [predicate], `false` otherwise.
48+
* @see [DataFrame.all]
49+
*/
1750
public inline fun <T> DataFrame<T>.any(predicate: RowFilter<T>): Boolean = rows().any { predicate(it, it) }
1851

1952
// endregion

core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/asIterable.kt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@ import org.jetbrains.kotlinx.dataframe.DataColumn
44

55
// region DataColumn
66

7+
/**
8+
* Returns an [Iterable] over the values of this [DataColumn].
9+
*
10+
* @see [asSequence]
11+
*/
712
public fun <T> DataColumn<T>.asIterable(): Iterable<T> = values()
813

914
// endregion

0 commit comments

Comments
 (0)