From 2326044de9abb23ac4af0ada16861686f8b871c4 Mon Sep 17 00:00:00 2001 From: Ewen Le Bihan Date: Sun, 14 Apr 2024 13:44:14 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=96=20Release=20v1.1.0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 5 ++++ meta.go | 2 +- packages/python/ortfodb/configuration.py | 30 +++++++++++++++++++++--- packages/python/pyproject.toml | 2 +- packages/rust/Cargo.toml | 2 +- packages/rust/src/configuration.rs | 3 +++ packages/typescript/package.json | 2 +- packages/typescript/src/configuration.ts | 2 ++ schemas/configuration.schema.json | 8 ++++++- schemas/database.schema.json | 2 +- schemas/tags.schema.json | 2 +- schemas/technologies.schema.json | 2 +- 12 files changed, 51 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 690a45c..5a8ae25 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [1.1.0] - 2024-04-14 + ### Added - exporters: run custom shell commands before and after the build, and/or after each work is built. @@ -53,6 +55,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Initial release [Unreleased]: https://github.com/ortfo/db/compare/v1.0.0...HEAD +[1.1.0]: https://github.com/ortfo/db/-/releases/tag/v1.1.0 [1.0.0]: https://github.com/ortfo/db/compare/v0.3.2...v1.0.0 [0.3.2]: https://github.com/ortfo/db/compare/v0.3.1...v0.3.2 [0.3.1]: https://github.com/ortfo/db/compare/v0.3.0...v0.3.1 @@ -60,3 +63,5 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 [0.2.0]: https://github.com/ortfo/db/releases/tag/v0.2.0 [//]: # (C3-2-DKAC:GGH:Rortfo/db:Tv{t}) + +[unreleased]: https://github.com/ortfo/db/-/compare/v1.1.0...main diff --git a/meta.go b/meta.go index 34ef44c..83d1a79 100644 --- a/meta.go +++ b/meta.go @@ -1,3 +1,3 @@ package ortfodb -const Version = "1.0.0" +const Version = "1.1.0" diff --git a/packages/python/ortfodb/configuration.py b/packages/python/ortfodb/configuration.py index 0c2f0af..56b785d 100644 --- a/packages/python/ortfodb/configuration.py +++ b/packages/python/ortfodb/configuration.py @@ -1,4 +1,4 @@ -from typing import List, Any, TypeVar, Callable, Type, cast +from typing import List, Any, Dict, Optional, TypeVar, Callable, Type, cast T = TypeVar("T") @@ -24,6 +24,25 @@ def from_int(x: Any) -> int: return x +def from_dict(f: Callable[[Any], T], x: Any) -> Dict[str, T]: + assert isinstance(x, dict) + return { k: f(v) for (k, v) in x.items() } + + +def from_none(x: Any) -> Any: + assert x is None + return x + + +def from_union(fs, x): + for f in fs: + try: + return f(x) + except: + pass + assert False + + def to_class(c: Type[T], x: Any) -> dict: assert isinstance(x, c) return cast(Any, x).to_dict() @@ -163,6 +182,7 @@ def to_dict(self) -> dict: class Configuration: build_metadata_file: str + exporters: Optional[Dict[str, Dict[str, Any]]] extract_colors: ExtractColors make_gifs: MakeGifs make_thumbnails: MakeThumbnails @@ -172,8 +192,9 @@ class Configuration: tags: Tags technologies: Technologies - def __init__(self, build_metadata_file: str, extract_colors: ExtractColors, make_gifs: MakeGifs, make_thumbnails: MakeThumbnails, media: Media, projects_at: str, scattered_mode_folder: str, tags: Tags, technologies: Technologies) -> None: + def __init__(self, build_metadata_file: str, exporters: Optional[Dict[str, Dict[str, Any]]], extract_colors: ExtractColors, make_gifs: MakeGifs, make_thumbnails: MakeThumbnails, media: Media, projects_at: str, scattered_mode_folder: str, tags: Tags, technologies: Technologies) -> None: self.build_metadata_file = build_metadata_file + self.exporters = exporters self.extract_colors = extract_colors self.make_gifs = make_gifs self.make_thumbnails = make_thumbnails @@ -187,6 +208,7 @@ def __init__(self, build_metadata_file: str, extract_colors: ExtractColors, make def from_dict(obj: Any) -> 'Configuration': assert isinstance(obj, dict) build_metadata_file = from_str(obj.get("build metadata file")) + exporters = from_union([lambda x: from_dict(lambda x: from_dict(lambda x: x, x), x), from_none], obj.get("exporters")) extract_colors = ExtractColors.from_dict(obj.get("extract colors")) make_gifs = MakeGifs.from_dict(obj.get("make gifs")) make_thumbnails = MakeThumbnails.from_dict(obj.get("make thumbnails")) @@ -195,11 +217,13 @@ def from_dict(obj: Any) -> 'Configuration': scattered_mode_folder = from_str(obj.get("scattered mode folder")) tags = Tags.from_dict(obj.get("tags")) technologies = Technologies.from_dict(obj.get("technologies")) - return Configuration(build_metadata_file, extract_colors, make_gifs, make_thumbnails, media, projects_at, scattered_mode_folder, tags, technologies) + return Configuration(build_metadata_file, exporters, extract_colors, make_gifs, make_thumbnails, media, projects_at, scattered_mode_folder, tags, technologies) def to_dict(self) -> dict: result: dict = {} result["build metadata file"] = from_str(self.build_metadata_file) + if self.exporters is not None: + result["exporters"] = from_union([lambda x: from_dict(lambda x: from_dict(lambda x: x, x), x), from_none], self.exporters) result["extract colors"] = to_class(ExtractColors, self.extract_colors) result["make gifs"] = to_class(MakeGifs, self.make_gifs) result["make thumbnails"] = to_class(MakeThumbnails, self.make_thumbnails) diff --git a/packages/python/pyproject.toml b/packages/python/pyproject.toml index e614e46..26ec594 100644 --- a/packages/python/pyproject.toml +++ b/packages/python/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "ortfodb" -version = "1.0.0" +version = "1.1.0" description = "ortfodb client library" authors = ["Ewen Le Bihan "] license = "MIT" diff --git a/packages/rust/Cargo.toml b/packages/rust/Cargo.toml index 6b4d918..b63f661 100644 --- a/packages/rust/Cargo.toml +++ b/packages/rust/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "ortfodb" -version = "1.0.0" +version = "1.1.0" edition = "2021" description = "An ortfodb (https://github.com/ortfo/db) client library for Rust." license = "MIT" diff --git a/packages/rust/src/configuration.rs b/packages/rust/src/configuration.rs index eaaaa1c..ad55d94 100644 --- a/packages/rust/src/configuration.rs +++ b/packages/rust/src/configuration.rs @@ -12,12 +12,15 @@ // } use serde::{Serialize, Deserialize}; +use std::collections::HashMap; #[derive(Serialize, Deserialize)] pub struct Configuration { #[serde(rename = "build metadata file")] pub build_metadata_file: String, + pub exporters: Option>>>, + #[serde(rename = "extract colors")] pub extract_colors: ExtractColors, diff --git a/packages/typescript/package.json b/packages/typescript/package.json index c17db1c..52722a3 100644 --- a/packages/typescript/package.json +++ b/packages/typescript/package.json @@ -1,6 +1,6 @@ { "name": "@ortfo/db", - "version": "1.0.0", + "version": "1.1.0", "description": "ortfodb client library", "scripts": { "build": "tsc -p tsconfig.json --declaration --outDir dist" diff --git a/packages/typescript/src/configuration.ts b/packages/typescript/src/configuration.ts index 4f0d585..fa3eb65 100644 --- a/packages/typescript/src/configuration.ts +++ b/packages/typescript/src/configuration.ts @@ -9,6 +9,7 @@ export interface Configuration { "build metadata file": string; + exporters?: { [key: string]: { [key: string]: any } }; "extract colors": ExtractColors; "make gifs": MakeGifs; "make thumbnails": MakeThumbnails; @@ -216,6 +217,7 @@ function r(name: string) { const typeMap: any = { "Configuration": o([ { json: "build metadata file", js: "build metadata file", typ: "" }, + { json: "exporters", js: "exporters", typ: u(undefined, m(m("any"))) }, { json: "extract colors", js: "extract colors", typ: r("ExtractColors") }, { json: "make gifs", js: "make gifs", typ: r("MakeGifs") }, { json: "make thumbnails", js: "make thumbnails", typ: r("MakeThumbnails") }, diff --git a/schemas/configuration.schema.json b/schemas/configuration.schema.json index f8346b9..5b7b6c5 100644 --- a/schemas/configuration.schema.json +++ b/schemas/configuration.schema.json @@ -1,6 +1,6 @@ { "$schema": "https://json-schema.org/draft/2020-12/schema", - "$id": "https://raw.githubusercontent.com/ortfo/db/v1.0.0/schemas/configuration.schema.json", + "$id": "https://raw.githubusercontent.com/ortfo/db/v1.1.0/schemas/configuration.schema.json", "$ref": "#/$defs/Configuration", "$defs": { "Configuration": { @@ -58,6 +58,12 @@ }, "projects at": { "type": "string" + }, + "exporters": { + "additionalProperties": { + "type": "object" + }, + "type": "object" } }, "additionalProperties": false, diff --git a/schemas/database.schema.json b/schemas/database.schema.json index dd00e17..2c01af4 100644 --- a/schemas/database.schema.json +++ b/schemas/database.schema.json @@ -1,6 +1,6 @@ { "$schema": "https://json-schema.org/draft/2020-12/schema", - "$id": "https://raw.githubusercontent.com/ortfo/db/v1.0.0/schemas/database.schema.json", + "$id": "https://raw.githubusercontent.com/ortfo/db/v1.1.0/schemas/database.schema.json", "$ref": "#/$defs/Database", "$defs": { "AnalyzedWork": { diff --git a/schemas/tags.schema.json b/schemas/tags.schema.json index 55fc164..449bf7b 100644 --- a/schemas/tags.schema.json +++ b/schemas/tags.schema.json @@ -1,6 +1,6 @@ { "$schema": "https://json-schema.org/draft/2020-12/schema", - "$id": "https://raw.githubusercontent.com/ortfo/db/v1.0.0/schemas/tags.schema.json", + "$id": "https://raw.githubusercontent.com/ortfo/db/v1.1.0/schemas/tags.schema.json", "$ref": "#/$defs/tags", "$defs": { "Tag": { diff --git a/schemas/technologies.schema.json b/schemas/technologies.schema.json index a854742..b4d2fe8 100644 --- a/schemas/technologies.schema.json +++ b/schemas/technologies.schema.json @@ -1,6 +1,6 @@ { "$schema": "https://json-schema.org/draft/2020-12/schema", - "$id": "https://raw.githubusercontent.com/ortfo/db/v1.0.0/schemas/technologies.schema.json", + "$id": "https://raw.githubusercontent.com/ortfo/db/v1.1.0/schemas/technologies.schema.json", "$ref": "#/$defs/technologies", "$defs": { "Technology": {