Skip to content

Commit 038e9c8

Browse files
authored
Fix FFMPEG issue (#222)
* ➕ Add imageio-ffmpeg * 👽 Specify the ImageIO FFMPEG backend which should install the appropriate platform-specific binary * ⚰️ Drop FFMPEG installation during CI * ⬆️ Upgrade dependencies * 🚨 Fix mypy type errors for external library
1 parent c7a2590 commit 038e9c8

5 files changed

Lines changed: 421 additions & 312 deletions

File tree

.github/workflows/test_code.yaml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,6 @@ jobs:
3636
uses: astral-sh/setup-uv@v6
3737
with:
3838
version: "0.8.3"
39-
- name: Install ffmpeg (so matplotlib can call it)
40-
run: |
41-
sudo apt-get update && sudo apt-get install -y ffmpeg
4239
- name: Run pytest
4340
run: uv run --group dev pytest
4441
- name: Run mypy

icenet_mp/plugins.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
from icenet_mp.data_processors.filters import register_filters
44
from icenet_mp.data_processors.sources import register_sources
5+
from icenet_mp.visualisations import register_animation_backends
56
from icenet_mp.xpu import register_accelerators
67

78
logger = getLogger(__name__)
@@ -11,5 +12,6 @@ def register_plugins() -> None:
1112
"""Register all plugins."""
1213
logger.debug("Registering plugins with external libraries...")
1314
register_accelerators()
15+
register_animation_backends()
1416
register_filters()
1517
register_sources()

icenet_mp/visualisations/__init__.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,15 @@
1+
from imageio_ffmpeg import get_ffmpeg_exe
2+
from matplotlib import rcParams
3+
14
from .helpers import DEFAULT_SIC_SPEC
25
from .plotter import Plotter
36

7+
8+
def register_animation_backends() -> None:
9+
"""Register the ImageIO FFMPEG animation backend."""
10+
rcParams["animation.ffmpeg_path"] = get_ffmpeg_exe()
11+
12+
413
__all__ = [
514
"DEFAULT_SIC_SPEC",
615
"Plotter",

pyproject.toml

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,10 @@ dependencies = [
2525
"anemoi-utils>=0.4.42",
2626
"cachetools>=6.1.0",
2727
"cdsapi>=0.7.6",
28-
"eccodeslib>=2.40.0", # indirect dependency of icenet that is not automatically installed
28+
"eccodeslib>=2.40.0,<=2.45.3,!=2.42.0,!=2.43.0,!=2.44.0.2", # indirect dependency of icenet that is not automatically installed
2929
"hydra-core>=1.3.2",
3030
"icenet==0.2.7", # newer versions require netCDF4<1.6.1 which does not work on macOS 15
31+
"imageio-ffmpeg>=0.6.0",
3132
"jaxtyping>=0.3.2",
3233
"lightning>=2.5.1",
3334
"matplotlib>=3.10.3",
@@ -78,6 +79,7 @@ module = [
7879
"anemoi.utils.*",
7980
"earthkit.*",
8081
"icenet.data.sic.*",
82+
"imageio_ffmpeg.*",
8183
"zarr.*",
8284
]
8385
ignore_missing_imports = true
@@ -91,16 +93,11 @@ addopts = [
9193
testpaths = ["tests"]
9294
norecursedirs = [
9395
".git",
94-
".venv",
95-
"venv",
96-
"__pycache__",
97-
".pytest_cache",
9896
".mypy_cache",
99-
"node_modules",
100-
".idea",
97+
".pytest_cache",
98+
".ruff_cache",
99+
".venv",
101100
".vscode",
102-
"data",
103-
"raw_input_*",
104101
]
105102

106103
[tool.ruff]

0 commit comments

Comments
 (0)