From ad25c8d688aba5444b188343901fa253600739a2 Mon Sep 17 00:00:00 2001 From: Samuel Gaist <samuel.gaist@idiap.ch> Date: Tue, 13 Mar 2018 11:17:47 +0100 Subject: [PATCH] [setup] Relax matplotlib requirement It's only used in one utility function therefore the import has been moved within the function and the requirement moved to run_constrained. Fixes #31 --- bob/io/image/utils.py | 2 +- conda/meta.yaml | 4 +++- doc/extra-intersphinx.txt | 1 + requirements.txt | 1 - test-requirements.txt | 1 + 5 files changed, 6 insertions(+), 3 deletions(-) create mode 100644 doc/extra-intersphinx.txt create mode 100644 test-requirements.txt diff --git a/bob/io/image/utils.py b/bob/io/image/utils.py index 0865850..3f0986d 100644 --- a/bob/io/image/utils.py +++ b/bob/io/image/utils.py @@ -1,5 +1,4 @@ import numpy as np -import matplotlib.pyplot as plt def to_matplotlib(img): @@ -64,6 +63,7 @@ def imshow(img, cmap=None, **kwargs): object Returns whatever ``plt.imshow`` returns. ''' + import matplotlib.pyplot as plt if cmap is None and img.ndim == 2: cmap = 'gray' diff --git a/conda/meta.yaml b/conda/meta.yaml index a3cf626..57103dd 100644 --- a/conda/meta.yaml +++ b/conda/meta.yaml @@ -40,9 +40,10 @@ requirements: run: - python - setuptools - - matplotlib - boost - {{ pin_compatible('numpy') }} + run_constrained: + - matplotlib test: imports: @@ -59,6 +60,7 @@ test: - coverage - sphinx - sphinx_rtd_theme + - matplotlib about: home: https://www.idiap.ch/software/bob/ diff --git a/doc/extra-intersphinx.txt b/doc/extra-intersphinx.txt new file mode 100644 index 0000000..6ccafc3 --- /dev/null +++ b/doc/extra-intersphinx.txt @@ -0,0 +1 @@ +matplotlib diff --git a/requirements.txt b/requirements.txt index 8c00d21..6256c75 100644 --- a/requirements.txt +++ b/requirements.txt @@ -4,4 +4,3 @@ bob.extension bob.blitz bob.core bob.io.base -matplotlib diff --git a/test-requirements.txt b/test-requirements.txt new file mode 100644 index 0000000..6ccafc3 --- /dev/null +++ b/test-requirements.txt @@ -0,0 +1 @@ +matplotlib -- GitLab