Skip to content

Commit f1bcf0d

Browse files
committed
Merge pull request #154 from plotly/circle-redux
Circle redux
2 parents 584b627 + 86bc4be commit f1bcf0d

File tree

9 files changed

+149
-7
lines changed

9 files changed

+149
-7
lines changed

circle.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
machine:
2+
environment:
3+
PLOTLY_PACKAGE_ROOT: /home/ubuntu/python-api
4+
PLOTLY_CONFIG_DIR: ${HOME}/.plotly
5+
PLOTLY_PYTHON_VERSIONS: 2.6.8 2.7.8 3.3.3 3.4.1
6+
PLOTLY_CORE_REQUIREMENTS_FILE: ${PLOTLY_PACKAGE_ROOT}/requirements.txt
7+
PLOTLY_OPTIONAL_REQUIREMENTS_FILE: ${PLOTLY_PACKAGE_ROOT}/optional-requirements.txt
8+
PLOTLY_OPTIONAL_REQUIREMENTS_FILE_2_6: ${PLOTLY_PACKAGE_ROOT}/optional-requirements-2-6.txt
9+
dependencies:
10+
pre:
11+
# run all the pre-written installers (this will take a *while*)
12+
- bash circle/setup.sh
13+
# 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"
18+
test:
19+
override:
20+
21+
# run test suite in all our python versions
22+
- bash circle/test.sh
23+
24+
# # test that it imports when you don't have file permissions
25+
# - sudo chmod 400 ${PLOTLY_CONFIG_DIR} && python -c "import plotly"
26+
#
27+
# # test that setting permissions will work for import (and tests)
28+
# - sudo chmod 600 ${PLOTLY_CONFIG_DIR} && python -c "import plotly"
29+
30+
# 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
32+
- mkdir "${CIRCLE_ARTIFACTS}/2.7" || true
33+
- coverage html -d "${CIRCLE_ARTIFACTS}/2.7" --title=2.7

circle/setup.sh

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
#!/bin/bash
2+
3+
echo "running setup routine with python versions:"
4+
for version in ${PLOTLY_PYTHON_VERSIONS[@]}; do
5+
echo " ${version}"
6+
done
7+
8+
PROGNAME=$(basename $0)
9+
function error_exit
10+
{
11+
echo -e "${PROGNAME}: ${1:-"Unknown Error"}\n" 1>&2
12+
exit 1
13+
}
14+
15+
# for each version we want, setup a functional virtual environment
16+
for version in ${PLOTLY_PYTHON_VERSIONS[@]}; do
17+
echo Setting up Python ${version}
18+
19+
# exporting this variable (in this scope) chooses the python version
20+
export PYENV_VERSION=${version}
21+
echo "Using pyenv version $(pyenv version)"
22+
23+
# install core requirements all versions need
24+
pip install -r ${PLOTLY_CORE_REQUIREMENTS_FILE} ||
25+
error_exit "${LINENO}: can't install core reqs for Python ${version}"
26+
27+
# handle funkiness around python 2.6
28+
if [ ${version:0:3} == '2.6' ]
29+
then
30+
pip install simplejson ordereddict ||
31+
error_exit "${LINENO}: can't install extras for Python ${version}"
32+
pip install -r ${PLOTLY_OPTIONAL_REQUIREMENTS_FILE_2_6} ||
33+
error_exit "${LINENO}: can't install optional for Python ${version}"
34+
else
35+
pip install -r ${PLOTLY_OPTIONAL_REQUIREMENTS_FILE} ||
36+
error_exit "${LINENO}: can't install optional for Python ${version}"
37+
fi
38+
39+
# install some test tools
40+
pip install nose coverage ||
41+
error_exit "${LINENO}: can't install test tools for Python ${version}"
42+
done

