Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Require python 3.6 and CI maintenance #3160

Merged
merged 37 commits into from
Apr 22, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
699a925
Update setup.py to require Python>=3.6
jonmmease Apr 21, 2021
5fae5e0
Add an f-string (compatible with python>=3.6) for good measure
jonmmease Apr 21, 2021
841da65
remove pre 3.6 tests from tox and circleci
jonmmease Apr 21, 2021
4608f1e
First cut at abandoning tox
jonmmease Apr 21, 2021
3af133a
Rename plot_ly in chart_studio in ci tests
jonmmease Apr 21, 2021
028b960
Remove tox.ini files
jonmmease Apr 21, 2021
b17d6ac
Move tests with pandas/numpy dependencies to test_optional, remove th…
jonmmease Apr 21, 2021
8d83a81
Move more px tests to optional
jonmmease Apr 21, 2021
9a5c76f
increase optional timeout
jonmmease Apr 21, 2021
1014fda
Move another test with px to optional
jonmmease Apr 21, 2021
3becff8
blacken
jonmmease Apr 21, 2021
4effc46
Fix relative import
jonmmease Apr 21, 2021
87d5d05
Move dependency check tests to optional
jonmmease Apr 21, 2021
ca57ddb
more logging in optional test suite
jonmmease Apr 21, 2021
0b92a0e
Don't open browser window in matplotlylib test
jonmmease Apr 21, 2021
b759248
Add Python 3.8 and 3.9 tests
jonmmease Apr 21, 2021
8d013d1
pull dependencies for conda test case from same option requirements.t…
jonmmease Apr 21, 2021
7bdfcb0
fix indentation
jonmmease Apr 21, 2021
8d2ac6e
Activate conda environment before pip install
jonmmease Apr 21, 2021
0c85dc5
Fix 3.8/3.9 ci images
jonmmease Apr 21, 2021
bf1d1d8
Try again with pip install in conda environment
jonmmease Apr 21, 2021
6c10e9b
Set pandas plotting backend explicitly
jonmmease Apr 21, 2021
7820bbc
Fix working directory on pip install
jonmmease Apr 21, 2021
821231c
Don't fail on old versions of pandas
jonmmease Apr 21, 2021
331118e
path fix
jonmmease Apr 21, 2021
8623079
Don't fail on any exception when setting pandas backend
jonmmease Apr 21, 2021
cb0ff7c
blacken
jonmmease Apr 21, 2021
e0b6ce5
Another try
jonmmease Apr 21, 2021
94cdd99
Another try
jonmmease Apr 21, 2021
b072478
pip install into the right conda environment.
jonmmease Apr 21, 2021
1f37f16
Add psutil as optional dependency for orca tests
jonmmease Apr 21, 2021
2ac4f63
Add requirement.txt to conda ci job cache key
jonmmease Apr 21, 2021
ddb2741
Add poppler to orca tests
jonmmease Apr 21, 2021
4080677
Try reverting orca environment
jonmmease Apr 21, 2021
44f8dd6
disable non-orca tests
jonmmease Apr 21, 2021
6204354
Enable other CI tests
jonmmease Apr 21, 2021
d5d9ee6
Merge remote-tracking branch 'origin/master' into python3
jonmmease Apr 22, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
280 changes: 108 additions & 172 deletions .circleci/config.yml

Large diffs are not rendered by default.

12 changes: 12 additions & 0 deletions packages/python/chart-studio/test_requirements/requirements_37.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
decorator==4.0.9
nose==1.3.7
requests==2.12.4
six==1.10.0
pytz==2016.10
retrying==1.3.3
pytest==3.5.1
pandas==0.23.2
numpy==1.14.3
ipywidgets==7.2.0
matplotlib==2.2.3
--editable=./plotly
86 changes: 0 additions & 86 deletions packages/python/chart-studio/tox.ini

This file was deleted.

2 changes: 1 addition & 1 deletion packages/python/plotly/_plotly_utils/optional_imports.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@ def get_module(name, should_load=True):
_not_importable.add(name)
except Exception as e:
_not_importable.add(name)
msg = "Error importing optional module {}".format(name)
msg = f"Error importing optional module {name}"
logger.exception(msg)
Original file line number Diff line number Diff line change
Expand Up @@ -66,36 +66,6 @@ def test_add_traces(self):
)


class TestAddTracesRowsColsDataTypes(TestCase):
def test_add_traces_with_iterable(self):
import plotly.express as px

df = px.data.tips()
fig = px.scatter(df, x="total_bill", y="tip", color="day")
from plotly.subplots import make_subplots

fig2 = make_subplots(1, 2)
fig2.add_traces(fig.data, rows=[1,] * len(fig.data), cols=[1,] * len(fig.data))

expected_data_length = 4

self.assertEqual(expected_data_length, len(fig2.data))

def test_add_traces_with_integers(self):
import plotly.express as px

df = px.data.tips()
fig = px.scatter(df, x="total_bill", y="tip", color="day")
from plotly.subplots import make_subplots

fig2 = make_subplots(1, 2)
fig2.add_traces(fig.data, rows=1, cols=2)

expected_data_length = 4

self.assertEqual(expected_data_length, len(fig2.data))


