Permalink
Browse files

Remove old deprecations (#5672)

* Remove deprecated code since 0.11.x

* Drop TitleProp and deprecated plot.title = "str"

* Update bokeh.charts to use plot.title.text

* Remove deprecated `resources` argument from components()

* Remove deprecated layout functions (since 0.12.0)

* Remove deprecated Plot's properties (since 0.12.0)

* Remove deprecated Builder.sort_legend (since 0.12.0)

* Update integration tests to use plot.title.text

* add migration notes
  • Loading branch information...
1 parent 5ba55a5 commit 4fbcfc07823be88eafe0d24cf0b88913a3f5b15c @mattpap mattpap committed with bryevdv Jan 10, 2017
View
@@ -1,5 +0,0 @@
-from bokeh.util.deprecation import deprecated
-deprecated((0, 11, 0), 'bokeh.browserlib', 'bokeh.util.browser')
-del deprecated
-
-from .util.browser import * # NOQA
@@ -36,9 +36,9 @@
from ..models import ColumnDataSource
from ..io import (
curdoc, output_file, output_notebook, output_server, push,
- reset_output, save, show, gridplot, vplot, hplot)
+ reset_output, save, show, gridplot)
# Silence pyflakes
(curdoc, output_file, output_notebook, output_server, push,
- reset_output, save, show, gridplot, vplot, hplot, ColumnDataSource,
+ reset_output, save, show, gridplot, ColumnDataSource,
DEFAULT_PALETTE)
@@ -15,7 +15,6 @@
from bokeh.core.properties import Bool, Color, Dict, Either, Enum, Instance, List, String, Tuple
from bokeh.models.ranges import FactorRange, Range, Range1d
from bokeh.models.sources import ColumnDataSource
-from bokeh.util.deprecation import deprecated
from .attributes import AttrSpec, CatAttr, ColorAttr
from .chart import Chart
@@ -198,14 +197,6 @@ class Builder(HasProps):
sort_dim = Dict(String, Bool, default={})
- sort_legend = List(Tuple(String, Bool), help="""
- List of tuples to use for sorting the legend, in order that they should be
- used for sorting. This sorting can be different than the sorting used for the
- rest of the chart. For example, you might want to sort only on the column
- assigned to the color attribute, or sort it descending. The order of each tuple
- is (Column, Ascending).
- """)
-
legend_sort_field = String(help="""
Attribute that should be used to sort the legend, for example: color,
dash, maker, etc. Valid values for this property depend on the type
@@ -227,7 +218,7 @@ class Builder(HasProps):
using the valid input for the `HoverTool` tooltips kwarg.
""")
- __deprecated_attributes__ = ('sort_legend',)
+ __deprecated_attributes__ = ()
def __init__(self, *args, **kws):
"""Common arguments to be used by all the inherited classes.
@@ -581,20 +572,6 @@ def foo(leg):
return legends
- @property
- def sort_legend(self):
- deprecated((0, 12, 0), 'Chart.sort_legend', 'Chart.legend_sort_field')
- return [(self.legend_sort_field, self.legend_sort_direction)]
-
- @sort_legend.setter
- def sort_legend(self, value):
- deprecated((0, 12, 0), 'Chart.sort_legend', 'Chart.legend_sort_field')
- self.legend_sort_field, direction = value[0]
- if direction:
- self.legend_sort_direction = "ascending"
- else:
- self.legend_sort_direction = "descending"
-
class XYBuilder(Builder):
"""Implements common functionality for XY Builders."""
@@ -116,7 +116,7 @@ def test_created_range_type(test_builder, test_data):
assert builder4.xscale == 'datetime'
def test_sort_legend(test_builder, test_data):
- test_builder = test_builder(test_data.pd_data, sort_legend=[('color', 'ascending')])
+ test_builder = test_builder(test_data.pd_data, legend_sort_field='color', legend_sort_direction='ascending')
assert test_builder.legend_sort_field == 'color'
assert test_builder.legend_sort_direction == 'ascending'
@@ -49,7 +49,7 @@ def setUp(self):
)
def test_title(self):
- self.chart.title = "new_title"
+ self.chart.title.text = "new_title"
self.assertEqual(self.chart.title.text, "new_title")
def test_sizing_mode(self):
@@ -106,7 +106,6 @@ class SomeModel(Model):
from ..colors import RGB
from ..util.dependencies import import_optional
-from ..util.deprecation import deprecated
from ..util.serialization import transform_column_source_data, decode_base64_dict
from ..util.string import nice_join
from .property.bases import ContainerProperty, DeserializationError, ParameterizedProperty, Property, PrimitiveProperty
@@ -1135,35 +1134,6 @@ def validate(self, value):
raise ValueError("Expected a timedelta instance, got %r" % value)
-class TitleProp(Either):
- ''' Accept a title value for a plot (possibly transforming a plain string).
-
- .. note::
- This property exists only to support a deprecation, and will be removed
- in the future once the deprecation is completed.
-
- '''
- def __init__(self, default=None, help=None):
- types = (Instance('bokeh.models.annotations.Title'), String)
- super(TitleProp, self).__init__(*types, default=default, help=help)
-
- def transform(self, value):
- if isinstance(value, str):
- from bokeh.models.annotations import Title
- deprecated('''Setting Plot property 'title' using a string was deprecated in 0.12.0,
- and will be removed. The title is now an object on Plot (which holds all of it's
- styling properties). Please use Plot.title.text instead.
-
- SERVER USERS: If you were using plot.title to have the server update the plot title
- in a callback, you MUST update to plot.title.text as the title object cannot currently
- be replaced after initialization.
- ''')
- value = Title(text=value)
- return value
-
- def _sphinx_type(self):
- return self._sphinx_prop_link()
-
#------------------------------------------------------------------------------
# Container properties
#------------------------------------------------------------------------------
@@ -10,12 +10,11 @@
NumberSpec, ColorSpec, Bool, Int, Float, Complex, String,
Regex, Seq, List, Dict, Tuple, Array, Instance, Any, Interval, Either,
Enum, Color, DashPattern, Size, Percent, Angle, AngleSpec,
- DistanceSpec, FontSizeSpec, Override, Include, MinMaxBounds, TitleProp)
+ DistanceSpec, FontSizeSpec, Override, Include, MinMaxBounds)
from bokeh.core.has_props import HasProps
from bokeh.models import Plot
-from bokeh.models.annotations import Title
class Basictest(unittest.TestCase):
@@ -1652,13 +1651,6 @@ class Foo6(HasProps):
foo6=bokeh.core.tests.test_properties.Foo6(
foo5=bokeh.core.tests.test_properties.Foo5(...)))"""
-def test_titleprop_transforms_string_into_title_object():
- class Foo(HasProps):
- title = TitleProp
- f = Foo(title="hello")
- assert isinstance(f.title, Title)
- assert f.title.text == "hello"
-
def test_field_function():
assert field("foo") == dict(field="foo")
# TODO (bev) would like this to work I think
View
@@ -50,7 +50,6 @@ def wraps(obj, attr_names=WRAPPER_ASSIGNMENTS, wraps=wraps):
from .themes import default as default_theme
from .themes import Theme
from .util.callback_manager import _check_callback
-from .util.deprecation import deprecated
from .util.version import __version__
from .util.serialization import make_id
@@ -528,24 +527,6 @@ def add_root(self, model, setter=None):
self._pop_all_models_freeze()
self._trigger_on_change(RootAddedEvent(self, model, setter))
- def add(self, *objects):
- """ Call add_root() on each object.
-
- .. warning::
- This function should only be called on top level objects such
- as Plot, and Layout containers.
-
- Args:
- *objects (Model) : objects to add to the Document
-
- Returns:
- None
-
- """
- deprecated((0, 11, 0), 'Document.add()', 'Document.add_root()')
- for obj in objects:
- self.add_root(obj)
-
def remove_root(self, model, setter=None):
''' Remove a model as root model from this Document.
View
@@ -28,7 +28,6 @@
from .resources import BaseResources, _SessionCoordinates, EMPTY
from .util.string import encode_utf8
from .util.serialization import make_id
-from .util.deprecation import deprecated
def _indent(text, n=2):
return "\n".join([ " "*n + line for line in text.split("\n") ])
@@ -50,7 +49,7 @@ def _wrap_in_onload(code):
})();
""" % dict(code=_indent(code, 4))
-def components(models, resources=None, wrap_script=True, wrap_plot_info=True):
+def components(models, wrap_script=True, wrap_plot_info=True):
'''
Return HTML components to embed a Bokeh plot. The data for the plot is
stored directly in the returned HTML.
@@ -65,9 +64,6 @@ def components(models, resources=None, wrap_script=True, wrap_plot_info=True):
models (Model|list|dict|tuple) :
A single Model, a list/tuple of Models, or a dictionary of keys and Models.
- resources :
- Deprecated argument
-
wrap_script (boolean, optional) :
If True, the returned javascript is wrapped in a script tag.
(default: True)
@@ -120,10 +116,6 @@ def components(models, resources=None, wrap_script=True, wrap_plot_info=True):
# => (javascript, {"Plot 1": plot1_dict, "Plot 2": plot2_dict})
'''
- if resources is not None:
- deprecated('Because the ``resources`` argument is no longer needed, '
- 'it is deprecated and no longer has any effect.')
-
# 1) Convert single items and dicts into list
was_single_object = isinstance(models, Model) or isinstance(models, Document)
View
@@ -29,7 +29,7 @@
from .core.state import State
from .document import Document
from .embed import notebook_div, standalone_html_page_for_models, autoload_server
-from .models.layouts import LayoutDOM, Row, Column, VBoxForm
+from .models.layouts import LayoutDOM
from .layouts import gridplot, GridSpec ; gridplot, GridSpec
from .model import _ModelInDocument
from .util.deprecation import deprecated
@@ -601,21 +601,3 @@ def _remove_roots(subplots):
for sub in subplots:
if sub in doc.roots:
doc.remove_root(sub)
-
-def hplot(*children, **kwargs):
- deprecated((0, 12, 0), 'bokeh.io.hplot()', 'bokeh.models.layouts.Row')
- layout = Row(children=list(children), **kwargs)
- return layout
-
-
-def vplot(*children, **kwargs):
- deprecated((0, 12, 0), 'bokeh.io.vplot()', 'bokeh.models.layouts.Column')
- layout = Column(children=list(children), **kwargs)
- return layout
-
-
-def vform(*children, **kwargs):
- deprecated((0, 12, 0), 'bokeh.io.vform()', 'bokeh.models.layouts.WidgetBox')
- # Returning a VBoxForm, because it has helpers so that
- # Bokeh deprecates gracefully.
- return VBoxForm(*children, **kwargs)
View
@@ -356,7 +356,7 @@ def gridplot(*args, **kwargs):
raise ValueError("Cannot provide a nested list when using ncols")
children = list(_chunks(children, ncols))
- # Additional children set-up for GridPlot
+ # Additional children set-up for grid plot
if not children:
children = []
View
@@ -1,5 +0,0 @@
-from bokeh.util.deprecation import deprecated
-deprecated((0, 11, 0), 'bokeh.mixins', 'bokeh.core.property_mixins')
-del deprecated
-
-from .core.property_mixins import * # NOQA
@@ -22,18 +22,4 @@
from .tiles import *
from .tools import *
from .transforms import *
-
-### Deprecation note:
-### bokeh.models.widgets.layouts was deprecated in 0.11.1 in favor of
-### bokeh.models.layouts and is awaiting removal. The following imports will
-### load all widgets modules except layouts, in order to prevent raising a
-### deprecation warning.
-
-from .widgets.buttons import *
-from .widgets.groups import *
-from .widgets.icons import *
-from .widgets.inputs import *
-from .widgets.markups import *
-from .widgets.panels import *
-from .widgets.tables import *
-from .widgets.widget import *
+from .widgets import *
@@ -3,7 +3,6 @@
"""
from __future__ import absolute_import
-import warnings
import logging
logger = logging.getLogger(__name__)
@@ -17,7 +16,6 @@
from ..core.properties import abstract, Bool, Enum, Int, Instance, List, Seq, String
from ..embed import notebook_div
from ..model import Model
-from ..util.deprecation import deprecated
@abstract
@@ -217,33 +215,3 @@ def VBox(*args, **kwargs):
Returns a Column instance.
"""
return Column(*args, **kwargs)
-
-# ---- DEPRECATIONS
-
-def GridPlot(*args, **kwargs):
- deprecated((0, 12, 0), 'bokeh.models.layout.GridPlot', 'bokeh.layouts.gridplot')
- from bokeh.layouts import gridplot
- return gridplot(*args, **kwargs)
-
-def VBoxForm(*args, **kwargs):
- deprecated((0, 12, 0), 'bokeh.models.layout.VBoxForm', 'bokeh.models.layouts.WidgetBox')
- from bokeh.models.widgets.widget import Widget
-
- if len(args) > 0 and "children" in kwargs:
- raise ValueError("'children' keyword cannot be used with positional arguments")
- elif len(args) > 0:
- children = list(args)
- else:
- children = kwargs.get("children", [])
- is_widget = [isinstance(item, Widget) for item in children]
- if all(is_widget):
- return WidgetBox(*args, **kwargs)
- else:
- warnings.warn(
- """WARNING: Non-widgets added to VBoxForm! VBoxForm is deprecated and is
- being replaced with WidgetBox. WidgetBox does not allow you to add non-widgets to it.
- We have transformed your request into a Column, with your Plots and WidgetBox(es) inside
- it. In the future, you will need to update your code to use Row and Column. You may
- find the new bokeh.layouts functions helpful.
- """)
- return Column(*args, **kwargs)
Oops, something went wrong.

0 comments on commit 4fbcfc0

Please sign in to comment.