Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
1c664ab
update to 3.13
willingc Jul 14, 2025
a29a814
Fix enum by wrapping functool paritial
willingc Jul 14, 2025
7cd8290
Update black version
willingc Jul 14, 2025
a0ad469
remove commented out code
willingc Jul 14, 2025
26b9853
remove commented out code
willingc Jul 14, 2025
462ad0f
update python version in github action workflow
willingc Jul 14, 2025
608837d
fix black errors
willingc Jul 14, 2025
c6ad36c
set quote for black
willingc Jul 14, 2025
c453af1
fix ruff errors
willingc Jul 14, 2025
20b5b99
update action for imageio
willingc Jul 14, 2025
2d8d75a
Update the new test to mock properly the attribute for 3.10
willingc Jul 14, 2025
6784bec
reenable ffmpeg stuff in CI and update mock
willingc Jul 14, 2025
bec8ad5
Update wrap enum method and test
willingc Jul 14, 2025
445ad3a
skip simulation tests
willingc Jul 15, 2025
2fe8a9f
skip simulation tests correctly this time
willingc Jul 15, 2025
8b0762d
Add A004 to ruff lint ignore since we want math.pow
willingc Jul 15, 2025
b899d2a
Add comment about ruff target version
willingc Jul 15, 2025
d87d4a9
Make qt version more explicit
willingc Jul 15, 2025
55b49d4
make qt in tox more explicit
willingc Jul 15, 2025
c44fae7
Update napari_animation/_enum_compat.py
willingc Jul 21, 2025
0c7deb9
update typing
willingc Jul 21, 2025
f819f70
apply review changes
willingc Jul 21, 2025
f6516ca
capitalization is hard
willingc Jul 21, 2025
4788fe1
troubleshooting
willingc Jul 21, 2025
7b5f065
make test matrix similar to original file
willingc Jul 21, 2025
663e84d
additional tox changes back to initial state
willingc Jul 22, 2025
6ad9f0e
change caps for pyside
willingc Jul 22, 2025
b6c848c
pin pytest-qt to 4.4 for pyside
willingc Jul 22, 2025
90499db
remove mac-13 and macosintel
willingc Jul 22, 2025
43f348b
remove macos python3.10 from PySide2 CI testing
willingc Jul 22, 2025
698a339
drop pyside2 on 3.10 temporarily
willingc Jul 22, 2025
af6b3b7
stop failing fast
willingc Jul 22, 2025
b286862
remove env
willingc Jul 22, 2025
515b86d
Add in peter solution for pyside
willingc Jul 22, 2025
de5ee3d
add qt version to test name
willingc Jul 22, 2025
f95f759
Test removing the nested guard for enum member availability
willingc Jul 22, 2025
b9ae48e
Improve naming of guards for enum member
willingc Jul 22, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Improve naming of guards for enum member
  • Loading branch information
willingc committed Jul 22, 2025
commit b9ae48e894649ff73776cfbe104c0a823e4cd5bc
15 changes: 8 additions & 7 deletions napari_animation/_enum_compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,20 @@
from enum import member

# member is importable (Python 3.11+)
_HAS_ENUM_MEMBER = True
_ENUM_MEMBER_AVAILABLE = True
except ImportError:
# Python 3.10 has no member support
_HAS_ENUM_MEMBER = False
_ENUM_MEMBER_AVAILABLE = False

# Check if enum.member is required (Python 3.13+)
_NEEDS_ENUM_MEMBER = sys.version_info >= (3, 13)
_ENUM_MEMBER_REQUIRED = sys.version_info >= (3, 13)


def wrap_enum_member(value):
"""Conditionally wrap a value with enum.member if needed."""
if _NEEDS_ENUM_MEMBER:
# Needed for Python 3.11+
# Enum member is required for Python 3.13+, and available for 3.11+
if _ENUM_MEMBER_REQUIRED or _ENUM_MEMBER_AVAILABLE:
return member(value)
# python 3.10 common case
return value
# For python 3.10 and older, just return the value directly
if not _ENUM_MEMBER_AVAILABLE:
return value
12 changes: 6 additions & 6 deletions napari_animation/_tests/test_enum_compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
from functools import partial

from napari_animation._enum_compat import (
_HAS_ENUM_MEMBER,
_NEEDS_ENUM_MEMBER,
_ENUM_MEMBER_AVAILABLE,
_ENUM_MEMBER_REQUIRED,
wrap_enum_member,
)
from napari_animation.easing import Easing
Expand All @@ -17,14 +17,14 @@
def test_enum_member_detection():
"""Test that enum.member availability is correctly detected."""
if sys.version_info >= (3, 11):
assert _HAS_ENUM_MEMBER is True
assert _ENUM_MEMBER_AVAILABLE is True
else:
assert _HAS_ENUM_MEMBER is False
assert _ENUM_MEMBER_AVAILABLE is False

if sys.version_info >= (3, 13):
assert _NEEDS_ENUM_MEMBER is True
assert _ENUM_MEMBER_REQUIRED is True
else:
assert _NEEDS_ENUM_MEMBER is False
assert _ENUM_MEMBER_REQUIRED is False


def test_wrap_enum_member_basic():
Expand Down
Loading