Files
53516065bf fix(grpo): import on Python 3.9, the floor 2.1.2 declares (#50)
hanzoai 2.1.2 declares requires-python >= 3.9, yet `import hanzoai` raises
TypeError on 3.9. grpo/enhanced_api_model_adapter.py annotates four returns
as `str | Tuple[str, Optional[str]]`, which 3.9 evaluates at class-body
time, and hanzoai/__init__.py imports grpo eagerly.
grpo/enhanced_semantic_extractor.py has the same shape once, behind it.

Postpone annotation evaluation in both modules. They are the only two in
the package whose PEP 604 unions reach the interpreter. Their dataclasses
never resolve annotations, so nothing else changes.

tests/test_imports.py imports every module under hanzoai. A new CI job
runs it after `pip install .` on 3.9 and 3.13, because the test job only
runs .python-version (3.12), where the annotation is valid.

Co-authored-by: Claude Opus 5 <[email protected]>
2026-09-10 21:13:34 -07:00
..
2025-03-15 03:31:14 +00:00