From 1e73e6c9fbab365616516928731c86a8d435e2d3 Mon Sep 17 00:00:00 2001 From: Tristan Simas Date: Mon, 12 Oct 2026 03:08:29 -0400 Subject: [PATCH 1/2] 0.1.2: require ObjectState 3; read group abbreviations from its owner ObjectState 3.0.0 removes GROUP_ABBREVIATIONS_REGISTRY. The list-preview heading default is now objectstate.lazy_factory.get_group_abbreviation itself; the module's hand-written registry walk is deleted. CI installs ObjectState at its 3.0.0 release branch head through requirements-ci.txt until 3.0.0 is on PyPI. Co-Authored-By: Claude Opus 5.5 --- .github/workflows/ci.yml | 4 ++-- CHANGELOG.md | 11 ++++++++++ pyproject.toml | 2 +- requirements-ci.txt | 3 +++ src/formbridge/__init__.py | 2 +- .../strategies/preview_formatting.py | 13 +---------- tests/test_preview_formatter_registry.py | 22 +++++++++++++++++++ 7 files changed, 41 insertions(+), 16 deletions(-) create mode 100644 requirements-ci.txt diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ad82c7a..3c05d4c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -50,7 +50,7 @@ jobs: - name: Install run: | python -m pip install --upgrade pip - python -m pip install -e ".[dev]" + python -m pip install --constraint requirements-ci.txt -e ".[dev]" - name: Run tests run: pytest --cov=formbridge --cov-report=term-missing -v @@ -70,7 +70,7 @@ jobs: - name: Install run: | python -m pip install --upgrade pip - python -m pip install -e ".[dev]" + python -m pip install --constraint requirements-ci.txt -e ".[dev]" - name: Ruff run: ruff check src tests --output-format=github diff --git a/CHANGELOG.md b/CHANGELOG.md index 588f841..bee7eff 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,16 @@ # Changelog +## 0.1.2 + +Requires ObjectState 3 (`objectstate>=3.0,<4`). + +- `strategies.preview_formatting` reads a config group's abbreviation with + `objectstate.lazy_factory.get_group_abbreviation`, the one owner of that + lookup in ObjectState 3 (`GROUP_ABBREVIATIONS_REGISTRY` is removed there). + The module's own copy of the lookup is deleted; the name + `formbridge.strategies.preview_formatting.get_group_abbreviation` is now + ObjectState's function. + ## 0.1.1 Added: diff --git a/pyproject.toml b/pyproject.toml index ff435c1..73b59e4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -26,7 +26,7 @@ keywords = ["forms", "reactive", "dataclass", "ui-bridge", "headless"] dependencies = [ "docutils>=0.20", "metaclass-registry>=0.1.5", - "objectstate>=2.0,<3", + "objectstate>=3.0,<4", "psutil>=5.9", "python-introspect>=0.2.7,<0.3", "pyzmq>=22.0", diff --git a/requirements-ci.txt b/requirements-ci.txt new file mode 100644 index 0000000..462838f --- /dev/null +++ b/requirements-ci.txt @@ -0,0 +1,3 @@ +# Source candidates needed to validate this checkout before coordinated publication. +# Remove once objectstate 3.0.0 is on PyPI. +objectstate @ git+https://github.com/OpenHCSDev/ObjectState.git@abe763cbf58cbfbaa85649b1ef394a12778daca5 diff --git a/src/formbridge/__init__.py b/src/formbridge/__init__.py index d127046..088e276 100644 --- a/src/formbridge/__init__.py +++ b/src/formbridge/__init__.py @@ -4,4 +4,4 @@ nothing and loads no GUI toolkit. """ -__version__ = "0.1.1" +__version__ = "0.1.2" diff --git a/src/formbridge/strategies/preview_formatting.py b/src/formbridge/strategies/preview_formatting.py index 0df6e69..07da0f4 100644 --- a/src/formbridge/strategies/preview_formatting.py +++ b/src/formbridge/strategies/preview_formatting.py @@ -7,11 +7,11 @@ from typing import TYPE_CHECKING, TypeAlias from objectstate import DottedFieldPath, ParameterOwner +from objectstate.lazy_factory import get_group_abbreviation from formbridge.utils.preview_formatters import ( PreviewFieldFormatRequest, PreviewValueDetail, - canonical_declaration_mro, format_preview_value, ) @@ -23,17 +23,6 @@ ItemValueFormatter: TypeAlias = Callable[[object], str | None] -def get_group_abbreviation(config_type: type) -> str: - """Resolve a group abbreviation from the canonical declaration MRO.""" - from objectstate.lazy_factory import GROUP_ABBREVIATIONS_REGISTRY - - for declaration_type in canonical_declaration_mro(config_type): - abbreviation = GROUP_ABBREVIATIONS_REGISTRY.get(declaration_type) - if abbreviation is not None: - return abbreviation - return config_type.__name__.split("_", 1)[0] - - @dataclass(frozen=True, slots=True) class FormattingConfig: """List-preview presentation derived from declared fields and ObjectState. diff --git a/tests/test_preview_formatter_registry.py b/tests/test_preview_formatter_registry.py index 66f0afe..132c663 100644 --- a/tests/test_preview_formatter_registry.py +++ b/tests/test_preview_formatter_registry.py @@ -55,3 +55,25 @@ class BaseConfig: ) assert PreviewFormatterRegistry.format_field(lazy_type(), "value") == "base" + + +def test_group_heading_default_reads_the_objectstate_declaration() -> None: + from objectstate.lazy_factory import abbreviation, get_group_abbreviation + + from formbridge.strategies.preview_formatting import FormattingConfig + + @abbreviation("cfg") + @dataclass + class HeadedConfig: + value: int = 0 + + class SpecializedHeadedConfig(HeadedConfig): + pass + + lazy_type = LazyDataclassFactory.make_lazy_simple(HeadedConfig, "LazyHeadedConfig") + heading = FormattingConfig().container_abbr_func + + assert heading is get_group_abbreviation + assert heading(HeadedConfig) == "cfg" + assert heading(SpecializedHeadedConfig) == "cfg" + assert heading(lazy_type) == "cfg" From 8ce63f769fc20fb0f149f0f3748cc3739a121402 Mon Sep 17 00:00:00 2001 From: Tristan Simas Date: Mon, 12 Oct 2026 04:25:57 -0400 Subject: [PATCH 2/2] Depend on released objectstate 3.0.0 Co-Authored-By: Claude Opus 5.5 --- requirements-ci.txt | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/requirements-ci.txt b/requirements-ci.txt index 462838f..14a296b 100644 --- a/requirements-ci.txt +++ b/requirements-ci.txt @@ -1,3 +1,2 @@ # Source candidates needed to validate this checkout before coordinated publication. -# Remove once objectstate 3.0.0 is on PyPI. -objectstate @ git+https://github.com/OpenHCSDev/ObjectState.git@abe763cbf58cbfbaa85649b1ef394a12778daca5 +# Empty: every first-party dependency is released (objectstate 3.0.0).