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

Skip to content

Commit 186cf55

Browse files
committed
Merge branch 'master' into widgets-get-attributes
Conflicts: plotly/widgets/graph_widget.py
2 parents b6414bf + c225d6f commit 186cf55

File tree

26 files changed

+884
-357
lines changed

26 files changed

+884
-357
lines changed

circle.yml

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,20 @@ machine:
77
PLOTLY_OPTIONAL_REQUIREMENTS_FILE: ${PLOTLY_PACKAGE_ROOT}/optional-requirements.txt
88
PLOTLY_OPTIONAL_REQUIREMENTS_FILE_2_6: ${PLOTLY_PACKAGE_ROOT}/optional-requirements-2-6.txt
99
dependencies:
10-
pre:
10+
override:
11+
1112
# run all the pre-written installers (this will take a *while*)
1213
- bash circle/setup.sh
14+
1315
# install testing tools for circle's version of things
14-
- PYENV_VERSION=2.7 && pip install nose coverage
15-
override:
16-
- PYENV_VERSION=2.7 && pip install -I .
17-
- PYENV_VERSION=2.7 && cd ~ && python -c "import plotly"
16+
- pip install nose coverage
17+
- pip install -I .
18+
19+
# we need to cd out of the project root to ensure the install worked
20+
- cd ~ && python -c "import plotly"
21+
22+
cache_directories:
23+
- "~/.pyenv/versions" # attempt to just cache installed pyenv things
1824
test:
1925
override:
2026

@@ -28,6 +34,6 @@ test:
2834
# - sudo chmod 600 ${PLOTLY_CONFIG_DIR} && python -c "import plotly"
2935

3036
# test core things in the general 2.7 version that circle has
31-
- PYENV_VERSION=2.7 && nosetests -xv plotly/tests --with-coverage --cover-package=plotly
37+
- nosetests -xv plotly/tests --with-coverage --cover-package=plotly
3238
- mkdir "${CIRCLE_ARTIFACTS}/2.7" || true
3339
- coverage html -d "${CIRCLE_ARTIFACTS}/2.7" --title=2.7

circle/setup.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ function error_exit
1212
exit 1
1313
}
1414

15+
# PYENV shims need to be infront of the rest of the path to work!
16+
echo "adding pyenv shims to the beginning of the path in this shell"
17+
export PATH="/home/ubuntu/.pyenv/shims:$PATH"
18+
1519
# for each version we want, setup a functional virtual environment
1620
for version in ${PLOTLY_PYTHON_VERSIONS[@]}; do
1721
echo Setting up Python ${version}
@@ -20,6 +24,11 @@ for version in ${PLOTLY_PYTHON_VERSIONS[@]}; do
2024
export PYENV_VERSION=${version}
2125
echo "Using pyenv version $(pyenv version)"
2226

27+
# this was a major issue previously, sanity check that we're using the
28+
# version we *think* we're using (that pyenv is pointing to)
29+
echo "python -c 'import sys; print(sys.version)'"
30+
python -c 'import sys; print(sys.version)'
31+
2332
# install core requirements all versions need
2433
pip install -r ${PLOTLY_CORE_REQUIREMENTS_FILE} ||
2534
error_exit "${LINENO}: can't install core reqs for Python ${version}"

circle/test.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ function error_exit
1212
exit 1
1313
}
1414

15+
# PYENV shims need to be infront of the rest of the path to work!
16+
echo "adding pyenv shims to the beginning of the path in this shell"
17+
export PATH="/home/ubuntu/.pyenv/shims:$PATH"
18+
1519
# for each version we want, setup a functional virtual environment
1620
for version in ${PLOTLY_PYTHON_VERSIONS[@]}; do
1721
echo Testing Python ${version}
@@ -20,6 +24,12 @@ for version in ${PLOTLY_PYTHON_VERSIONS[@]}; do
2024
export PYENV_VERSION=${version}
2125
echo "Using pyenv version $(pyenv version)"
2226

27+
# this was a major issue previously, sanity check that we're using the
28+
# version we *think* we're using (that pyenv is pointing to)
29+
echo "python -c 'import sys; print(sys.version)'"
30+
python -c 'import sys; print(sys.version)'
31+
32+
2333
echo "install plotly (ignoring possibly cached versions)"
2434
pip install -I ${PLOTLY_PACKAGE_ROOT} ||
2535
error_exit "${LINENO}: can't install plotly package from project root"

plotly/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,5 +28,5 @@
2828

2929
from __future__ import absolute_import
3030

31-
from plotly import plotly, graph_objs, grid_objs, tools, utils
31+
from plotly import plotly, graph_objs, grid_objs, tools, utils, session
3232
from plotly.version import __version__

plotly/exceptions.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,14 @@
1515
1616
1717
"""
18-
import json
18+
import sys
1919
import six
2020

21+
if sys.version[:3] == '2.6':
22+
import simplejson as json
23+
else:
24+
import json
25+
2126
## Base Plotly Error ##
2227

2328
class PlotlyError(Exception):
@@ -49,7 +54,10 @@ def __init__(self, requests_exception):
4954
elif content_type == 'text/plain':
5055
self.message = requests_exception.response.content
5156
else:
52-
self.message = requests_exception.message
57+
try:
58+
self.message = requests_exception.message
59+
except AttributeError:
60+
self.message = 'unknown error'
5361

5462
def __str__(self):
5563
return self.message

plotly/graph_objs/graph_objs_tools.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,16 @@
44
import os
55
import sys
66
if sys.version[:3] == '2.6':
7-
from ordereddict import OrderedDict
8-
import simplejson as json
7+
try:
8+
from ordereddict import OrderedDict
9+
import simplejson as json
10+
except ImportError:
11+
raise ImportError(
12+
"Looks like you're running Python 2.6. Plotly expects newer "
13+
"standard library versions of ordereddict and json. You can "
14+
"simply upgrade with these 'extras' with the following terminal "
15+
"command:\npip install 'plotly[PY2.6]'"
16+
)
917
else:
1018
from collections import OrderedDict
1119
import json

plotly/grid_objs/grid_objs.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,16 @@
55
"""
66
from __future__ import absolute_import
77

8-
9-
import json
8+
import sys
109
from collections import MutableSequence
1110
from plotly import exceptions
1211
from plotly import utils
1312

13+
if sys.version[:3] == '2.6':
14+
import simplejson as json
15+
else:
16+
import json
17+
1418
__all__ = None
1519

1620

0 commit comments

Comments
 (0)