Skip to content

Commit 2a44ce3

Browse files
authored
[v4 integration] Remove future flags (#1594)
* Init all future flags as enabled * Remove future flag disabled logic * Update v4 template colors * Remove deprecated imports, replace with error pointing to chart_studio package * Remove future flag specifications from tests * Fix test_core tests for v4 functionality * Update test_optional tests for v4 behavior * Remove test_plotly tests from the plotly project these still live in the chart_studio project * Disable template for test_offline tests * Update expected JSON encoding of Column dates * Only enable 'browser' default renderer if default browser can be found * Fix orca image renderers test * Fix JSON encoding tests * Disable template in orca image tests
1 parent 7cce283 commit 2a44ce3

File tree

111 files changed

+487
-7689
lines changed

Some content is hidden

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

111 files changed

+487
-7689
lines changed

_plotly_future_/__init__.py

Lines changed: 31 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,18 @@
11
import warnings
22
import functools
33

4-
_future_flags = set()
4+
# Initialize _future_flags with all future flags that are now always in
5+
# effect.
6+
_future_flags = {
7+
'renderer_defaults',
8+
'template_defaults',
9+
'extract_chart_studio',
10+
'remove_deprecations',
11+
'v4_subplots',
12+
'orca_defaults',
13+
'timezones',
14+
'trace_uids',
15+
}
516

617

718
def _assert_plotly_not_imported():
@@ -19,13 +30,20 @@ def _assert_plotly_not_imported():
1930

2031

2132
def _chart_studio_warning(submodule):
22-
if 'extract_chart_studio' in _future_flags:
23-
warnings.warn(
24-
'The plotly.{submodule} module is deprecated, '
25-
'please use chart_studio.{submodule} instead'
26-
.format(submodule=submodule),
27-
DeprecationWarning,
28-
stacklevel=2)
33+
warnings.warn(
34+
'The plotly.{submodule} module is deprecated, '
35+
'please use chart_studio.{submodule} instead'
36+
.format(submodule=submodule),
37+
DeprecationWarning,
38+
stacklevel=2)
39+
40+
41+
def _chart_studio_error(submodule):
42+
raise ImportError("""
43+
The plotly.{submodule} module is deprecated,
44+
please install the chart_studio package and use the
45+
chart_studio.{submodule} module instead.
46+
""".format(submodule=submodule))
2947

3048

3149
def _chart_studio_deprecation(fn):
@@ -43,15 +61,14 @@ def _chart_studio_deprecation(fn):
4361

4462
@functools.wraps(fn)
4563
def wrapper(*args, **kwargs):
46-
if 'extract_chart_studio' in _future_flags:
47-
warnings.warn(
48-
msg,
49-
DeprecationWarning,
50-
stacklevel=2)
64+
warnings.warn(
65+
msg,
66+
DeprecationWarning,
67+
stacklevel=2)
5168

5269
return fn(*args, **kwargs)
5370

5471
return wrapper
5572

5673

57-
__all__ = ['_future_flags', '_chart_studio_warning']
74+
__all__ = ['_future_flags', '_chart_studio_error']
Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +0,0 @@
1-
from __future__ import absolute_import
2-
from _plotly_future_ import _future_flags, _assert_plotly_not_imported
3-
4-
_assert_plotly_not_imported()
5-
_future_flags.add('extract_chart_studio')

_plotly_future_/orca_defaults.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +0,0 @@
1-
from __future__ import absolute_import
2-
from _plotly_future_ import _future_flags, _assert_plotly_not_imported
3-
4-
_assert_plotly_not_imported()
5-
_future_flags.add('orca_defaults')
Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +0,0 @@
1-
from __future__ import absolute_import
2-
from _plotly_future_ import _future_flags, _assert_plotly_not_imported
3-
4-
_assert_plotly_not_imported()
5-
_future_flags.add('remove_deprecations')

_plotly_future_/renderer_defaults.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +0,0 @@
1-
from __future__ import absolute_import
2-
from _plotly_future_ import _future_flags, _assert_plotly_not_imported
3-
4-
_assert_plotly_not_imported()
5-
_future_flags.add('renderer_defaults')

_plotly_future_/template_defaults.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +0,0 @@
1-
from __future__ import absolute_import
2-
from _plotly_future_ import _future_flags, _assert_plotly_not_imported
3-
4-
_assert_plotly_not_imported()
5-
_future_flags.add('template_defaults')

_plotly_future_/timezones.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +0,0 @@
1-
from __future__ import absolute_import
2-
from _plotly_future_ import _future_flags, _assert_plotly_not_imported
3-
4-
_assert_plotly_not_imported()
5-
_future_flags.add('timezones')

_plotly_future_/trace_uids.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +0,0 @@
1-
from __future__ import absolute_import
2-
from _plotly_future_ import _future_flags, _assert_plotly_not_imported
3-
4-
_assert_plotly_not_imported()
5-
_future_flags.add('trace_uids')

_plotly_future_/v4.py

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +0,0 @@
1-
from __future__ import absolute_import
2-
from _plotly_future_ import (
3-
renderer_defaults,
4-
template_defaults,
5-
extract_chart_studio,
6-
remove_deprecations,
7-
v4_subplots,
8-
orca_defaults,
9-
timezones,
10-
trace_uids,
11-
)
12-

_plotly_future_/v4_subplots.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +0,0 @@
1-
from __future__ import absolute_import
2-
from _plotly_future_ import _future_flags, _assert_plotly_not_imported
3-
4-
_assert_plotly_not_imported()
5-
_future_flags.add('v4_subplots')

0 commit comments

Comments
 (0)