From 9634b46c316a3d2dea34f19a6995e5da8936948f Mon Sep 17 00:00:00 2001 From: Synchon Mandal Date: Fri, 17 Jul 2026 12:24:00 +0200 Subject: [PATCH 1/4] chore: remove frozen constraint from BaseDataGrabber.types --- junifer/datagrabber/base.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/junifer/datagrabber/base.py b/junifer/datagrabber/base.py index c34fabdb5..74d266020 100644 --- a/junifer/datagrabber/base.py +++ b/junifer/datagrabber/base.py @@ -13,7 +13,7 @@ from typing import Annotated, Any import structlog from aenum import Enum as AEnum -from pydantic import BaseModel, BeforeValidator, ConfigDict, Field +from pydantic import BaseModel, BeforeValidator, ConfigDict from ..pipeline import UpdateMetaMixin from ..typing import Element, Elements @@ -62,7 +62,6 @@ class BaseDataGrabber(BaseModel, ABC, UpdateMetaMixin): types: Annotated[ DataType | list[DataType], - Field(frozen=True), BeforeValidator(ensure_list), ] datadir: Path -- 2.52.0 From 1fdc6f6631ab42a37bb92550f7fff1666b5399ba Mon Sep 17 00:00:00 2001 From: Synchon Mandal Date: Fri, 17 Jul 2026 13:23:16 +0200 Subject: [PATCH 2/4] fix: correct "on" argument type for BaseMarker --- junifer/markers/base.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/junifer/markers/base.py b/junifer/markers/base.py index be2ecba1c..e7b7541e7 100644 --- a/junifer/markers/base.py +++ b/junifer/markers/base.py @@ -6,16 +6,16 @@ from abc import ABC, abstractmethod from copy import deepcopy -from typing import Any, ClassVar +from typing import Annotated, Any, ClassVar import structlog -from pydantic import BaseModel, ConfigDict +from pydantic import BaseModel, BeforeValidator, ConfigDict from ..datagrabber import DataType from ..pipeline import PipelineStepMixin, UpdateMetaMixin from ..storage import StorageType from ..typing import MarkerInOutMappings, StorageLike -from ..utils import raise_error +from ..utils import ensure_list_or_none, raise_error __all__ = ["BaseMarker"] @@ -57,7 +57,10 @@ class BaseMarker(BaseModel, ABC, PipelineStepMixin, UpdateMetaMixin): model_config = ConfigDict(use_enum_values=True) - on: list[DataType] | None = None + on: Annotated[ + DataType | list[DataType] | None, + BeforeValidator(ensure_list_or_none), + ] = None name: str | None = None def model_post_init(self, context: Any): # noqa: D102 -- 2.52.0 From d2bc4adcbfb96b9e1511f7294c3007497a98bde0 Mon Sep 17 00:00:00 2001 From: Synchon Mandal Date: Fri, 17 Jul 2026 13:38:35 +0200 Subject: [PATCH 3/4] update: make base models not accept extra parameters --- junifer/datagrabber/base.py | 2 +- junifer/markers/base.py | 2 +- junifer/preprocess/base.py | 2 +- junifer/storage/base.py | 4 +++- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/junifer/datagrabber/base.py b/junifer/datagrabber/base.py index 74d266020..4fb3796a6 100644 --- a/junifer/datagrabber/base.py +++ b/junifer/datagrabber/base.py @@ -58,7 +58,7 @@ class BaseDataGrabber(BaseModel, ABC, UpdateMetaMixin): """ - model_config = ConfigDict(use_enum_values=True) + model_config = ConfigDict(extra="forbid", use_enum_values=True) types: Annotated[ DataType | list[DataType], diff --git a/junifer/markers/base.py b/junifer/markers/base.py index e7b7541e7..06cb48fd8 100644 --- a/junifer/markers/base.py +++ b/junifer/markers/base.py @@ -55,7 +55,7 @@ class BaseMarker(BaseModel, ABC, PipelineStepMixin, UpdateMetaMixin): _MARKER_INOUT_MAPPINGS: ClassVar[MarkerInOutMappings] - model_config = ConfigDict(use_enum_values=True) + model_config = ConfigDict(extra="forbid", use_enum_values=True) on: Annotated[ DataType | list[DataType] | None, diff --git a/junifer/preprocess/base.py b/junifer/preprocess/base.py index fd84c38a5..6c3a41e41 100644 --- a/junifer/preprocess/base.py +++ b/junifer/preprocess/base.py @@ -55,7 +55,7 @@ class BasePreprocessor(BaseModel, ABC, PipelineStepMixin, UpdateMetaMixin): _VALID_DATA_TYPES: ClassVar[Sequence[DataType]] - model_config = ConfigDict(use_enum_values=True) + model_config = ConfigDict(extra="forbid", use_enum_values=True) on: Annotated[ DataType | list[DataType] | None, diff --git a/junifer/storage/base.py b/junifer/storage/base.py index 2408cd0bf..a5c862db1 100644 --- a/junifer/storage/base.py +++ b/junifer/storage/base.py @@ -65,7 +65,9 @@ class BaseFeatureStorage(BaseModel, ABC): _STORAGE_TYPES: ClassVar[Sequence[StorageType]] - model_config = ConfigDict(frozen=True, use_enum_values=True) + model_config = ConfigDict( + extra="forbid", frozen=True, use_enum_values=True + ) uri: Path single_output: bool = True -- 2.52.0 From b16a655f29be60932d1715d5b73e9580ee40e658 Mon Sep 17 00:00:00 2001 From: Synchon Mandal Date: Fri, 17 Jul 2026 14:21:39 +0200 Subject: [PATCH 4/4] chore: add changelog 502.bugfix --- docs/changes/newsfragments/502.bugfix | 1 + 1 file changed, 1 insertion(+) create mode 100644 docs/changes/newsfragments/502.bugfix diff --git a/docs/changes/newsfragments/502.bugfix b/docs/changes/newsfragments/502.bugfix new file mode 100644 index 000000000..f88e949df --- /dev/null +++ b/docs/changes/newsfragments/502.bugfix @@ -0,0 +1 @@ +Fix type issues and update model configs for :class:`.BaseDataGrabber`, :class:`.BasePreprocessor`, :class:`.BaseMarker` and :class:`.BaseStorage` by `Synchon Mandal`_ -- 2.52.0