Skip to content

Commit

Permalink
added matplotlib & numpy version check for automatic examples plotting
Browse files Browse the repository at this point in the history
  • Loading branch information
0ctagon committed Jun 20, 2024
1 parent 0ef372d commit a77912b
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/plothist/scripts/make_examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@
import sys


_matplotlib_version = "3.9.0"
_numpy_version = "2.0.0"


def make_examples(no_input=False, check_svg=False, print_code=False):
"""
This function can redo automatically all the examples from the documentation. Only works with python 3.9 or higher.
Expand Down Expand Up @@ -35,17 +39,19 @@ def make_examples(no_input=False, check_svg=False, print_code=False):
return 1

import matplotlib
if matplotlib.__version__ < "3.9.0":

if matplotlib.__version__ < _matplotlib_version:
warnings.warn(
"svg behavior is not consistent across matplotlib versions. Please run this script with matplotlib 3.9.0 or higher. Skipping.",
f"svg behavior is not consistent across matplotlib versions. Please run this script with matplotlib {_matplotlib_version} or higher. Skipping.",
stacklevel=2,
)
return 1

import numpy
if numpy.__version__ < "2.0.0":

if numpy.__version__ < _numpy_version:
warnings.warn(
"svg behavior is not consistent across numpy versions. Please run this script with numpy 2.0.0 or higher. Skipping.",
f"svg behavior is not consistent across numpy versions. Please run this script with numpy {_numpy_version} or higher. Skipping.",
stacklevel=2,
)
return 1
Expand Down

0 comments on commit a77912b

Please sign in to comment.