FIX: restore Python 3.9 compatibility in tools/#22
Open
lnlscreatives71 wants to merge 1 commit into
Open
Conversation
16 tools use `X | None` union syntax in type annotations, which is evaluated at runtime on function definition and raises TypeError on Python 3.9 (PEP 604 unions require 3.10+). This broke every cloud GPU tool on import, despite CLAUDE.md and verify_setup.py advertising "Python 3.9+" support. Add `from __future__ import annotations` to each affected file so all annotations are treated as lazy strings. Verified no non-annotation 3.10+ usage (no match statements, no runtime isinstance unions), so this fully restores 3.9 support with zero behavior change. 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
16 tools in
tools/use PEP 604 union syntax (X | None) in type annotations. Because these appear on function signatures, they are evaluated at function-definition time and raiseTypeError: unsupported operand type(s) for |: 'type' and 'NoneType'on Python 3.9 (PEP 604 unions require 3.10+).This breaks every cloud GPU tool on import — e.g.
file_transfer.pyfails to import, which cascades to all R2/Modal/RunPod tooling — despiteCLAUDE.mdandverify_setup.pyboth advertising "Python 3.9+" support.Fix
Add
from __future__ import annotationsto each affected file, so all annotations are treated as lazy strings and never evaluated at runtime.Verified there is no non-annotation 3.10+ usage (no
matchstatements, no runtimeisinstance(x, A | B)unions), so this fully restores Python 3.9 support with zero behavior change.Files (16)
addmusic,cloud_gpu,config,dewatermark,file_transfer,flux2,locate_watermark,music,notebooklm_brand,qwen3_tts,redub,sadtalker,sfx,sync_timing,upscale,voiceoverTesting
🤖 Generated with Claude Code