diff --git a/CHANGELOG.md b/CHANGELOG.md index 61a6bbc..5982215 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## [0.1.30] - 2026-07-30 + +### Fixed + +- Keep `Annotated` validation metadata available to form construction while + presenting the compact owning type in parameter help. + ## [0.1.29] - 2026-07-30 ### Changed diff --git a/docs/conf.py b/docs/conf.py index 7a8ffd4..8dd77f8 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -11,7 +11,7 @@ copyright = "2024, Tristan Simas" author = "Tristan Simas" version = "0.1" -release = "0.1.29" +release = "0.1.30" # General configuration extensions = [ diff --git a/pyproject.toml b/pyproject.toml index 0f5f5a8..8744558 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "hatchling.build" [project] name = "pyqt-reactive" -version = "0.1.29" +version = "0.1.30" description = "React-quality reactive form generation framework for PyQt6" authors = [{name = "Tristan Simas", email = "tristan.simas@mail.mcgill.ca"}] license = {text = "MIT"} diff --git a/src/pyqt_reactive/__init__.py b/src/pyqt_reactive/__init__.py index 1c983a3..8046824 100644 --- a/src/pyqt_reactive/__init__.py +++ b/src/pyqt_reactive/__init__.py @@ -19,7 +19,7 @@ - Cross-window reactive updates """ -__version__ = "0.1.29" +__version__ = "0.1.30" # Public API will be populated as modules are added __all__ = [ diff --git a/src/pyqt_reactive/services/parameter_help_service.py b/src/pyqt_reactive/services/parameter_help_service.py index 0956079..3f3973e 100644 --- a/src/pyqt_reactive/services/parameter_help_service.py +++ b/src/pyqt_reactive/services/parameter_help_service.py @@ -12,7 +12,12 @@ from typing import Annotated, Callable, Optional, Union, get_args, get_origin from objectstate.lazy_factory import get_base_type_for_lazy, is_lazy_dataclass -from python_introspect import DocstringExtractor, DocstringInfo, UnifiedParameterAnalyzer +from python_introspect import ( + DocstringExtractor, + DocstringInfo, + UnifiedParameterAnalyzer, + resolve_annotated, +) logger = logging.getLogger(__name__) @@ -310,9 +315,10 @@ def parameter_type_display(param_type: type | None) -> str: """Return the compact type label used by parameter help.""" if param_type is None: return "" - if isinstance(param_type, type): - return f" ({param_type.__name__})" - return f" ({param_type})" + display_type = resolve_annotated(param_type) + if isinstance(display_type, type): + return f" ({display_type.__name__})" + return f" ({display_type})" def split_default_prefix(text: str) -> tuple[str, str]: diff --git a/tests/test_parameter_help_service.py b/tests/test_parameter_help_service.py index f5fb676..26f8960 100644 --- a/tests/test_parameter_help_service.py +++ b/tests/test_parameter_help_service.py @@ -1,6 +1,9 @@ """Tests for shared parameter help introspection.""" from dataclasses import dataclass +from typing import Annotated + +from pyqt_reactive.services.parameter_help_service import parameter_help_content def test_dataclass_docstring_help_falls_back_when_source_is_unavailable(monkeypatch): @@ -26,3 +29,14 @@ def raise_source_unavailable(_target): assert docstring_info.summary == "Generated-like config summary." assert docstring_info.description is None + + +def test_parameter_help_projects_annotated_owner_type_without_metadata_repr() -> None: + content = parameter_help_content( + param_name="colormap", + param_type=Annotated[str, "non-empty"], + description="Napari colormap name.", + ) + + assert content.summary == "• colormap (str)" + assert content.description == "Napari colormap name."