fix(session-handoff): restore Python 3.9 compatibility in scripts#32
Open
viktorkostetskyy-max wants to merge 1 commit intosoftaworks:mainfrom
Open
fix(session-handoff): restore Python 3.9 compatibility in scripts#32viktorkostetskyy-max wants to merge 1 commit intosoftaworks:mainfrom
viktorkostetskyy-max wants to merge 1 commit intosoftaworks:mainfrom
Conversation
`list_handoffs.py` and `check_staleness.py` use PEP 604 union syntax (`X | None`) which requires Python 3.10+. On macOS, the system `/usr/bin/python3` is Python 3.9.6 (Apple-shipped), causing both scripts to fail with `TypeError: unsupported operand type(s) for |: 'type' and 'NoneType'` before reaching `main()`. SKILL.md instructs users to invoke `python` / `python3`, so they hit this on a stock macOS install. Add `from __future__ import annotations` to defer annotation evaluation, restoring 3.9 compatibility without changing any signatures. Scripts use no runtime introspection of annotations (`typing.get_type_hints`, `inspect.signature(...).return_annotation` evaluation, etc.), so the behavior is unchanged on 3.10+. `create_handoff.py` and `validate_handoff.py` already worked on 3.9 because they only use PEP 585 lower-case generics (`list[str]`, `tuple[bool, str]`), which 3.9 supports. `dist/` is regenerated via `scripts/build_plugins.py` to keep source and distribution copies in sync. Tested on Python 3.9.6 (macOS system) and 3.11. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
skills/session-handoff/scripts/list_handoffs.pyandcheck_staleness.pyuse PEP 604 union syntax (X | None) in function annotations, which requires Python 3.10+. On macOS, the system/usr/bin/python3is Python 3.9.6 (Apple-shipped), so both scripts fail at import time before reachingmain():The skill's
SKILL.mdinstructs users to invokepython/python3, so they hit this on a stock macOS install with no extra toolchain.Fix
Add
from __future__ import annotationsto defer annotation evaluation. Minimal, non-invasive — no signatures change, no behavioral change on 3.10+.The scripts don't use runtime annotation introspection (no
typing.get_type_hints, noinspect.signature(...).return_annotationevaluation), so deferred annotations are safe here.create_handoff.pyandvalidate_handoff.pywere already 3.9-compatible because they only use PEP 585 lower-case generics (list[str],tuple[bool, str]), which 3.9 supports.Files changed
skills/session-handoff/scripts/list_handoffs.py(source)skills/session-handoff/scripts/check_staleness.py(source)dist/plugins/session-handoff/skills/session-handoff/scripts/list_handoffs.py(regenerated viapython3 scripts/build_plugins.py)dist/plugins/session-handoff/skills/session-handoff/scripts/check_staleness.py(same)8 insertions, 0 deletions.
Test plan
python3 --version→Python 3.9.6(macOS stock)python3 list_handoffs.py→ runs (noTypeError); prints handoff listpython3 check_staleness.py <handoff-file>→ runs; prints staleness report with FRESH/SLIGHTLY_STALE/STALE/VERY_STALE verdictpython3 create_handoff.py test→ still works (regression check)python3 validate_handoff.py <file>→ still works (regression check)dist/regenerated fromskills/viascripts/build_plugins.py— tree clean, no extra changes🤖 Generated with Claude Code