Skip to content
Merged
Changes from all commits
Commits
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
35 changes: 35 additions & 0 deletions matplotloom/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,38 @@
import subprocess
import shutil
import warnings

from .loom import Loom

__version__ = "0.8.1"
__all__ = ["Loom"]


def _check_ffmpeg_availability():
"""Check if ffmpeg is available on the system."""
try:
# more reliable cross-platform
if shutil.which("ffmpeg") is not None:
return True

# Fallback: try running ffmpeg with subprocess
subprocess.run(
["ffmpeg", "-version"],
capture_output=True,
check=True,
timeout=5
)
return True
except (subprocess.CalledProcessError, subprocess.TimeoutExpired, FileNotFoundError):
return False


if not _check_ffmpeg_availability():
warnings.warn(
"ffmpeg is not available on your system. "
"matplotloom requires ffmpeg to create animations. "
"Please install ffmpeg to use this library. "
"Visit https://ffmpeg.org/download.html for installation instructions.",
UserWarning,
stacklevel=2
)
Loading