Skip to content

Commit 99a053b

Browse files
committed
0.10.0 release
1 parent de534de commit 99a053b

File tree

23 files changed

+69
-362
lines changed

23 files changed

+69
-362
lines changed

CHANGELOG.md

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,26 +3,45 @@
33
## Unreleased
44

55
### Added
6+
7+
### Changed
8+
9+
### Deprecated
10+
11+
### Removed
12+
13+
### Fixed
14+
15+
### Security
16+
17+
## 0.10.0 - 2025-01-19
18+
19+
### Added
20+
621
- Coroutine exception logging in context
722
- `ObservableMutableMetaSerializer`
823
- `MutableMetaView` - a Meta wrapper that creates nodes only when its or its children are changed.
924

1025
### Changed
26+
1127
- Simplify inheritance logic in `MutableTypedMeta`
1228
- Full rework of `DataTree` and associated interfaces (`DataSource`, `DataSink`, etc.).
29+
- Filter data by type is moved from `dataforge-data` to `dataforge-workspace` to avoid reflection dependency.
1330

1431
### Deprecated
32+
1533
- MetaProvider `spec` is replaced by `readable`. `listOfSpec` replaced with `listOfReadable`
1634

1735
### Removed
36+
1837
- Remove implicit io format resolver in `IOPlugin` and `FileWorkspaceCache`. There are no guarantees that only one format is present in the contrxt for each type.
38+
- Dependencies on `atomicfu` and `kotlin.reflect` from dataforge-data to improve performance.
1939

2040
### Fixed
41+
2142
- Fixed NameToken parsing.
2243
- Top level string list meta conversion.
2344

24-
### Security
25-
2645
## 0.9.0 - 2024-06-04
2746

2847
### Added

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ In this section, we will try to cover DataForge main ideas in the form of questi
101101
102102

103103
### [dataforge-scripting](dataforge-scripting)
104+
> Scripting definition fow workspace generation
104105
>
105106
> **Maturity**: PROTOTYPE
106107

build.gradle.kts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,12 @@ subprojects {
2222
}
2323
}
2424

25+
dependencies{
26+
subprojects.forEach {
27+
dokka(it)
28+
}
29+
}
30+
2531
readme {
2632
readmeTemplate = file("docs/templates/README-TEMPLATE.md")
2733
}

dataforge-context/build.gradle.kts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,10 @@ kscience {
1313
useSerialization()
1414
commonMain {
1515
api(projects.dataforgeMeta)
16-
// api(spclibs.atomicfu)
1716
}
1817
jvmMain{
19-
api(kotlin("reflect"))
20-
api("org.slf4j:slf4j-api:1.7.30")
18+
api(spclibs.kotlin.reflect)
19+
api(spclibs.slf4j)
2120
}
2221
}
2322

dataforge-context/src/jvmMain/kotlin/space/kscience/dataforge/context/ClassLoaderPlugin.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ package space.kscience.dataforge.context
1717

1818
import java.util.*
1919
import kotlin.reflect.KClass
20-
import kotlin.reflect.full.cast
20+
import kotlin.reflect.cast
2121