circle/test.sh

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
#!/bin/bash
2+
3+
echo "running test routine with python versions:"
4+
for version in ${PLOTLY_PYTHON_VERSIONS[@]}; do
5+
echo " ${version}"
6+
done
7+
8+
PROGNAME=$(basename $0)
9+
function error_exit
10+
{
11+
echo -e "${PROGNAME}: ${1:-"Unknown Error"}\n" 1>&2
12+
exit 1
13+
}
14+
15+
# for each version we want, setup a functional virtual environment
16+
for version in ${PLOTLY_PYTHON_VERSIONS[@]}; do
17+
echo Testing Python ${version}
18+
19+
# exporting this variable (in this scope) chooses the python version
20+
export PYENV_VERSION=${version}
21+
echo "Using pyenv version $(pyenv version)"
22+
23+
echo "install plotly (ignoring possibly cached versions)"
24+
pip install -I ${PLOTLY_PACKAGE_ROOT} ||
25+
error_exit "${LINENO}: can't install plotly package from project root"
26+
27+
echo "import plotly to create .plotly dir if DNE"
28+
python -c 'import plotly' ||
29+
error_exit "${LINENO}: can't import plotly package"
30+
31+
# echo "${HOME}"
32+
# echo "${PLOTLY_CONFIG_DIR}"
33+
#
34+
# # test that it imports when you don't have write permissions
35+
# sudo chmod -R 444 ${PLOTLY_CONFIG_DIR} && python -c "import plotly" ||
36+
# error_exit "${LINENO}: permissions test 444 on .plotly dir failed"
37+
#
38+
# # test that setting write permissions will work for import (and tests)
39+
# sudo chmod -R 666 ${PLOTLY_CONFIG_DIR} && python -c "import plotly" ||
40+
# error_exit "${LINENO}: permissions test 666 on .plotly dir failed"
41+
42+
echo "running tests for Python ${version} as user '$(whoami)'"
43+
nosetests -xv plotly/tests --with-coverage --cover-package=plotly ||
44+
error_exit "${LINENO}: test suite failed for Python ${version}"
45+
mkdir "${CIRCLE_ARTIFACTS}/${PYENV_VERSION}" || true
46+
coverage html -d "${CIRCLE_ARTIFACTS}/${PYENV_VERSION}" \
47+
--title=${PYENV_VERSION}
48+
49+
done

optional-requirements-2-6.txt

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
### Optional Dependencies for Additional Plotly Functionality ###
2+
### ###
3+
### To install, run: ###
4+
### $ pip install -r optional-requirements.txt ###
5+
### ###
6+
###################################################################
7+
8+
## numpy (technically, this is covered by matplotlib's deps) ##
9+
numpy
10+
11+
## matplotlylib dependencies ##
12+
matplotlib==1.3.1
13+
14+
## testing dependencies ##
15+
nose==1.3.3
16+
17+
## pandas deps for some matplotlib functionality ##
18+
pandas

plotly/exceptions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ def __str__(self):
6969
NON_UNIQUE_COLUMN_MESSAGE = (
7070
"Yikes, plotly grids currently "
7171
"can't have duplicate column names. Rename "
72-
"the column \"{}\" and try again."
72+
"the column \"{0}\" and try again."
7373
)
7474
## Would Cause Server Errors ##
7575

plotly/grid_objs/grid_objs.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def __str__(self):
3333
return string.format(name=self.name, data=data_string, id=self.id)
3434

3535
def __repr__(self):
36-
return 'Column("{}", {})'.format(self.data, self.name)
36+
return 'Column("{0}", {1})'.format(self.data, self.name)
3737

3838
def to_plotly_json(self):
3939
return {'name': self.name, 'data': self.data}

plotly/matplotlylib/mpltools.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -386,7 +386,7 @@ def prep_ticks(ax, index, ax_type, props):
386386
for i in range(1, len(dticks) - 1)]):
387387
dtick = tickvalues[1] - tickvalues[0]
388388
else:
389-
warnings.warn("'linear' {}-axis tick spacing not even, "
389+
warnings.warn("'linear' {0}-axis tick spacing not even, "
390390
"ignoring mpl tick formatting.".format(ax_type))
391391
raise TypeError
392392
except (IndexError, TypeError):
@@ -413,7 +413,7 @@ def prep_ticks(ax, index, ax_type, props):
413413
math.log10(props['ylim'][1])]
414414
else:
415415
axis_dict = dict(range=None, type='linear')
416-
warnings.warn("Converted non-base10 {}-axis log scale to 'linear'"
416+
warnings.warn("Converted non-base10 {0}-axis log scale to 'linear'"
417417
"".format(ax_type))
418418
else:
419419
return dict()

plotly/tests/test_core/test_plotly/test_plot.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,8 @@ class TestPlot(TestCase):
6262

6363
def test_plot_empty_data(self):
6464
py.sign_in('PlotlyImageTest', '786r5mecv0')
65-
with self.assertRaises(PlotlyEmptyDataError):
66-
py.plot([], filename='plot_invalid')
65+
self.assertRaises(PlotlyEmptyDataError, py.plot, [],
66+
filename='plot_invalid')
6767

6868

6969
def test_bar():

plotly/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = '1.4.5'
1+
__version__ = '1.4.6'

0 commit comments

Comments
 (0)