ContinuumIO/bokeh — pull request #1052 by mattpap (2014-08-24 09:46:57+00:00)
Title: Introduce lazy default values and don't require dummy data sources

`Glyph.data_source` is now defined as `data_source = Instance(DataSource, lambda: ColumnDataSource())`. This allows to not set `data_source` explicitly. This obviously works for other properties as well. Note that we take advantage of subtyping here setting an instance of specific type of data source to a property that accepts the generic interface. Unfortunately, in bokehjs this isn't respected and currently implementation of column data source leaks where it shouldn't, so the abstraction is broken. Next, I changed how `source_v_select()` computes length of columns. Now I take minimum value instead of first arbitrary value and warn/raise exceptions to notify user about problems. All this allows changes to, for example, `gears.py`, so that we don't have to add `ColumnDataSource(dummy=[0])` (or similar) whenever a glyph takes only scalar values. Actually, thanks to lazy default values, we don't have to explicitly specify any data source in this case. For now I tested all glyph examples and they seem to work, but this is a deep change, so there might be some cases to fix (especially in relation to column lengths).