Skip to content

Commit

Permalink
Merge pull request '0.7.0' (!79) from dev into master
Browse files Browse the repository at this point in the history
  • Loading branch information
altavir committed Nov 26, 2023
2 parents 7fca5db + 8f7d754 commit c754dc3
Show file tree
Hide file tree
Showing 73 changed files with 975 additions and 763 deletions.
4 changes: 0 additions & 4 deletions .space.kts

This file was deleted.

46 changes: 46 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,41 @@

### Security

## 0.7.0 - 2023-11-26

### Added

- Obligatory `type: KType` and `descriptor` property for `MetaConverters`
- Added separate `Meta`, `SealedMeta` and `ObservableMutableMeta` builders.

### Changed

- Meta converter `metaToObject` returns a non-nullable type. Additional method `metaToObjectOrNull` for nullable return.
- Kotlin 1.9.20.
- Migrated from ktor-io to kotlinx-io.
- `MutableMeta` builder now returns a simplified version of meta that does not hold listeners.
- More concise names for read/write methods in IO.
- Remove unnecessary confusion with `get`/`getMeta` by removing `getMeta` from the interface.

### Deprecated

- `String.parseValue` is replaced with `Value.parse`

### Fixed

- Memory leak in SealedMeta builder

## 0.6.2 - 2023-07-29

### Changed

- Meta to Json serializer now serializes a single item with index as an array. It is important for plotly integration.
- Meta to Json serializes Meta without children a value as literal or array instead of an object with `@value` field.

## 0.6.1 - 2023-03-31

### Added

- File cache for workspace
- Smart task metadata transformation for workspace
- Add `readOnly` property to descriptors
Expand All @@ -32,6 +58,7 @@
- More fine-grained types in Action builders.

### Changed

- `Name::replaceLast` API
- `PluginFactory` no longer requires plugin class
- Collection<Named> toMap -> associateByName
Expand All @@ -53,9 +80,11 @@
- Separate interfaces for `IOReader` and `IOWriter`

### Deprecated

- Context.fetch -> Context.request

### Fixed

- `readDataDirectory` does not split names with dots
- Front matter reader does not crash on non-UTF files
- Meta file name in readMeta from directory
Expand All @@ -64,20 +93,24 @@
## 0.5.2

### Added

- Yaml plugin
- Partial fix to #53

### Fixed

- MutableMetaImpl attachment and checks
- Listeners in observable meta are replaced by lists
- JS number comparison bug.

## 0.5.0

### Added

- Experimental `listOfSpec` delegate.

### Changed

- **API breaking** Config is deprecated, use `ObservableMeta` instead.
- **API breaking** Descriptor no has a member property `defaultValue` instead of `defaultItem()` extension. It caches default value state on the first call. It is done because computing default on each call is too expensive.
- Kotlin 1.5.10
Expand All @@ -88,24 +121,28 @@
- **API breaking** Configurable`config` changed to `meta`

### Removed

- `Config`
- Public PluginManager mutability
- Tables and tables-exposed moved to the separate project `tables.kt`
- BinaryMetaFormat. Use CBOR encoding instead

### Fixed

- Proper json array index treatment.
- Proper json index for single-value array.

## 0.4.0

### Added

- LogManager plugin
- dataforge-context API dependency on SLF4j
- Context `withEnv` and `fetch` methods to manipulate plugins without changing plugins after creation.
- Split `ItemDescriptor` into builder and read-only part

### Changed

- Kotlin-logging moved from common to JVM and JS. Replaced by console for native.
- Package changed to `space.kscience`
- Scheme made observable
Expand All @@ -115,25 +152,30 @@
- Refactor loggers

### Deprecated

- Direct use of PluginManager

### Removed

- Common dependency on Kotlin-logging
- Kotlinx-io fork dependency. Replaced by Ktor-io.

### Fixed

- Scheme properties properly handle children property change.

## 0.3.0

### Added

- Yaml meta format based on yaml.kt
- `Path` builders
- Special ValueType for lists
- `copy` method to descriptors
- Multiplatform yaml meta

### Changed

- `ListValue` and `DoubleArrayValue` implement `Iterable`.
- Changed the logic of `Value::isList` to check for type instead of size
- `Meta{}` builder made inline
Expand All @@ -150,6 +192,7 @@
## 0.2.0

