diff --git a/CHANGELOG.md b/CHANGELOG.md index c8c5843c68c..15f153afcd1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,8 @@ which depend on `try-except` blocks containing network requests should be revisited. - `plotly.py:sign_in` now validates to the plotly server specified in your config. If it cannot make a successful request, it raises a `PlotlyError`. +- `plotly.figure_factory` will raise an `ImportError` if `numpy` is not + installed. ### Deprecated - `plotly.tools.FigureFactory`. Use `plotly.figure_factory.*`. diff --git a/circle.yml b/circle.yml index 62a7bdb505a..29fb8d4fa11 100644 --- a/circle.yml +++ b/circle.yml @@ -52,5 +52,9 @@ test: - sudo chmod -R 444 ${PLOTLY_CONFIG_DIR} && python -c "import plotly" # test that giving back write permissions works again - # this also has to pass the test suite that follows - sudo chmod -R 777 ${PLOTLY_CONFIG_DIR} && python -c "import plotly" + + # test that figure_factory cannot be imported with only core requirements. + # since optional requirements is part of the test suite, we don't need to + # worry about testing that it *can* be imported in this case. + - $(! python -c "import plotly.figure_factory") diff --git a/plotly/figure_factory/__init__.py b/plotly/figure_factory/__init__.py index 11547989cf6..153ac6d657b 100644 --- a/plotly/figure_factory/__init__.py +++ b/plotly/figure_factory/__init__.py @@ -1,5 +1,8 @@ from __future__ import absolute_import +# Require that numpy exists for figure_factory +import numpy + from plotly.figure_factory._2d_density import create_2d_density from plotly.figure_factory._annotated_heatmap import create_annotated_heatmap from plotly.figure_factory._candlestick import create_candlestick diff --git a/plotly/tests/test_optional/test_tools/__init__.py b/plotly/tests/test_optional/test_tools/__init__.py new file mode 100644 index 00000000000..e69de29bb2d diff --git a/plotly/tests/test_core/test_tools/test_figure_factory.py b/plotly/tests/test_optional/test_tools/test_figure_factory.py similarity index 100% rename from plotly/tests/test_core/test_tools/test_figure_factory.py rename to plotly/tests/test_optional/test_tools/test_figure_factory.py diff --git a/setup.py b/setup.py index 0e87794e7bb..1e66057b516 100644 --- a/setup.py +++ b/setup.py @@ -36,6 +36,7 @@ def readme(): 'plotly/api/v2', 'plotly/plotly', 'plotly/plotly/chunked_requests', + 'plotly/figure_factory', 'plotly/graph_objs', 'plotly/grid_objs', 'plotly/widgets',