Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 1a6605f

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 0b6e010 commit 1a6605f

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
@@ -12,6 +12,8 @@ which depend on `try-except` blocks containing network requests should be
1212
revisited.
1313
- `plotly.py:sign_in` now validates to the plotly server specified in your
1414
config. If it cannot make a successful request, it raises a `PlotlyError`.
15+
- `plotly.figure_factory` will raise an `ImportError` if `numpy` is not
16+
installed.
1517

1618
### Deprecated
1719
- `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)