Skip to content

Commit acaa05e

Browse files
committed
fix: Python 3.12 compatibility (lazy annotations + TypeVar defaults)
Python 3.12 (CI's embedded interpreter) evaluates type annotations eagerly, unlike 3.13+'s PEP 649 lazy defaults. Add `from __future__ import annotations` across videocode/ so self-referential and TYPE_CHECKING-only annotations don't raise NameError at import time. Also replace PEP 696 TypeVar(default=...) usages with typing_extensions.TypeVar (3 sites), and rewrite position.py's combined PEP 695+696 generic syntax (3.13+ only) to old-style Generic[T1, T2].
1 parent d588061 commit acaa05e

68 files changed

Lines changed: 99 additions & 6 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

requirements.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@ shapely
33
freetype-py
44
uharfbuzz
55
Pillow
6-
svgelements
6+
svgelements
7+
typing_extensions

videocode/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#!/usr/bin/env python3
22

3+
from __future__ import annotations
34

45
#
56
# VideoCode

videocode/color.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
#!/usr/bin/env python3
22

3+
from __future__ import annotations
4+
35
#
46
# Colors & gradients
57
#

videocode/constants.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
#!/usr/bin/env python3
22

3+
from __future__ import annotations
4+
35
#
46
# Constant
57
#

videocode/context.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#!/usr/bin/env python3
22

3+
from __future__ import annotations
34

45
from abc import abstractmethod
56
from typing import TYPE_CHECKING, Any, Callable

videocode/input/_inputs.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
#!/usr/bin/env python3
22

3+
from __future__ import annotations
4+
35
#
46
# All Inputs Types
57
#

videocode/input/interface/Group.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
#!/usr/bin/env python3
22

3+
from __future__ import annotations
34

45
from copy import copy as _shallow_copy
5-
from typing import Any, TypeVar
6+
from typing import Any
7+
from typing_extensions import TypeVar
68
from videocode.input.input import *
79
from videocode.input.interface.Interface import Interface
810
from videocode.template.effect.moveTo import groupMoveBy, groupMoveTo

videocode/input/interface/Interface.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#!/usr/bin/env python3
22

3+
from __future__ import annotations
34

45
from abc import abstractmethod
56
from typing import Any, Callable, Self

videocode/input/interface/Offset.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#!/usr/bin/env python3
22

3+
from __future__ import annotations
34

45
import math
56

videocode/input/interface/StatefulGroup.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
#!/usr/bin/env python3
22

3+
from __future__ import annotations
34

45
from copy import copy as _shallow_copy
5-
from typing import Callable, TypeVar
6+
from typing import Callable
7+
from typing_extensions import TypeVar
68
from videocode.input.input import *
79
from videocode.input.interface.Group import Group
810
from videocode.shader.vertexShader.translate import translate

0 commit comments

Comments
 (0)