From 56d9d499b75ce78ccb6501458c3812cb100ec8fd Mon Sep 17 00:00:00 2001 From: Tristan Simas Date: Sun, 11 Oct 2026 03:56:17 -0400 Subject: [PATCH 1/2] Read a class's own annotations through inspect.get_annotations Python 3.14 (PEP 649) no longer stores class annotations in cls.__dict__['__annotations__']. get_inherited_field_names therefore treated every redeclared parent field as inherited and rebuilt the class with None defaults, so @global_pipeline_config returned a new class whose identity no longer matched the one its module exported (OpenHCS: 'analysis_consolidation_config must be AnalysisConsolidationConfig; got AnalysisConsolidationConfig' on 3.14). Field abbreviations were lost on 3.14 for the same reason. Co-Authored-By: Claude Opus 5.5 --- src/objectstate/lazy_factory.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/objectstate/lazy_factory.py b/src/objectstate/lazy_factory.py index 8923b35..e45675e 100644 --- a/src/objectstate/lazy_factory.py +++ b/src/objectstate/lazy_factory.py @@ -3,6 +3,7 @@ # Standard library imports import copy import dataclasses +import inspect import logging import re import sys @@ -91,10 +92,9 @@ def get_inherited_field_names(cls: Type) -> set: if dataclasses.is_dataclass(base): parent_fields.update(base.__dataclass_fields__.keys()) - # Get cls's OWN annotations (not inherited) - check __dict__ not getattr - own_defined = set() - if '__annotations__' in cls.__dict__: - own_defined = set(cls.__dict__['__annotations__'].keys()) + # cls's OWN annotations (not inherited). Python 3.14 (PEP 649) no longer + # stores them in cls.__dict__['__annotations__']. + own_defined = set(inspect.get_annotations(cls, eval_str=False)) return parent_fields - own_defined @@ -1455,7 +1455,7 @@ def _extract_abbreviations_from_annotations(cls: Type) -> Dict[str, str]: continue # Get this class's own annotations (not inherited) - annotations = klass.__dict__.get('__annotations__', {}) + annotations = inspect.get_annotations(klass, eval_str=False) for field_name, field_type in annotations.items(): # Check if this is an Annotated type From a44b90b08afab86b9d142fe59f9fa01cd61beab4 Mon Sep 17 00:00:00 2001 From: Tristan Simas Date: Sun, 11 Oct 2026 12:11:58 -0400 Subject: [PATCH 2/2] 2.1.1: release the Python 3.14 own-annotations fix Co-Authored-By: Claude Opus 5.5 --- src/objectstate/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/objectstate/__init__.py b/src/objectstate/__init__.py index 09e0838..44961bd 100644 --- a/src/objectstate/__init__.py +++ b/src/objectstate/__init__.py @@ -212,7 +212,7 @@ 'ObjectStateEditSession', ] -__version__ = "2.1.0" +__version__ = "2.1.1" __author__ = 'OpenHCS Team' __description__ = 'Generic configuration framework for lazy dataclass resolution'