diff --git a/CHANGELOG.md b/CHANGELOG.md index 6d77f86..2694f69 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -65,6 +65,10 @@ Merged since v2.5.0, not yet released. the wheel. ([#154]) - Free-threaded (`cp314t`) wheels are no longer published, because the core is not yet thread-safe; CPython 3.14 is declared supported. ([#155]) +- `import pyforefire` no longer loads matplotlib; it is imported only when + `printToPathe` or `plot_simulation` is called. `plt`, `cm`, `mpath`, + `mpatches` and `ListedColormap` are no longer reachable as `pyforefire` + attributes. ([#193]) ## [v2.5.0] — 2026-08-11 @@ -189,3 +193,4 @@ repository stays easy to return to. [#178]: https://github.com/forefireAPI/forefire/pull/178 [#180]: https://github.com/forefireAPI/forefire/pull/180 [#183]: https://github.com/forefireAPI/forefire/pull/183 +[#193]: https://github.com/forefireAPI/forefire/pull/193 diff --git a/bindings/python/src/pyforefire/helpers.py b/bindings/python/src/pyforefire/helpers.py index 57dedc4..12d1b6f 100644 --- a/bindings/python/src/pyforefire/helpers.py +++ b/bindings/python/src/pyforefire/helpers.py @@ -1,15 +1,10 @@ import numpy as np -import matplotlib.pyplot as plt -import matplotlib.path as mpath -import matplotlib.patches as mpatches -import matplotlib.cm as cm import math import struct import zlib -from matplotlib.colors import ListedColormap def get_fuels_table(propagation_model): if propagation_model == 'RothermelAndrews2018': @@ -367,6 +362,7 @@ def printToPathe(linePrinted): """ Compute the current results of simulation to pathes. """ + import matplotlib.path as mpath fronts = linePrinted.split("FireFront") pathes = [] for front in fronts[1:]: @@ -539,6 +535,10 @@ def plot_simulation(pathes, fuel_map, elevation_map, myExtents, scalMap = None): Used for plot 4 axis graph, with Heatflux, Fuels, Altitude plotted under simulation, and Statistics for the last axis. """ + import matplotlib.pyplot as plt + import matplotlib.patches as mpatches + import matplotlib.cm as cm + from matplotlib.colors import ListedColormap #import seaborn as sns # Create a figure with 2 axis (2 subplots) fig, ax = plt.subplots(figsize=(10,7), dpi=120)