Skip to content

Commit

Permalink
Removing matplotlib as a dependency in setup.py.
Browse files Browse the repository at this point in the history
As a result, most tox environments no longer have it present,
so added a lot of try/except to allow that code to run
smoothly when plotting isn't needed or installed.
  • Loading branch information
dhermes committed Jan 14, 2017
1 parent ce838a2 commit 064e2c5
Show file tree
Hide file tree
Showing 9 changed files with 31 additions and 18 deletions.
13 changes: 9 additions & 4 deletions docs/make_images.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,19 @@
import fractions
import os

from matplotlib import patches
from matplotlib import path as _path_mod
import matplotlib.pyplot as plt
try:
from matplotlib import patches
from matplotlib import path as _path_mod
import matplotlib.pyplot as plt
except ImportError:
patches = None
_path_mod = None
plt = None
import numpy as np
try:
import seaborn
except ImportError:
pass
seaborn = None

import bezier
from bezier import _intersection_helpers
Expand Down
7 changes: 5 additions & 2 deletions functional_tests/runtime_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,15 @@
import os
import types

import matplotlib.pyplot as plt
try:
import matplotlib.pyplot as plt
except ImportError:
plt = None
import numpy as np
try:
import seaborn # pylint: disable=unused-import
except ImportError:
pass
seaborn = None
import six

from bezier import _helpers
Expand Down
5 changes: 4 additions & 1 deletion functional_tests/test_curve_curve.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

import matplotlib.pyplot as plt
try:
import matplotlib.pyplot as plt
except ImportError:
plt = None
import numpy as np
import pytest
import six
Expand Down
5 changes: 4 additions & 1 deletion functional_tests/test_segment_box.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

import matplotlib.pyplot as plt
try:
import matplotlib.pyplot as plt
except ImportError:
plt = None
import numpy as np

from bezier import _intersection_helpers
Expand Down
5 changes: 4 additions & 1 deletion functional_tests/test_surface_locate.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

import matplotlib.pyplot as plt
try:
import matplotlib.pyplot as plt
except ImportError:
plt = None
import numpy as np

import bezier
Expand Down
5 changes: 4 additions & 1 deletion functional_tests/test_surface_surface.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@

import collections

import matplotlib.pyplot as plt
try:
import matplotlib.pyplot as plt
except ImportError:
plt = None
import numpy as np
import pytest
import six
Expand Down
1 change: 0 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@

REQUIREMENTS = (
'enum34',
'matplotlib >= 1.5.3',
'numpy >= 1.11.2',
'six >= 1.9.0',
)
Expand Down
7 changes: 0 additions & 7 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,6 @@
"""


# pylint: disable=unused-import
from matplotlib import patches # noqa: F401
from matplotlib import path as _path_mod # noqa: F401
import matplotlib.pyplot as plt # noqa: F401
# pylint: enable=unused-import


def pytest_addoption(parser):
parser.addoption(
'--ignore-slow',
Expand Down
1 change: 1 addition & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ deps =
docutils
flake8
flake8-import-order
matplotlib
mock >= 1.3.0
numpy
Pygments
Expand Down

0 comments on commit 064e2c5

Please sign in to comment.