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

Skip to content

Commit 6425081

Browse files
committed
Merge branch 'master' into sparklines-ff
merge from new plotly 3.0 master
2 parents 4a90396 + 79b7a83 commit 6425081

File tree

1,172 files changed

+56635
-14288
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,172 files changed

+56635
-14288
lines changed

CHANGELOG.md

Lines changed: 107 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,114 @@
22
All notable changes to this project will be documented in this file.
33
This project adheres to [Semantic Versioning](http://semver.org/).
44

5-
## [2.7.1] - [UNRELEASED]
5+
## [3.1.1] - 2018-08-10
6+
This release is a minor bug-fix update to version 3.1.0
7+
8+
### JupyterLab Versions
9+
For use with JupyterLab, the following versions of the following packages
10+
must be installed:
11+
12+
- Python Packages
13+
- plotly==3.1.1
14+
- ipywidgets>=7.2
15+
- notebook>=5.3
16+
- jupyterlab==0.33
17+
18+
- JupyterLab Extensions
19+
20+
- @jupyter-widgets/jupyterlab-manager@0.36
21+
- @jupyterlab/plotly-extension@0.16
22+
23+
### Updated
24+
- Updated plotly.js to version 1.39.4.
25+
- This is a bug-fix release of plotly.js
26+
- See [the plotly.js CHANGELOG](https://github.com/plotly/plotly.js/blob/master/CHANGELOG.md#1394----2018-08-02) for more information
27+
28+
### Fixed
29+
- Fixed error in validation of configkeys
30+
[plotly/plotly.js#1065](https://github.com/plotly/plotly.py/pull/1065)
31+
- Fixed error in presentation of named colorscales
32+
[plotly/plotly.js#1089](https://github.com/plotly/plotly.py/pull/1089)
33+
- Fixed numerical precision error when using `plotly.tools.make_subplots`
34+
to create figures with a large number of subplots
35+
[plotly/plotly.js#1091](https://github.com/plotly/plotly.py/pull/1091)
36+
- Fixed problem that prevented the use of the `.update` method to initialize
37+
an array property (e.g. `layout.shapes`)
38+
[plotly/plotly.js#1091](https://github.com/plotly/plotly.py/pull/1092)
39+
- Fixed `FigureWidget` problem causing scroll zoom on 3D plots to stutter
40+
[plotly/plotly.js#1094](https://github.com/plotly/plotly.py/pull/1094)
41+
- Fixed invalid `tickmode` property in `matplotlylib`
42+
[plotly/plotly.js#1101](https://github.com/plotly/plotly.py/pull/1101)
43+
44+
## [3.1.0] - 2018-07-20
45+
46+
### JupyterLab Versions
47+
For use with JupyterLab, the following versions of the following packages
48+
must be installed. See [README.md](README.md) for instructions.
49+
50+
- Python Packages
51+
- plotly==3.1.0
52+
- ipywidgets>=7.2
53+
- notebook>=5.3
54+
- jupyterlab==0.32.1
55+
56+
- JupyterLab Extensions
57+
58+
- @jupyter-widgets/jupyterlab-manager@0.35
59+
- @jupyterlab/plotly-extension@0.16
60+
661
### Updated
7-
- error message for `plotly.figure_factory.create_choropleth` is now helpful to Anaconda users who do not have the correct modules installed for the County Choropleth figure factory.
62+
- Updated Plotly.js to version 1.39.2
63+
- See highlights below
64+
- See [the plotly.js CHANGELOG](https://github.com/plotly/plotly.js/blob/master/CHANGELOG.md#1392----2018-07-16) for more information.
65+
66+
### Added
67+
- Added 3D streamtube traces
68+
[plotly/plotly.js#2658](https://github.com/plotly/plotly.js/pull/2658)
69+
- Added support for on-graph text in scattergl traces
70+
- Added gridshape attribute to polar subplots with values 'circular' (the default) and 'linear' (to draw polygon grids)
71+
[plotly/plotly.js#2739](https://github.com/plotly/plotly.js/pull/2739)
72+
73+
## [3.0.2] - 2018-07-17
74+
This is a minor bug-fix release to 3.0.0
75+
76+
### JupyterLab plotlywidget version: 0.1.1
77+
78+
### Plotly.js version: 1.38.3
79+
80+
### Fixed
81+
- Several errors related to numbered subplot labels (e.g. xaxis2, polar3, etc.)
82+
[GH1057](https://github.com/plotly/plotly.py/pull/1057)
83+
- Error where the `v` property was ignored in `cone` traces
84+
[GH1060](https://github.com/plotly/plotly.py/pull/1060)
85+
- Assorted performance improvements when constructing graph objects
86+
[GH1061](https://github.com/plotly/plotly.py/pull/1061)
87+
88+
## [3.0.1] - 2018-07-17 [YANKED]
89+
Note: This release's installation was broken. It has been removed from PyPI
90+
91+
## [3.0.0] - 2018-07-05
92+
93+
This is a major version with many exciting updates. See the [Introducing plotly.py 3.0.0](https://medium.com/@plotlygraphs/introducing-plotly-py-3-0-0-7bb1333f69c6) post for more information.
94+
95+
### JupyterLab plotlywidget version: 0.1.1
96+
97+
### Plotly.js version: 1.38.3
98+
99+
### Added
100+
- Full Jupyter ipywidgets integration with the new `graph_objs.FigureWidget` class
101+
- `FigureWidget` figures can be updated interactively using property assignment syntax
102+
- The full trace and layout API is generated from the plotly schema to provide a great experience for interactive use in the notebook
103+
- Support for setting array properties as numpy arrays. When numpy arrays are used, ipywidgets binary serialization protocol is used to avoid converting these to JSON strings.
104+
- Context manager API for animation. Run `help(go.Figure().batch_animate)` for the full doc string.
105+
- Perform automatic retries when communicating with plot.ly services. This introduces a new required dependency on the [retrying](https://pypi.org/project/retrying/) library.
106+
- Improved data validation covering the full API with clear, informative error messages. This means that incorrect properties and/or values now always raise a `ValueError` with a description of the error, the invalid property, and the available properties on the level that it was placed in the graph object. Eg. `go.Scatter(foo=123)` raises a validation error. See https://plot.ly/python/reference/ for a reference to all valid properties and values in the Python API.
107+
- Error message for `plotly.figure_factory.create_choropleth` is now helpful to Anaconda users who do not have the correct modules installed for the County Choropleth figure factory.
108+
109+
### Changed / Deprecated
110+
Please see the [migration guid](migration-guide.md) for a full list of the changes and deprecations in version 3.0.0
111+
112+
8113

9114
## [2.7.0] - 2018-05-23
10115
### Updated

README.md

Lines changed: 46 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11
# plotly.py
22

3-
> 📢 Announcement!
4-
> Registration is open for a 2 day, Dash master class in Washington DC, June 9-10.
5-
> [Register online here](https://plotcon.plot.ly/tickets/) 🎚📈🏛
6-
7-
***
8-
3+
## Overview
94
[plotly.py](https://plot.ly/d3-js-for-python-and-pandas-charts/) is an interactive, browser-based graphing library for Python :sparkles:
105

116
Built on top of [plotly.js](https://github.com/plotly/plotly.js), `plotly.py` is a high-level, declarative charting library. plotly.js ships with over 30 chart types, including scientific charts, 3D graphs, statistical charts, SVG maps, financial charts, and more.
@@ -22,14 +17,57 @@ Built on top of [plotly.js](https://github.com/plotly/plotly.js), `plotly.py` is
2217
***
2318

2419
- [Online Documentation](https://plot.ly/python)
25-
- [`contributing.md`](https://github.com/plotly/python-api/blob/master/contributing.md)
20+
- [Contributing](contributing.md)
21+
- [Changelog](CHANGELOG.md)
2622
- [Code of Conduct](CODE_OF_CONDUCT.md)
23+
- [Version 3 Migration Guide](migration-guide.md)
2724
- [New! Announcing Dash](https://medium.com/@plotlygraphs/introducing-dash-5ecf7191b503)
2825
- [Community](https://community.plot.ly/c/api/python)
2926

3027
***
3128

32-
Code and documentation copyright 2017 Plotly, Inc.
29+
## Installation of plotly.py Version 3
30+
To install plotly.py and enable Jupyter or Jupyter Lab support, run:
31+
```
32+
pip install plotly==3.1.1
33+
pip install "notebook>=5.3" "ipywidgets>=7.2" # only necessary for Jupyter Notebook environments
34+
```
35+
36+
If you're using older versions of `notebook` or `ipywidgets` you may need to manually activate the widget extensions (this should not be needed for `notebook>=5.3` and `ipywidgets>=7.2`)
37+
38+
```
39+
jupyter nbextension enable --py widgetsnbextension --sys-prefix
40+
jupyter nbextension enable --py plotlywidget --sys-prefix
41+
```
42+
43+
In addition, to add JupyterLab support run the following commands
44+
45+
```
46+
pip install jupyterlab==0.33
47+
48+
# Avoid "JavaScript heap out of memory" errors during extension installation
49+
# (OS X/Linux)
50+
export NODE_OPTIONS=--max-old-space-size=4096
51+
# (Windows)
52+
set NODE_OPTIONS=--max-old-space-size=4096
53+
54+
# Jupyter widgets extension
55+
jupyter labextension install @jupyter-widgets/[email protected] --no-build
56+
57+
# FigureWidget support
58+
jupyter labextension install [email protected] --no-build
59+
60+
# offline iplot support
61+
jupyter labextension install @jupyterlab/[email protected] --no-build
62+
63+
# Build extensions (must be done to activate extensions since --no-build is used above)
64+
jupyter lab build
65+
```
66+
67+
If you're migrating from plotly.py version 2, please check out the [migration guide](migration-guide.md)
68+
69+
## Copyright and Licenses
70+
Code and documentation copyright 2018 Plotly, Inc.
3371

3472
Code released under the [MIT license](LICENSE.txt).
3573

_plotly_utils/basevalidators.py

Lines changed: 29 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1211,7 +1211,7 @@ class ColorscaleValidator(BaseValidator):
12111211
named_colorscales = [
12121212
'Greys', 'YlGnBu', 'Greens', 'YlOrRd', 'Bluered', 'RdBu', 'Reds',
12131213
'Blues', 'Picnic', 'Rainbow', 'Portland', 'Jet', 'Hot', 'Blackbody',
1214-
'Earth', 'Electric', 'Viridis'
1214+
'Earth', 'Electric', 'Viridis', 'Cividis'
12151215
]
12161216

12171217
def __init__(self, plotly_name, parent_name, **kwargs):
@@ -1229,7 +1229,7 @@ def description(self):
12291229
- One of the following named colorscales:
12301230
['Greys', 'YlGnBu', 'Greens', 'YlOrRd', 'Bluered', 'RdBu',
12311231
'Reds', 'Blues', 'Picnic', 'Rainbow', 'Portland', 'Jet',
1232-
'Hot', 'Blackbody', 'Earth', 'Electric', 'Viridis']
1232+
'Hot', 'Blackbody', 'Earth', 'Electric', 'Viridis', 'Cividis]
12331233
""".format(plotly_name=self.plotly_name)
12341234

12351235
return desc
@@ -1274,9 +1274,11 @@ def validate_coerce(self, v):
12741274
return v
12751275

12761276
def present(self, v):
1277-
# Return tuple of tuples so that colorscale is immutable
1277+
# Return-type must be immutable
12781278
if v is None:
12791279
return None
1280+
elif isinstance(v, string_types):
1281+
return v
12801282
else:
12811283
return tuple([tuple(e) for e in v])
12821284

@@ -1658,16 +1660,21 @@ class LiteralValidator(BaseValidator):
16581660
"""
16591661
Validator for readonly literal values
16601662
"""
1661-
def __init__(self, plotly_name, parent_name, **kwargs):
1662-
super(LiteralValidator, self).__init__(plotly_name=plotly_name,
1663-
parent_name=parent_name,
1664-
**kwargs)
1663+
def __init__(self, plotly_name, parent_name, val, **kwargs):
1664+
super(LiteralValidator, self).__init__(
1665+
plotly_name=plotly_name,
1666+
parent_name=parent_name,
1667+
**kwargs)
1668+
self.val = val
16651669

16661670
def validate_coerce(self, v):
1667-
raise ValueError("""\
1668-
The '{plotly_name}' property of {parent_name} is read-only""".format(
1669-
plotly_name=self.plotly_name, parent_name=self.parent_name
1670-
))
1671+
if v != self.val:
1672+
raise ValueError("""\
1673+
The '{plotly_name}' property of {parent_name} is read-only""".format(
1674+
plotly_name=self.plotly_name, parent_name=self.parent_name
1675+
))
1676+
else:
1677+
return v
16711678

16721679

16731680
class ImageUriValidator(BaseValidator):
@@ -1864,11 +1871,18 @@ def validate_coerce(self, v):
18641871

18651872
class BaseDataValidator(BaseValidator):
18661873

1867-
def __init__(self, class_strs_map, plotly_name, parent_name, **kwargs):
1874+
def __init__(self,
1875+
class_strs_map,
1876+
plotly_name,
1877+
parent_name,
1878+
set_uid=False,
1879+
**kwargs):
18681880
super(BaseDataValidator, self).__init__(
18691881
plotly_name=plotly_name, parent_name=parent_name, **kwargs)
1882+
18701883
self.class_strs_map = class_strs_map
18711884
self._class_map = None
1885+
self.set_uid = set_uid
18721886

18731887
def description(self):
18741888

@@ -1957,8 +1971,9 @@ def validate_coerce(self, v):
19571971
v = to_scalar_or_list(res)
19581972

19591973
# Set new UIDs
1960-
for trace in v:
1961-
trace.uid = str(uuid.uuid1())
1974+
if self.set_uid:
1975+
for trace in v:
1976+
trace.uid = str(uuid.uuid1())
19621977

19631978
else:
19641979
self.raise_invalid_val(v)

_plotly_utils/tests/validators/test_basetraces_validator.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ def validator():
1010
'bar': 'Bar',
1111
'box': 'Box'},
1212
plotly_name='prop',
13-
parent_name='parent')
13+
parent_name='parent',
14+
set_uid=True)
1415

1516

1617
# Tests

_plotly_utils/tests/validators/test_colorscale_validator.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ def validator():
1111

1212

1313
@pytest.fixture(params=['Greys', 'YlGnBu', 'Greens', 'YlOrRd', 'Bluered', 'RdBu', 'Reds', 'Blues',
14-
'Picnic', 'Rainbow', 'Portland', 'Jet', 'Hot', 'Blackbody', 'Earth', 'Electric', 'Viridis'])
14+
'Picnic', 'Rainbow', 'Portland', 'Jet', 'Hot', 'Blackbody', 'Earth', 'Electric',
15+
'Viridis', 'Cividis'])
1516
def named_colorscale(request):
1617
return request.param
1718

@@ -26,6 +27,8 @@ def test_acceptance_named(named_colorscale, validator: ColorscaleValidator):
2627
# Uppercase
2728
assert (validator.validate_coerce(named_colorscale.upper()) ==
2829
named_colorscale.upper())
30+
31+
assert validator.present(named_colorscale) == named_colorscale
2932

3033
# ### Acceptance as array ###
3134
@pytest.mark.parametrize('val', [

_plotly_utils/tests/validators/test_infoarray_validator.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ def validator_number3_free():
3030
# ----------
3131
# ### Acceptance ###
3232
@pytest.mark.parametrize('val', [
33-
[1, 'A'], ('hello', 'world!'), [1, ()], [-1, 1]
33+
[1, 'A'], ('hello', 'world!'), [1, set()], [-1, 1]
3434
])
3535
def test_validator_acceptance_any2(val, validator_any2: InfoArrayValidator):
3636
coerce_val = validator_any2.validate_coerce(val)
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import pytest
2+
from _plotly_utils.basevalidators import LiteralValidator
3+
import numpy as np
4+
5+
6+
# Fixtures
7+
# --------
8+
@pytest.fixture()
9+
def validator():
10+
return LiteralValidator('prop', 'parent', 'scatter')
11+
12+
13+
# Tests
14+
# -----
15+
# ### Acceptance ###
16+
@pytest.mark.parametrize('val', ['scatter'])
17+
def test_acceptance(val, validator):
18+
assert validator.validate_coerce(val) is val
19+
20+
21+
# ### Test rejection ###
22+
@pytest.mark.parametrize('val',
23+
['hello', (), [], [1, 2, 3], set(), '34'])
24+
def test_rejection(val, validator):
25+
with pytest.raises(ValueError) as validation_failure:
26+
validator.validate_coerce(val)
27+
28+
assert 'read-only' in str(validation_failure.value)

circle.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,17 @@ dependencies:
2020

2121
# install everything tox knows about and the plotly package.
2222
- pip install tox
23-
- tox --notest
23+
- tox --notest:
24+
timeout: 1200
25+
2426
- pip install -I .
2527

2628
# we need to cd out of the project root to ensure the install worked
2729
- cd ~ && python -c "import plotly"
2830

2931
# install jupyter test JS requirements
30-
- cd ${PLOTLY_JUPYTER_TEST_DIR} && npm i
32+
- cd ${PLOTLY_JUPYTER_TEST_DIR} && npm i:
33+
timeout: 1200
3134

3235
cache_directories:
3336

0 commit comments

Comments
 (0)