2222
public class ClassLoaderPlugin(private val classLoader: ClassLoader) : AbstractPlugin() {
2323
override val tag: PluginTag = PluginTag("classLoader", PluginTag.DATAFORGE_GROUP)

dataforge-context/src/jvmMain/kotlin/space/kscience/dataforge/provider/dfType.kt

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,25 +8,30 @@ import space.kscience.dataforge.misc.DfType
88
import space.kscience.dataforge.misc.Named
99
import space.kscience.dataforge.names.Name
1010
import kotlin.reflect.KClass
11+
import kotlin.reflect.KType
1112
import kotlin.reflect.full.findAnnotation
12-
13+
import kotlin.reflect.typeOf
1314

1415
@DFExperimental
1516
public val KClass<*>.dfType: String
1617
get() = findAnnotation<DfType>()?.id ?: simpleName ?: ""
1718

19+
@DFExperimental
20+
public val KType.dfType: String
21+
get() = findAnnotation<DfType>()?.id ?: (classifier as? KClass<*>)?.simpleName ?: ""
22+
1823
/**
1924
* Provide an object with given name inferring target from its type using [DfType] annotation
2025
*/
2126
@DFExperimental
2227
public inline fun <reified T : Any> Provider.provideByType(name: String): T? {
23-
val target = T::class.dfType
28+
val target = typeOf<T>().dfType
2429
return provide(target, name)
2530
}
2631

2732
@DFExperimental
2833
public inline fun <reified T : Any> Provider.top(): Map<Name, T> {
29-
val target = T::class.dfType
34+
val target = typeOf<T>().dfType
3035
return top(target)
3136
}
3237

@@ -35,15 +40,15 @@ public inline fun <reified T : Any> Provider.top(): Map<Name, T> {
3540
*/
3641
@DFExperimental
3742
public inline fun <reified T : Any> Context.gather(inherit: Boolean = true): Map<Name, T> =
38-
gather<T>(T::class.dfType, inherit)
43+
gather<T>(typeOf<T>().dfType, inherit)
3944

4045

4146
@DFExperimental
4247
public inline fun <reified T : Any> PluginBuilder.provides(items: Map<Name, T>) {
43-
provides(T::class.dfType, items)
48+
provides(typeOf<T>().dfType, items)
4449
}
4550

4651
@DFExperimental
4752
public inline fun <reified T : Any> PluginBuilder.provides(vararg items: Named) {
48-
provides(T::class.dfType, *items)
53+
provides(typeOf<T>().dfType, *items)
4954
}

dataforge-data/build.gradle.kts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,7 @@ kscience{
99
wasm()
1010
useCoroutines()
1111
dependencies {
12-
// api(spclibs.atomicfu)
1312
api(projects.dataforgeMeta)
14-
//Remove after subtype moved to stdlib
15-
api(kotlin("reflect"))
1613
}
1714
}
1815

dataforge-data/src/commonMain/kotlin/space/kscience/dataforge/data/DataFilter.kt

Lines changed: 10 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package space.kscience.dataforge.data
33
import kotlinx.coroutines.flow.Flow
44
import kotlinx.coroutines.flow.filter
55
import space.kscience.dataforge.meta.Meta
6+
import space.kscience.dataforge.misc.DFInternal
67
import space.kscience.dataforge.names.Name
78
import space.kscience.dataforge.names.NameToken
89
import space.kscience.dataforge.names.plus
@@ -17,17 +18,6 @@ public fun interface DataFilter {
1718
}
1819
}
1920

20-
21-
//public fun DataFilter.accepts(update: DataUpdate<*>): Boolean = accepts(update.name, update.data?.meta, update.type)
22-
23-
//public fun <T, DU : DataUpdate<T>> Sequence<DU>.filterData(predicate: DataFilter): Sequence<DU> = filter { data ->
24-
// predicate.accepts(data)
25-
//}
26-
//
27-
//public fun <T, DU : DataUpdate<T>> Flow<DU>.filterData(predicate: DataFilter): Flow<DU> = filter { data ->
28-
// predicate.accepts(data)
29-
//}
30-
3121
public fun <T> DataSource<T>.filterData(
3222
dataFilter: DataFilter,
3323
): DataSource<T> = object : DataSource<T> {
@@ -58,10 +48,14 @@ public fun <T> ObservableDataSource<T>.filterData(
5848
this@filterData.read(name)?.takeIf { predicate.accepts(name, it.meta, it.type) }
5949
}
6050

61-
internal class FilteredDataTree<T>(
62-
val source: DataTree<T>,
63-
val filter: DataFilter,
64-
val branch: Name,
51+
/**
52+
* A [DataTree] filtered by branch and some criterion, possibly changing resulting type
53+
*/
54+
@DFInternal
55+
public class FilteredDataTree<T>(
56+
public val source: DataTree<T>,
57+
public val filter: DataFilter,
58+
public val branch: Name,
6559
override val dataType: KType = source.dataType,
6660
) : DataTree<T> {
6761

@@ -83,37 +77,6 @@ internal class FilteredDataTree<T>(
8377
}
8478
}
8579

86-
8780
public fun <T> DataTree<T>.filterData(
8881
predicate: DataFilter,
89-
): DataTree<T> = FilteredDataTree(this, predicate, Name.EMPTY)
90-
91-
92-
///**
93-
// * Generate a wrapper data set with a given name prefix appended to all names
94-
// */
95-
//public fun <T : Any> DataTree<T>.withNamePrefix(prefix: Name): DataSet<T> = if (prefix.isEmpty()) {
96-
// this
97-
//} else object : DataSource<T> {
98-
//
99-
// override val dataType: KType get() = this@withNamePrefix.dataType
100-
//
101-
// override val coroutineContext: CoroutineContext
102-
// get() = (this@withNamePrefix as? DataSource)?.coroutineContext ?: EmptyCoroutineContext
103-
//
104-
// override val meta: Meta get() = this@withNamePrefix.meta
105-
//
106-
//
107-
// override fun iterator(): Iterator<NamedData<T>> = iterator {
108-
// for (d in this@withNamePrefix) {
109-
// yield(d.data.named(prefix + d.name))
110-
// }
111-
// }
112-
//
113-
// override fun get(name: Name): Data<T>? =
114-
// name.removeFirstOrNull(name)?.let { this@withNamePrefix.get(it) }
115-
//
116-
// override val updates: Flow<Name> get() = this@withNamePrefix.updates.map { prefix + it }
117-
//}
118-
//
119-
82+
): FilteredDataTree<T> = FilteredDataTree(this, predicate, Name.EMPTY)

dataforge-data/src/jvmTest/kotlin/space/kscience/dataforge/data/ActionsTest.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import kotlin.time.Duration.Companion.milliseconds
1313
@OptIn(DFExperimental::class, ExperimentalCoroutinesApi::class)
1414
internal class ActionsTest {
1515
@Test
16-
fun testStaticMapAction() = runTest(timeout = 500.milliseconds) {
16+
fun testStaticMapAction() = runTest(timeout = 200.milliseconds) {
1717
val plusOne = Action.mapping<Int, Int> {
1818
result { it + 1 }
1919
}
@@ -26,11 +26,11 @@ internal class ActionsTest {
2626

2727
val result = plusOne(data)
2828

29-
assertEquals(2, result.awaitData("1").await())
29+
assertEquals(5, result.awaitData("4").await())
3030
}
3131

3232
@Test
33-
fun testDynamicMapAction() = runTest(timeout = 500.milliseconds) {
33+
fun testDynamicMapAction() = runTest(timeout = 200.milliseconds) {
3434
val plusOne = Action.mapping<Int, Int> {
3535
result { it + 1 }
3636
}
@@ -43,7 +43,7 @@ internal class ActionsTest {
4343
source.writeValue(it.toString(), it)
4444
}
4545

46-
assertEquals(2, result.awaitData("1").await())
46+
assertEquals(5, result.awaitData("4").await())
4747
}
4848

4949
}

dataforge-output/api/dataforge-output.api

Lines changed: 0 additions & 68 deletions
This file was deleted.

0 commit comments

Comments
 (0)