### Changed

- Context content resolution refactor
- Kotlin 1.4.10 (build tools 0.6.0)
- Empty query in Name is null instead of ""
Expand All @@ -159,13 +202,16 @@
- Configurable is no longer MutableItemProvider. All functionality moved to Scheme.

### Deprecated

- Context activation API
- TextRenderer

### Removed

- Functional server prototype
- `dataforge-output` module

### Fixed

- Global context CoroutineScope resolution
- Library mode compliance
11 changes: 4 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,32 +5,29 @@


### [dataforge-context](dataforge-context)
>
> Context and provider definitions
>
> **Maturity**: DEVELOPMENT
### [dataforge-data](dataforge-data)
>
>
> **Maturity**: EXPERIMENTAL
### [dataforge-io](dataforge-io)
>
> IO module
>
> **Maturity**: PROTOTYPE
> **Maturity**: EXPERIMENTAL
### [dataforge-meta](dataforge-meta)
>
> Meta definition and basic operations on meta
>
> **Maturity**: DEVELOPMENT
### [dataforge-scripting](dataforge-scripting)
>
>
> **Maturity**: PROTOTYPE
### [dataforge-workspace](dataforge-workspace)
>
>
> **Maturity**: EXPERIMENTAL
Expand Down
12 changes: 2 additions & 10 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import space.kscience.gradle.isInDevelopment
import space.kscience.gradle.useApache2Licence
import space.kscience.gradle.useSPCTeam

