Skip to content

Commit f1cbba1

Browse files
committed
Fail if user tries to import FF without numpy.
Note that we don’t necessarily *require* `numpy` for in all the FF methods. We’re just looking to make the compatibility-breaking change so that we can depend on it in `2.0.0`. Also note that I’d forgotten to include `figure_factory` in setup.py before ;__;.
1 parent 193f613 commit f1cbba1

File tree

4 files changed

+11
-1
lines changed

4 files changed

+11
-1
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ failures. Previously either a `PlotlyError`, `PlotlyRequestException`, or a
1010
`requests.exceptions.ReqestException` could be raised. In particular, scripts
1111
which depend on `try-except` blocks containing network requests should be
1212
revisited.
13+
- `plotly.figure_factory` will raise an `ImportError` if `numpy` is not
14+
installed.
1315

1416
### Deprecated
1517
- `plotly.tools.FigureFactory`. Use `plotly.figure_factory.*`.

circle.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,5 +52,9 @@ test:
5252
- sudo chmod -R 444 ${PLOTLY_CONFIG_DIR} && python -c "import plotly"
5353

5454
# test that giving back write permissions works again
55-
# this also has to pass the test suite that follows
5655
- sudo chmod -R 777 ${PLOTLY_CONFIG_DIR} && python -c "import plotly"
56+
57+
# test that figure_factory cannot be imported with only core requirements.
58+
# since optional requirements is part of the test suite, we don't need to
59+
# worry about testing that it *can* be imported in this case.
60+
- ! python -c "import plotly.figure_factory"

plotly/figure_factory/__init__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
from __future__ import absolute_import
22

3+
# Require that numpy exists for figure_factory
4+
import numpy
5+
36
from plotly.figure_factory._2d_density import create_2d_density
47
from plotly.figure_factory._annotated_heatmap import create_annotated_heatmap
58
from plotly.figure_factory._candlestick import create_candlestick

setup.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ def readme():
3636
'plotly/api/v2',
3737
'plotly/plotly',
3838
'plotly/plotly/chunked_requests',
39+
'plotly/figure_factory',
3940
'plotly/graph_objs',
4041
'plotly/grid_objs',
4142
'plotly/widgets',

0 commit comments

Comments
 (0)