Skip to content

Commit cdb274f

Browse files
committed
textframe(fix): Make TextFrameExtension import conditional
why: Users without libtmux[textframe] get ImportError on capture_frame() what: - Wrap TextFrameExtension import in try/except ImportError - Only add to __all__ when syrupy is available - Core TextFrame functionality works without optional dependency
1 parent d335fc9 commit cdb274f

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/libtmux/textframe/__init__.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,13 @@
33
from __future__ import annotations
44

55
from libtmux.textframe.core import ContentOverflowError, TextFrame
6-
from libtmux.textframe.plugin import TextFrameExtension
76

8-
__all__ = ["ContentOverflowError", "TextFrame", "TextFrameExtension"]
7+
__all__ = ["ContentOverflowError", "TextFrame"]
8+
9+
# Conditionally export TextFrameExtension when syrupy is available
10+
try:
11+
from libtmux.textframe.plugin import TextFrameExtension
12+
13+
__all__.append("TextFrameExtension")
14+
except ImportError:
15+
pass

0 commit comments

Comments
 (0)