Expand All @@ -9,7 +8,7 @@ plugins {

allprojects {
group = "space.kscience"
version = "0.6.2"
version = "0.7.0"
}

subprojects {
Expand All @@ -31,14 +30,7 @@ ksciencePublish {
useApache2Licence()
useSPCTeam()
}
github("dataforge-core", "SciProgCentre")
space(
if (isInDevelopment) {
"https://maven.pkg.jetbrains.space/spc/p/sci/dev"
} else {
"https://maven.pkg.jetbrains.space/spc/p/sci/maven"
}
)
repository("spc","https://maven.sciprog.center/kscience")
sonatype()
}

Expand Down
17 changes: 4 additions & 13 deletions dataforge-context/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,27 +6,18 @@ Context and provider definitions

## Artifact:

The Maven coordinates of this project are `space.kscience:dataforge-context:0.6.2-dev-2`.
The Maven coordinates of this project are `space.kscience:dataforge-context:0.7.0`.

**Gradle Groovy:**
```groovy
repositories {
maven { url 'https://repo.kotlin.link' }
mavenCentral()
}
dependencies {
implementation 'space.kscience:dataforge-context:0.6.2-dev-2'
}
```
**Gradle Kotlin DSL:**
```kotlin
repositories {
maven("https://repo.kotlin.link")
//uncomment to access development builds
//maven("https://maven.pkg.jetbrains.space/spc/p/sci/dev")
mavenCentral()
}

dependencies {
implementation("space.kscience:dataforge-context:0.6.2-dev-2")
implementation("space.kscience:dataforge-context:0.7.0")
}
```
2 changes: 0 additions & 2 deletions dataforge-context/api/dataforge-context.api
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,6 @@ public final class space/kscience/dataforge/context/PluginManager : java/lang/It
public final class space/kscience/dataforge/context/PluginTag : space/kscience/dataforge/meta/MetaRepr {
public static final field Companion Lspace/kscience/dataforge/context/PluginTag$Companion;
public static final field DATAFORGE_GROUP Ljava/lang/String;
public synthetic fun <init> (ILjava/lang/String;Ljava/lang/String;Ljava/lang/String;Lkotlinx/serialization/internal/SerializationConstructorMarker;)V
public fun <init> (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V
public synthetic fun <init> (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
public final fun component1 ()Ljava/lang/String;
Expand All @@ -211,7 +210,6 @@ public final class space/kscience/dataforge/context/PluginTag : space/kscience/d
public final fun matches (Lspace/kscience/dataforge/context/PluginTag;)Z
public fun toMeta ()Lspace/kscience/dataforge/meta/Meta;
public fun toString ()Ljava/lang/String;
public static final synthetic fun write$Self (Lspace/kscience/dataforge/context/PluginTag;Lkotlinx/serialization/encoding/CompositeEncoder;Lkotlinx/serialization/descriptors/SerialDescriptor;)V
}

public final class space/kscience/dataforge/context/PluginTag$$serializer : kotlinx/serialization/internal/GeneratedSerializer {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package space.kscience.dataforge.context
import space.kscience.dataforge.context.Plugin.Companion.TARGET
import space.kscience.dataforge.meta.Meta
import space.kscience.dataforge.meta.MetaRepr
import space.kscience.dataforge.misc.DfId
import space.kscience.dataforge.misc.Named
import space.kscience.dataforge.misc.Type
import space.kscience.dataforge.names.Name
import space.kscience.dataforge.names.parseAsName
import space.kscience.dataforge.provider.Provider
Expand All @@ -18,7 +18,7 @@ import space.kscience.dataforge.provider.Provider
*
* create - configure - attach - detach - destroy
*/
@Type(TARGET)
@DfId(TARGET)
public interface Plugin : Named, ContextAware, Provider, MetaRepr {

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package space.kscience.dataforge.context

import space.kscience.dataforge.meta.Meta
import space.kscience.dataforge.misc.Type
import space.kscience.dataforge.misc.DfId

@Type(PluginFactory.TYPE)
@DfId(PluginFactory.TYPE)
public interface PluginFactory<T : Plugin> : Factory<T> {
public val tag: PluginTag

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
package space.kscience.dataforge.properties


import space.kscience.dataforge.meta.*
import space.kscience.dataforge.meta.Meta
import space.kscience.dataforge.meta.ObservableMutableMeta
import space.kscience.dataforge.meta.transformations.MetaConverter
import space.kscience.dataforge.meta.transformations.nullableMetaToObject
import space.kscience.dataforge.meta.transformations.nullableObjectToMeta
Expand All @@ -24,7 +25,7 @@ public class MetaProperty<T : Any>(

override fun onChange(owner: Any?, callback: (T?) -> Unit) {
meta.onChange(owner) { name ->
if (name.startsWith(this@MetaProperty.name)) callback(converter.nullableMetaToObject(get(name)))
if (name.startsWith(this@MetaProperty.name)) callback(converter.nullableMetaToObject(this[name]))
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,29 +4,29 @@ import space.kscience.dataforge.context.Context
import space.kscience.dataforge.context.PluginBuilder
import space.kscience.dataforge.context.gather
import space.kscience.dataforge.misc.DFExperimental
import space.kscience.dataforge.misc.DfId
import space.kscience.dataforge.misc.Named
import space.kscience.dataforge.misc.Type
import space.kscience.dataforge.names.Name
import kotlin.reflect.KClass
import kotlin.reflect.full.findAnnotation


@DFExperimental
public val KClass<*>.dfType: String
get() = findAnnotation<Type>()?.id ?: simpleName ?: ""
public val KClass<*>.dfId: String
get() = findAnnotation<DfId>()?.id ?: simpleName ?: ""

/**
* Provide an object with given name inferring target from its type using [Type] annotation
* Provide an object with given name inferring target from its type using [DfId] annotation
*/
@DFExperimental
public inline fun <reified T : Any> Provider.provideByType(name: String): T? {
val target = T::class.dfType
val target = T::class.dfId
return provide(target, name)
}

@DFExperimental
public inline fun <reified T : Any> Provider.top(): Map<Name, T> {
val target = T::class.dfType
val target = T::class.dfId
return top(target)
}

Expand All @@ -35,15 +35,15 @@ public inline fun <reified T : Any> Provider.top(): Map<Name, T> {
*/
@DFExperimental
public inline fun <reified T : Any> Context.gather(inherit: Boolean = true): Map<Name, T> =
gather<T>(T::class.dfType, inherit)
gather<T>(T::class.dfId, inherit)


@DFExperimental
public inline fun <reified T : Any> PluginBuilder.provides(items: Map<Name, T>) {
provides(T::class.dfType, items)
provides(T::class.dfId, items)
}

@DFExperimental
public inline fun <reified T : Any> PluginBuilder.provides(vararg items: Named) {
provides(T::class.dfType, *items)
provides(T::class.dfId, *items)
}
Loading

0 comments on commit c754dc3

Please sign in to comment.