def test_add_trace_exclude_empty_subplots():
# Add traces
fig = make_subplots(2, 2)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,8 @@

from unittest import TestCase

import json as _json

from plotly.utils import PlotlyJSONEncoder, get_by_path, node_generator
from time import time
import numpy as np
import plotly.graph_objects as go
import json as _json


class TestJSONEncoder(TestCase):
Expand All @@ -21,38 +17,6 @@ def test_invalid_encode_exception(self):
with self.assertRaises(TypeError):
_json.dumps({"a": {1}}, cls=PlotlyJSONEncoder)

def test_fast_track_finite_arrays(self):
# if NaN or Infinity is found in the json dump
# of a figure, it is decoded and re-encoded to replace these values
# with null. This test checks that NaN and Infinity values are
# indeed converted to null, and that the encoding of figures
# without inf or nan is faster (because we can avoid decoding
# and reencoding).
z = np.random.randn(100, 100)
x = np.arange(100.0)
fig_1 = go.Figure(go.Heatmap(z=z, x=x))
t1 = time()
json_str_1 = _json.dumps(fig_1, cls=PlotlyJSONEncoder)
t2 = time()
x[0] = np.nan
x[1] = np.inf
fig_2 = go.Figure(go.Heatmap(z=z, x=x))
t3 = time()
json_str_2 = _json.dumps(fig_2, cls=PlotlyJSONEncoder)
t4 = time()
assert t2 - t1 < t4 - t3
assert "null" in json_str_2
assert "NaN" not in json_str_2
assert "Infinity" not in json_str_2
x = np.arange(100.0)
fig_3 = go.Figure(go.Heatmap(z=z, x=x))
fig_3.update_layout(title_text="Infinity")
t5 = time()
json_str_3 = _json.dumps(fig_3, cls=PlotlyJSONEncoder)
t6 = time()
assert t2 - t1 < t6 - t5
assert "Infinity" in json_str_3


class TestGetByPath(TestCase):
def test_get_by_path(self):
Expand Down Expand Up @@ -86,46 +50,3 @@ def test_node_generator(self):
]
for i, item in enumerate(node_generator(node0)):
self.assertEqual(item, expected_node_path_tuples[i])


class TestNumpyIntegerBaseType(TestCase):
def test_numpy_integer_import(self):
# should generate a figure with subplots of array and not throw a ValueError
import numpy as np
import plotly.graph_objects as go
from plotly.subplots import make_subplots

indices_rows = np.array([1], dtype=np.int)
indices_cols = np.array([1], dtype=np.int)
fig = make_subplots(rows=1, cols=1)
fig.add_trace(go.Scatter(y=[1]), row=indices_rows[0], col=indices_cols[0])

data_path = ("data", 0, "y")
value = get_by_path(fig, data_path)
expected_value = (1,)
self.assertEqual(value, expected_value)

def test_get_numpy_int_type(self):
import numpy as np
from _plotly_utils.utils import _get_int_type

int_type_tuple = _get_int_type()
expected_tuple = (int, np.integer)

self.assertEqual(int_type_tuple, expected_tuple)


class TestNoNumpyIntegerBaseType(TestCase):
def test_no_numpy_int_type(self):
import sys
from _plotly_utils.utils import _get_int_type
from _plotly_utils.optional_imports import get_module

np = get_module("numpy", should_load=False)
if np:
sys.modules.pop("numpy")

int_type_tuple = _get_int_type()
expected_tuple = (int,)

self.assertEqual(int_type_tuple, expected_tuple)
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
import sys
import pytest
import json
from common import _cmp_partial_dict, _check_figure_layout_objects
from .common import _cmp_partial_dict, _check_figure_layout_objects


@pytest.fixture
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from plotly.basedatatypes import _indexing_combinations
import plotly.express as px
import pytest
from common import _cmp_partial_dict, _check_figure_layout_objects
from .common import _cmp_partial_dict, _check_figure_layout_objects


@pytest.fixture
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ def test_iplot_works_after_you_call_init_notebook_mode(self):

@pytest.mark.matplotlib
def test_iplot_mpl_works(self):
plotly.offline.init_notebook_mode()
# Generate matplotlib plot for tests
fig = plt.figure()

Expand Down
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,33 @@ def test_subplot_titles_numpy_array(self):
subplot_titles=np.array(["", "Inset"]),
)
self.assertEqual(fig, expected)


class TestAddTracesRowsColsDataTypes(TestCase):
def test_add_traces_with_iterable(self):
import plotly.express as px

df = px.data.tips()
fig = px.scatter(df, x="total_bill", y="tip", color="day")
from plotly.subplots import make_subplots

fig2 = make_subplots(1, 2)
fig2.add_traces(fig.data, rows=[1,] * len(fig.data), cols=[1,] * len(fig.data))

expected_data_length = 4

self.assertEqual(expected_data_length, len(fig2.data))

def test_add_traces_with_integers(self):
import plotly.express as px

df = px.data.tips()
fig = px.scatter(df, x="total_bill", y="tip", color="day")
from plotly.subplots import make_subplots

fig2 = make_subplots(1, 2)
fig2.add_traces(fig.data, rows=1, cols=2)

expected_data_length = 4

self.assertEqual(expected_data_length, len(fig2.data))
Loading