Skip to content

Commit

Permalink
Remove deprecated methods and upgrade the deprecation level and updat…
Browse files Browse the repository at this point in the history
…ed the documentation before release
  • Loading branch information
zaleslaw committed Oct 18, 2023
1 parent 9a2959b commit 669baa6
Show file tree
Hide file tree
Showing 39 changed files with 559 additions and 6,598 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ env:
ALGOLIA_INDEX_NAME: prod_DATAFRAME_HELP
ALGOLIA_KEY: ${{ secrets.ALGOLIA_KEY }}
CONFIG_JSON_PRODUCT: Dataframe
CONFIG_JSON_VERSION: '0.11'
CONFIG_JSON_VERSION: '0.12'

jobs:
build-job:
Expand Down
18 changes: 10 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,15 @@ Explore [**documentation**](https://kotlin.github.io/dataframe/overview.html) fo
plugins {
// Optional Gradle plugin for enhanced type safety and schema generation
// https://kotlin.github.io/dataframe/gradle.html
id 'org.jetbrains.kotlinx.dataframe' version '0.11.1'
id 'org.jetbrains.kotlinx.dataframe' version '0.12.0'
}
repositories {
mavenCentral()
}
dependencies {
implementation 'org.jetbrains.kotlinx:dataframe:0.11.1'
implementation 'org.jetbrains.kotlinx:dataframe:0.12.0'
}
```

Expand All @@ -49,15 +49,15 @@ dependencies {
plugins {
// Optional Gradle plugin for enhanced type safety and schema generation
// https://kotlin.github.io/dataframe/gradle.html
id("org.jetbrains.kotlinx.dataframe") version "0.11.1"
id("org.jetbrains.kotlinx.dataframe") version "0.12.0"
}

repositories {
mavenCentral()
}

dependencies {
implementation("org.jetbrains.kotlinx:dataframe:0.11.1")
implementation("org.jetbrains.kotlinx:dataframe:0.12.0")
}
```

Expand All @@ -68,11 +68,11 @@ dependencies {
plugins {
// Optional Gradle plugin for enhanced type safety and schema generation
// https://kotlin.github.io/dataframe/gradle.html
id 'org.jetbrains.kotlinx.dataframe' version '0.11.1'
id 'org.jetbrains.kotlinx.dataframe' version '0.12.0'
}
dependencies {
implementation 'org.jetbrains.kotlinx:dataframe:0.11.1'
implementation 'org.jetbrains.kotlinx:dataframe:0.12.0'
}
android {
Expand Down Expand Up @@ -116,11 +116,11 @@ tasks.withType(KotlinCompile).configureEach {
plugins {
// Optional Gradle plugin for enhanced type safety and schema generation
// https://kotlin.github.io/dataframe/gradle.html
id("org.jetbrains.kotlinx.dataframe") version "0.11.1"
id("org.jetbrains.kotlinx.dataframe") version "0.12.0"
}

dependencies {
implementation("org.jetbrains.kotlinx:dataframe:0.11.1")
implementation("org.jetbrains.kotlinx:dataframe:0.12.0")
}

android {
Expand Down Expand Up @@ -191,6 +191,8 @@ This table shows the mapping between main library component versions and minimum
| 0.10.1 | 8 | 1.8.20 | 0.11.0-358 | 3.0.0 | 11.0.0 |
| 0.11.0 | 8 | 1.8.20 | 0.11.0-358 | 3.0.0 | 11.0.0 |
| 0.11.1 | 8 | 1.8.20 | 0.11.0-358 | 3.0.0 | 11.0.0 |
| 0.12.0 | 8 | 1.9.0 | 0.11.0-358 | 3.0.0 | 11.0.0 |

## Usage example

**Create:**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1035,7 +1035,11 @@ public interface ColumnsSelectionDsl<out T> : ColumnSelectionDsl<T>, SingleColum
interface Arg
}

@Deprecated("Use colGroup() instead.", ReplaceWith("this.colGroup(name)"))
@Deprecated(
"Use colGroup() instead.",
ReplaceWith("this.colGroup(name)"),
level = DeprecationLevel.ERROR
)
public fun ColumnsContainer<*>.group(name: String): ColumnGroupReference = name.toColumnOf()

/**
Expand Down Expand Up @@ -3731,31 +3735,31 @@ public interface ColumnsSelectionDsl<out T> : ColumnSelectionDsl<T>, SingleColum
@Deprecated(
message = "dfs is deprecated, use recursively instead.",
replaceWith = ReplaceWith("this.cols(predicate).recursively(includeTopLevel = false)"),
level = DeprecationLevel.WARNING,
level = DeprecationLevel.ERROR,
)
public fun <C> ColumnSet<C>.dfs(predicate: (ColumnWithPath<*>) -> Boolean): ColumnSet<Any?> = dfsInternal(predicate)

@Deprecated(
message = "dfs is deprecated, use recursively instead.",
replaceWith = ReplaceWith("this.cols(predicate).recursively()"),
level = DeprecationLevel.WARNING,
level = DeprecationLevel.ERROR,
)
public fun SingleColumn<*>.dfs(predicate: (ColumnWithPath<*>) -> Boolean): ColumnSet<Any?> = dfsInternal(predicate)

@Deprecated(
message = "dfs is deprecated, use recursively instead.",
replaceWith = ReplaceWith("this.cols(predicate).recursively()"),
level = DeprecationLevel.WARNING,
level = DeprecationLevel.ERROR,
)
public fun String.dfs(predicate: (ColumnWithPath<*>) -> Boolean): ColumnSet<*> = toColumnAccessor().dfs(predicate)
public fun String.dfs(predicate: (ColumnWithPath<*>) -> Boolean): ColumnSet<*> = toColumnAccessor().cols(predicate).recursively()

@Deprecated(
message = "dfs is deprecated, use recursively instead.",
replaceWith = ReplaceWith("this.cols(predicate).recursively()"),
level = DeprecationLevel.WARNING,
level = DeprecationLevel.ERROR,
)
public fun <C> KProperty<C>.dfs(predicate: (ColumnWithPath<*>) -> Boolean): ColumnSet<*> =
toColumnAccessor().dfs(predicate)
toColumnAccessor().cols(predicate).recursively()

// endregion

Expand Down Expand Up @@ -3889,33 +3893,33 @@ public interface ColumnsSelectionDsl<out T> : ColumnSelectionDsl<T>, SingleColum
@Deprecated(
message = "allDfs is deprecated, use recursively instead.",
replaceWith = ReplaceWith("this.cols { includeGroups || !it.isColumnGroup() }.recursively()"),
level = DeprecationLevel.WARNING,
level = DeprecationLevel.ERROR,
)
public fun ColumnSet<*>.allDfs(includeGroups: Boolean = false): ColumnSet<Any?> =
if (includeGroups) dfs { true } else dfs { !it.isColumnGroup() }
if (includeGroups) cols { true }.recursively() else cols { !it.isColumnGroup() }.recursively()

@Deprecated(
message = "allDfs is deprecated, use recursively instead.",
replaceWith = ReplaceWith("this.cols { includeGroups || !it.isColumnGroup() }.recursively()"),
level = DeprecationLevel.WARNING,
level = DeprecationLevel.ERROR,
)
public fun SingleColumn<*>.allDfs(includeGroups: Boolean = false): ColumnSet<Any?> =
if (includeGroups) dfs { true } else dfs { !it.isColumnGroup() }
if (includeGroups) cols { true }.recursively() else cols { !it.isColumnGroup() }.recursively()

@Deprecated(
message = "allDfs is deprecated, use recursively instead.",
replaceWith = ReplaceWith("this.cols { includeGroups || !it.isColumnGroup() }.recursively()"),
level = DeprecationLevel.WARNING,
level = DeprecationLevel.ERROR,
)
public fun String.allDfs(includeGroups: Boolean = false): ColumnSet<Any?> = toColumnAccessor().allDfs(includeGroups)
public fun String.allDfs(includeGroups: Boolean = false): ColumnSet<Any?> = toColumnAccessor().cols { includeGroups || !it.isColumnGroup() }.recursively()

@Deprecated(
message = "allDfs is deprecated, use recursively instead.",
replaceWith = ReplaceWith("this.cols { includeGroups || !it.isColumnGroup() }.recursively()"),
level = DeprecationLevel.WARNING,
level = DeprecationLevel.ERROR,
)
public fun KProperty<*>.allDfs(includeGroups: Boolean = false): ColumnSet<Any?> =
toColumnAccessor().allDfs(includeGroups)
toColumnAccessor().cols { includeGroups || !it.isColumnGroup() }.recursively()

/**
* ## Recursively / Rec
Expand Down Expand Up @@ -4250,7 +4254,11 @@ public interface ColumnsSelectionDsl<out T> : ColumnSelectionDsl<T>, SingleColum
public fun <C> ColumnSet<C>.dropLast(n: Int = 1): ColumnSet<C> = transform { it.dropLast(n) }
public fun <C> ColumnSet<C>.takeLast(n: Int): ColumnSet<C> = transform { it.takeLast(n) }

@Deprecated("Use roots() instead", ReplaceWith("roots()"))
@Deprecated(
"Use roots() instead",
ReplaceWith("roots()"),
level = DeprecationLevel.ERROR,
)
public fun <C> ColumnSet<C>.top(): ColumnSet<C> = roots()

/**
Expand Down Expand Up @@ -4418,6 +4426,7 @@ public interface ColumnsSelectionDsl<out T> : ColumnSelectionDsl<T>, SingleColum
"org.jetbrains.kotlinx.dataframe.columns.recursively",
"org.jetbrains.kotlinx.dataframe.api.colsOf",
),
level = DeprecationLevel.ERROR,
)
public fun <C> String.dfsOf(type: KType, predicate: (ColumnWithPath<C>) -> Boolean = { true }): ColumnSet<*> =
toColumnAccessor().dfsOf(type, predicate)
Expand All @@ -4429,6 +4438,7 @@ public interface ColumnsSelectionDsl<out T> : ColumnSelectionDsl<T>, SingleColum
"org.jetbrains.kotlinx.dataframe.columns.recursively",
"org.jetbrains.kotlinx.dataframe.api.colsOf",
),
level = DeprecationLevel.ERROR,
)
public fun <C> KProperty<*>.dfsOf(type: KType, predicate: (ColumnWithPath<C>) -> Boolean = { true }): ColumnSet<*> =
toColumnAccessor().dfsOf(type, predicate)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,31 +167,31 @@ public fun <T> DataRow<T>.diffOrNull(expression: RowExpression<T, Float>): Float
@Deprecated(
DIFF_DEPRECATION_MESSAGE,
ReplaceWith(DIFF_REPLACE_MESSAGE, DIFF_OR_NULL_IMPORT),
DeprecationLevel.WARNING
DeprecationLevel.ERROR
)
public fun <T> DataRow<T>.diff(expression: RowExpression<T, Double>): Double? =
prev()?.let { p -> expression(this, this) - expression(p, p) }

@Deprecated(
DIFF_DEPRECATION_MESSAGE,
ReplaceWith(DIFF_REPLACE_MESSAGE, DIFF_OR_NULL_IMPORT),
DeprecationLevel.WARNING
DeprecationLevel.ERROR
)
public fun <T> DataRow<T>.diff(expression: RowExpression<T, Int>): Int? =
prev()?.let { p -> expression(this, this) - expression(p, p) }

@Deprecated(
DIFF_DEPRECATION_MESSAGE,
ReplaceWith(DIFF_REPLACE_MESSAGE, DIFF_OR_NULL_IMPORT),
DeprecationLevel.WARNING
DeprecationLevel.ERROR
)
public fun <T> DataRow<T>.diff(expression: RowExpression<T, Long>): Long? =
prev()?.let { p -> expression(this, this) - expression(p, p) }

@Deprecated(
DIFF_DEPRECATION_MESSAGE,
ReplaceWith(DIFF_REPLACE_MESSAGE, DIFF_OR_NULL_IMPORT),
DeprecationLevel.WARNING
DeprecationLevel.ERROR
)
public fun <T> DataRow<T>.diff(expression: RowExpression<T, Float>): Float? =
prev()?.let { p -> expression(this, this) - expression(p, p) }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import org.jetbrains.kotlinx.dataframe.columns.ColumnKind
import org.jetbrains.kotlinx.dataframe.columns.ColumnReference
import org.jetbrains.kotlinx.dataframe.columns.toColumnSet
import org.jetbrains.kotlinx.dataframe.documentation.*
import org.jetbrains.kotlinx.dataframe.util.ITERABLE_COLUMNS_DEPRECATION_MESSAGE
import kotlin.reflect.KProperty

// region fillNulls
Expand Down Expand Up @@ -189,17 +188,6 @@ public fun <T, C> DataFrame<T>.fillNulls(vararg columns: KProperty<C>): Update<T
public fun <T, C> DataFrame<T>.fillNulls(vararg columns: ColumnReference<C>): Update<T, C?> =
fillNulls { columns.toColumnSet() }

@Deprecated(
message = ITERABLE_COLUMNS_DEPRECATION_MESSAGE,
replaceWith = ReplaceWith(
"fillNulls { columns.toColumnSet() }",
"org.jetbrains.kotlinx.dataframe.columns.toColumnSet",
),
level = DeprecationLevel.ERROR,
)
public fun <T, C> DataFrame<T>.fillNulls(columns: Iterable<ColumnReference<C>>): Update<T, C?> =
fillNulls { columns.toColumnSet() }

// endregion

internal inline val Any?.isNaN: Boolean get() = (this is Double && isNaN()) || (this is Float && isNaN())
Expand Down Expand Up @@ -392,17 +380,6 @@ public fun <T, C> DataFrame<T>.fillNaNs(vararg columns: KProperty<C>): Update<T,
public fun <T, C> DataFrame<T>.fillNaNs(vararg columns: ColumnReference<C>): Update<T, C> =
fillNaNs { columns.toColumnSet() }

@Deprecated(
message = ITERABLE_COLUMNS_DEPRECATION_MESSAGE,
replaceWith = ReplaceWith(
"fillNaNs { columns.toColumnSet() }",
"org.jetbrains.kotlinx.dataframe.columns.toColumnSet",
),
level = DeprecationLevel.ERROR,
)
public fun <T, C> DataFrame<T>.fillNaNs(columns: Iterable<ColumnReference<C>>): Update<T, C> =
fillNaNs { columns.toColumnSet() }

// endregion

// region fillNA
Expand Down Expand Up @@ -575,17 +552,6 @@ public fun <T, C> DataFrame<T>.fillNA(vararg columns: KProperty<C>): Update<T, C
public fun <T, C> DataFrame<T>.fillNA(vararg columns: ColumnReference<C>): Update<T, C?> =
fillNA { columns.toColumnSet() }

@Deprecated(
message = ITERABLE_COLUMNS_DEPRECATION_MESSAGE,
replaceWith = ReplaceWith(
"fillNA { columns.toColumnSet() }",
"org.jetbrains.kotlinx.dataframe.columns.toColumnSet",
),
level = DeprecationLevel.ERROR,
)
public fun <T, C> DataFrame<T>.fillNA(columns: Iterable<ColumnReference<C>>): Update<T, C?> =
fillNA { columns.toColumnSet() }

// endregion

/** @param columns The [Columns selector DSL][org.jetbrains.kotlinx.dataframe.documentation.SelectingColumns.Dsl.WithExample] used to select the columns of this [DataFrame] to drop rows in. */
Expand Down Expand Up @@ -785,20 +751,6 @@ public fun <T> DataFrame<T>.dropNulls(vararg columns: String, whereAllNull: Bool
public fun <T> DataFrame<T>.dropNulls(vararg columns: AnyColumnReference, whereAllNull: Boolean = false): DataFrame<T> =
dropNulls(whereAllNull) { columns.toColumnSet() }

@Deprecated(
message = ITERABLE_COLUMNS_DEPRECATION_MESSAGE,
replaceWith = ReplaceWith(
"dropNulls(whereAllNull) { columns.toColumnSet() }",
"org.jetbrains.kotlinx.dataframe.columns.toColumnSet",
),
level = DeprecationLevel.ERROR,
)
public fun <T> DataFrame<T>.dropNulls(
columns: Iterable<AnyColumnReference>,
whereAllNull: Boolean = false,
): DataFrame<T> =
dropNulls(whereAllNull) { columns.toColumnSet() }

/**
* ## The Drop Nulls Operation
*
Expand Down Expand Up @@ -974,17 +926,6 @@ public fun <T> DataFrame<T>.dropNA(vararg columns: String, whereAllNA: Boolean =
public fun <T> DataFrame<T>.dropNA(vararg columns: AnyColumnReference, whereAllNA: Boolean = false): DataFrame<T> =
dropNA(whereAllNA) { columns.toColumnSet() }

@Deprecated(
message = ITERABLE_COLUMNS_DEPRECATION_MESSAGE,
replaceWith = ReplaceWith(
"dropNA(whereAllNA) { columns.toColumnSet() }",
"org.jetbrains.kotlinx.dataframe.columns.toColumnSet",
),
level = DeprecationLevel.ERROR,
)
public fun <T> DataFrame<T>.dropNA(columns: Iterable<AnyColumnReference>, whereAllNA: Boolean = false): DataFrame<T> =
dropNA(whereAllNA) { columns.toColumnSet() }

/**
* ## The Drop `NA` Operation
*
Expand Down Expand Up @@ -1182,20 +1123,6 @@ public fun <T> DataFrame<T>.dropNaNs(vararg columns: String, whereAllNaN: Boolea
public fun <T> DataFrame<T>.dropNaNs(vararg columns: AnyColumnReference, whereAllNaN: Boolean = false): DataFrame<T> =
dropNaNs(whereAllNaN) { columns.toColumnSet() }

@Deprecated(
message = ITERABLE_COLUMNS_DEPRECATION_MESSAGE,
replaceWith = ReplaceWith(
"dropNaNs(whereAllNaN) { columns.toColumnSet() }",
"org.jetbrains.kotlinx.dataframe.columns.toColumnSet",
),
level = DeprecationLevel.ERROR,
)
public fun <T> DataFrame<T>.dropNaNs(
columns: Iterable<AnyColumnReference>,
whereAllNaN: Boolean = false,
): DataFrame<T> =
dropNaNs(whereAllNaN) { columns.toColumnSet() }

/**
* ## The Drop `NaN` Operation
*
Expand Down
Loading

0 comments on commit 669baa6

Please sign in to comment.