Skip to content
This repository has been archived by the owner on Jan 28, 2023. It is now read-only.

Commit

Permalink
v0.18.1 release
Browse files Browse the repository at this point in the history
  • Loading branch information
holgerbrandl committed Jun 28, 2022
1 parent 29d3ce1 commit c249359
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 10 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# krangl

[ ![Download](https://img.shields.io/badge/Maven%20Central-0.18-orange) ](https://mvnrepository.com/artifact/com.github.holgerbrandl/krangl) [![Build Status](https://github.com/holgerbrandl/krangl/workflows/build/badge.svg)](https://github.com/holgerbrandl/krangl/actions?query=workflow%3Abuild) [![Gitter](https://badges.gitter.im/holgerbrandl/krangl.svg)](https://gitter.im/holgerbrandl/krangl?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
[ ![Download](https://img.shields.io/badge/Maven%20Central-0.18.1-orange) ](https://mvnrepository.com/artifact/com.github.holgerbrandl/krangl) [![Build Status](https://github.com/holgerbrandl/krangl/workflows/build/badge.svg)](https://github.com/holgerbrandl/krangl/actions?query=workflow%3Abuild) [![Gitter](https://badges.gitter.im/holgerbrandl/krangl.svg)](https://gitter.im/holgerbrandl/krangl?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)

`krangl` is a {K}otlin library for data w{rangl}ing. By implementing a grammar of data manipulation using a modern functional-style API, it allows to filter, transform, aggregate and reshape tabular data.

Expand Down Expand Up @@ -32,7 +32,7 @@ repositories {
}
dependencies {
implementation "com.github.holgerbrandl:krangl:0.18"
implementation "com.github.holgerbrandl:krangl:0.18.1"
}
```
Declaring the repository is purely optional as it is the default already.
Expand Down
8 changes: 4 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

plugins {
id "org.jetbrains.kotlin.jvm" version "1.6.20"
id "org.jetbrains.kotlin.jvm" version "1.7.0"
id "java"
id "maven-publish"
id "signing"
Expand Down Expand Up @@ -35,9 +35,9 @@ dependencies {
// implementation 'org.jetbrains.kotlinx:dataframe:0.8.0-rc-7'
// testImplementation 'org.jetbrains.kotlinx:dataframe:0.8.0-rc-7'

testImplementation group: 'junit', name: 'junit', version: '4.12'
testImplementation group: 'junit', name: 'junit', version: '4.13.1'
testImplementation('io.kotest:kotest-assertions-core:5.2.2')
testImplementation 'com.h2database:h2:2.1.210'
testImplementation 'com.h2database:h2:2.1.212'
testImplementation 'org.jetbrains.kotlin:kotlin-script-runtime:1.6.10'
}

Expand Down Expand Up @@ -100,7 +100,7 @@ test {
//http://stackoverflow.com/questions/34377367/why-is-gradle-install-replacing-my-version-with-unspecified
group 'com.github.holgerbrandl'
//version '0.16.95'
version '0.18'
version '0.18.1'



Expand Down
4 changes: 2 additions & 2 deletions docs/userguide/docs/index.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[ ![Download](https://img.shields.io/badge/Maven%20Central-0.18-orange) ](https://mvnrepository.com/artifact/com.github.holgerbrandl.krangl/krangl) [![Build Status](https://github.com/holgerbrandl/krangl/workflows/build/badge.svg)](https://github.com/holgerbrandl/krangl/actions?query=workflow%3Abuild) [![Gitter](https://badges.gitter.im/holgerbrandl/krangl.svg)](https://gitter.im/holgerbrandl/krangl?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
[ ![Download](https://img.shields.io/badge/Maven%20Central-0.18.1-orange) ](https://mvnrepository.com/artifact/com.github.holgerbrandl.krangl/krangl) [![Build Status](https://github.com/holgerbrandl/krangl/workflows/build/badge.svg)](https://github.com/holgerbrandl/krangl/actions?query=workflow%3Abuild) [![Gitter](https://badges.gitter.im/holgerbrandl/krangl.svg)](https://gitter.im/holgerbrandl/krangl?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)

This is the manual of [krangl](https://github.com/holgerbrandl/krangl).

Expand Down Expand Up @@ -40,7 +40,7 @@ repositories {
}
dependencies {
implementation "com.github.holgerbrandl:krangl:0.18"
implementation "com.github.holgerbrandl:krangl:0.18.1"
}
```
Declaring the repository is purely optional as it is the default already.
Expand Down
3 changes: 1 addition & 2 deletions src/main/kotlin/krangl/Builder.kt
Original file line number Diff line number Diff line change
Expand Up @@ -123,10 +123,9 @@ inline fun <reified T> DataFrame.unfold(
val extProperties = properties + properties.map { "get" + it.capitalize() }
val propsOrGetters = detectPropertiesByReflection<T>()


val filtMembers = propsOrGetters
// match by name
.filter { extProperties.contains(it.name) }
.filter { it.parameters.size==1 && extProperties.contains(it.name) } // discard extension functions in class body

// todo make sure that unfolded columns are not yet present in df, and warn if so and append _1, _2, ... suffix
val unfolded = filtMembers.fold(this) { df, kCallable ->
Expand Down
33 changes: 33 additions & 0 deletions src/test/kotlin/krangl/test/TypeInterfaceTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import java.io.File
import java.io.PrintStream
import java.net.URL
import java.util.*
import kotlin.time.Duration

/**
* @author Holger Brandl
Expand Down Expand Up @@ -280,6 +281,38 @@ class ValueClassTests {
}
}

class ExtensionPropertyTest {

class Something(
val foo: String,
val bar: Int?,
) {
val Duration.ticks: Double
get() = 0.0

val Int.other: Double
get() = 0.0
}


@Test
fun `it should support nullable value class properties in asDataFrame`() {
val df = dataFrameOf(
AnyCol(
"st", listOf(
Something("hey", 42),
Something("ho", null)
)
)
)

val dfUnfold = df.unfold<Something>("st")

dfUnfold.ncol shouldBe 3
dfUnfold.names shouldBe listOf("st", "bar", "foo")
}
}

internal data class CapturedOutput(val stdout: String, val stderr: String)

internal fun captureOutput(expr: () -> Any): CapturedOutput {
Expand Down

0 comments on commit c249359

Please sign in to comment.