Skip to content

Commit 600b7b6

Browse files
committed
Merge remote-tracking branch 'origin/master' into ipyplotly_integration
# Conflicts: # plotly/graph_objs/graph_objs.py # plotly/package_data/plotly.min.js # plotly/utils.py # plotly/version.py
2 parents dfec10c + 519e0ab commit 600b7b6

File tree

8 files changed

+2260
-832
lines changed

8 files changed

+2260
-832
lines changed

CHANGELOG.md

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,22 @@
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.5.2] - UNRELEASED
5+
## [2.7.1] - [UNRELEASED]
66
### Updated
7-
- error message for `plotly.figure_factory.create_choropleth` is more helpful for Windows users on installing `geopandas` and dependencies including `shapely`.
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.
8+
9+
## [2.7.0] - 2018-05-23
10+
### Updated
11+
- Updated `plotly.min.js` to version 1.38.0.
12+
- New features include a `3D cone` trace to visualize vector fields.
13+
- See [the plotly.js CHANGELOG](https://github.com/plotly/plotly.js/blob/master/CHANGELOG.md#1380----2018-05-23) for additional information regarding the updates.
14+
15+
## [2.6.0] - 2018-05-09
16+
### Updated
17+
- Updated `plotly.min.js` to version 1.37.1.
18+
- New features include a `splom` (scatter plot matrix) trace type.
19+
- See [the plotly.js CHANGELOG](https://github.com/plotly/plotly.js/blob/master/CHANGELOG.md#1371----2018-05-02) for additional information regarding the updates.
20+
- Error message for `plotly.figure_factory.create_choropleth` is more helpful for Windows users on installing `geopandas` and dependencies including `shapely`.
821

922
## [2.5.1] - 2018-03-26
1023
### Fixed

README.md

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

33
> 📢 Announcement!
4-
> Registration is open for a 2 day, Dash master class in Boston, April 14-15.
5-
> [Register online here](https://plotcon.plot.ly/tickets/) 🎚📈⚾️
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/) 🎚📈🏛
66
77
***
88

plotly/figure_factory/_county_choropleth.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -565,12 +565,20 @@ def create_choropleth(fips, values, scope=['usa'], binning_endpoints=None,
565565
"geopandas, pyshp and shapely must be installed for this figure "
566566
"factory.\n\nRun the following commands to install the correct "
567567
"versions of the following modules:\n\n"
568-
"`pip install geopandas==0.3.0`\n"
569-
"`pip install pyshp==1.2.10`\n"
570-
"`pip install shapely==1.6.3`\n\n"
568+
"```\n"
569+
"pip install geopandas==0.3.0\n"
570+
"pip install pyshp==1.2.10\n"
571+
"pip install shapely==1.6.3\n"
572+
"```\n"
571573
"If you are using Windows, follow this post to properly "
572574
"install geopandas and dependencies:"
573-
"http://geoffboeing.com/2014/09/using-geopandas-windows/"
575+
"http://geoffboeing.com/2014/09/using-geopandas-windows/\n\n"
576+
"If you are using Anaconda, do not use PIP to install the "
577+
"packages above. Instead use conda to install them:\n\n"
578+
"```\n"
579+
"conda install plotly\n"
580+
"conda install geopandas\n"
581+
"```"
574582
)
575583

576584
df, df_state = _create_us_counties_df(st_to_state_name_dict,

plotly/package_data/default-schema.json

Lines changed: 2161 additions & 818 deletions
Large diffs are not rendered by default.

plotly/package_data/plotly.min.js

Lines changed: 2 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

plotly/tests/test_core/test_tools/test_file_tools.py

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
from plotly import tools, session
22
from plotly.tests.utils import PlotlyTestCase
33

4+
import warnings
5+
46

57
class FileToolsTest(PlotlyTestCase):
68

@@ -43,14 +45,37 @@ def test_set_config_file_two_entries(self):
4345
self.assertEqual(config['plotly_streaming_domain'], streaming_domain)
4446
tools.reset_config_file()
4547

46-
4748
def test_set_config_file_world_readable(self):
4849

4950
# Return TypeError when world_readable type is not a bool
5051

5152
kwargs = {'world_readable': 'True'}
5253
self.assertRaises(TypeError, tools.set_config_file, **kwargs)
5354

55+
def test_set_config_expected_warning_msg(self):
56+
57+
# Check that UserWarning is being called with http plotly_domain
58+
59+
with warnings.catch_warnings(record=True) as w:
60+
warnings.simplefilter("always")
61+
kwargs = {'plotly_domain': 'http://www.foo-bar.com'}
62+
tools.set_config_file(**kwargs)
63+
assert len(w) == 1
64+
assert issubclass(w[-1].category, UserWarning)
65+
assert "plotly_domain" in str(w[-1].message)
66+
67+
68+
def test_set_config_no_warning_msg_if_plotly_domain_is_https(self):
69+
70+
# Check that no UserWarning is being called with https plotly_domain
71+
72+
with warnings.catch_warnings(record=True) as w:
73+
warnings.simplefilter("always")
74+
kwargs = {'plotly_domain': 'https://www.foo-bar.com'}
75+
tools.set_config_file(**kwargs)
76+
assert len(w) == 0
77+
78+
5479
def test_reset_config_file(self):
5580

5681
# Check reset_config and get_config return the same values

plotly/tools.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,7 @@ def set_config_file(plotly_domain=None,
191191
ensure_local_plotly_files() # make sure what's there is OK
192192
utils.validate_world_readable_and_sharing_settings({
193193
'sharing': sharing, 'world_readable': world_readable})
194+
194195
settings = get_config_file()
195196
if isinstance(plotly_domain, six.string_types):
196197
settings['plotly_domain'] = plotly_domain
@@ -217,6 +218,11 @@ def set_config_file(plotly_domain=None,
217218
elif auto_open is not None:
218219
raise TypeError('auto_open should be a boolean')
219220

221+
# validate plotly_domain and plotly_api_domain
222+
utils.validate_plotly_domains(
223+
{'plotly_domain': plotly_domain, 'plotly_api_domain': plotly_api_domain}
224+
)
225+
220226
if isinstance(world_readable, bool):
221227
settings['world_readable'] = world_readable
222228
settings.pop('sharing')

plotly/utils.py

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@
77
"""
88
from __future__ import absolute_import
99

10+
import decimal
1011
import os.path
1112
import re
1213
import sys
1314
import textwrap
1415
import threading
15-
import decimal
1616
import datetime
1717
from collections import deque
1818
from pprint import PrettyPrinter
@@ -39,6 +39,30 @@
3939
)
4040

4141

42+
http_msg = (
43+
"The plotly_domain and plotly_api_domain of your config file must start "
44+
"with 'https', not 'http'. If you are not using On-Premise then run the "
45+
"following code to ensure your plotly_domain and plotly_api_domain start "
46+
"with 'https':\n\n\n"
47+
"import plotly\n"
48+
"plotly.tools.set_config_file(\n"
49+
" plotly_domain='https://plot.ly',\n"
50+
" plotly_api_domain='https://api.plot.ly'\n"
51+
")\n\n\n"
52+
"If you are using On-Premise then you will need to use your company's "
53+
"domain and api_domain urls:\n\n\n"
54+
"import plotly\n"
55+
"plotly.tools.set_config_file(\n"
56+
" plotly_domain='https://plotly.your-company.com',\n"
57+
" plotly_api_domain='https://plotly.your-company.com'\n"
58+
")\n\n\n"
59+
"Make sure to replace `your-company.com` with the URL of your Plotly "
60+
"On-Premise server.\nSee "
61+
"https://plot.ly/python/getting-started/#special-instructions-for-plotly-onpremise-users "
62+
"for more help with getting started with On-Premise."
63+
)
64+
65+
4266
### general file setup tools ###
4367

4468
def load_json_dict(filename, *args):
@@ -306,6 +330,7 @@ def encode_as_decimal(obj):
306330
else:
307331
raise NotEncodable
308332

333+
309334
### unicode stuff ###
310335
def decode_unicode(coll):
311336
if isinstance(coll, list):
@@ -445,6 +470,16 @@ def validate_world_readable_and_sharing_settings(option_set):
445470
)
446471

447472

473+
def validate_plotly_domains(option_set):
474+
domains_not_none = []
475+
for d in ['plotly_domain', 'plotly_api_domain']:
476+
if d in option_set and option_set[d]:
477+
domains_not_none.append(option_set[d])
478+
479+
if not all(d.lower().startswith('https') for d in domains_not_none):
480+
warnings.warn(http_msg, category=UserWarning)
481+
482+
448483
def set_sharing_and_world_readable(option_set):
449484
if 'world_readable' in option_set and 'sharing' not in option_set:
450485
option_set['sharing'] = (

0 commit comments

Comments
 (0)