Hello community,
here is the log from the commit of package python-altair-widgets for
openSUSE:Factory checked in at 2019-11-29 15:58:36
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-altair-widgets (Old)
and /work/SRC/openSUSE:Factory/.python-altair-widgets.new.26869 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-altair-widgets"
Fri Nov 29 15:58:36 2019 rev:2 rq:751384 version:0.2.2
Changes:
--------
---
/work/SRC/openSUSE:Factory/python-altair-widgets/python-altair-widgets.changes
2019-05-22 11:07:34.762585272 +0200
+++
/work/SRC/openSUSE:Factory/.python-altair-widgets.new.26869/python-altair-widgets.changes
2019-11-29 16:02:52.844806319 +0100
@@ -1,0 +2,17 @@
+Wed Nov 27 15:40:22 UTC 2019 - Todd R <[email protected]>
+
+- Drop python2 support due to missing python2 support in dependencies.
+
+-------------------------------------------------------------------
+Tue Nov 12 16:54:17 UTC 2019 - Todd R <[email protected]>
+
+- Update to 0.2.2
+ * MAINT: get working with latest versions of Altair and ipywidgets
+ * BUG: work with current versions of altair and ipywidgets
+ * Instead of using a hard-coded list, pull the channels from altair API
+ * MAINT: disable options button
+ * Pulling functions from the altair API
+ * Pulling mark names from the altair API
+ * Pulling the typecodes from the altair API
+
+-------------------------------------------------------------------
Old:
----
altair_widgets-0.1.2.tar.gz
New:
----
altair_widgets-0.2.2.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ python-altair-widgets.spec ++++++
--- /var/tmp/diff_new_pack.uYRGEJ/_old 2019-11-29 16:02:53.392806094 +0100
+++ /var/tmp/diff_new_pack.uYRGEJ/_new 2019-11-29 16:02:53.396806092 +0100
@@ -17,9 +17,10 @@
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
+%define skip_python2 1
%bcond_with test
Name: python-altair-widgets
-Version: 0.1.2
+Version: 0.2.2
Release: 0
Summary: Interactive visualization package for statistical data for
Python
License: BSD-3-Clause
@@ -29,18 +30,18 @@
BuildRequires: %{python_module setuptools}
BuildRequires: fdupes
BuildRequires: python-rpm-macros
-Requires: python-altair
+Requires: python-altair >= 2.0.0
Requires: python-ipython
-Requires: python-ipywidgets
+Requires: python-ipywidgets >= 7.0.0
Requires: python-pandas
Requires: python-vega >= 0.4.4
Provides: python-jupyter_altair-widgets = %{version}
Obsoletes: python-jupyter_altair-widgets <= %{version}
BuildArch: noarch
%if %{with test}
-BuildRequires: %{python_module altair}
+BuildRequires: %{python_module altair >= 2.0.0}
BuildRequires: %{python_module ipython}
-BuildRequires: %{python_module ipywidgets}
+BuildRequires: %{python_module ipywidgets >= 7.0.0}
BuildRequires: %{python_module pandas}
BuildRequires: %{python_module pytest}
BuildRequires: %{python_module vega >= 0.4.4}
++++++ altair_widgets-0.1.2.tar.gz -> altair_widgets-0.2.2.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/altair_widgets-0.1.2/PKG-INFO
new/altair_widgets-0.2.2/PKG-INFO
--- old/altair_widgets-0.1.2/PKG-INFO 2017-07-11 14:36:28.000000000 +0200
+++ new/altair_widgets-0.2.2/PKG-INFO 2019-09-18 21:49:32.000000000 +0200
@@ -1,10 +1,10 @@
Metadata-Version: 1.1
Name: altair_widgets
-Version: 0.1.2
+Version: 0.2.2
Summary: Altair Widgets: An interactive visualization for statistical data for
Python.
Home-page: http://altair-viz.github.io
Author: Scott Sievert
-Author-email: [email protected]
+Author-email: [email protected]
License: BSD 3-clause
Download-URL: http://github.com/altair-viz/altair_widgets/
Description:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/altair_widgets-0.1.2/README.md
new/altair_widgets-0.2.2/README.md
--- old/altair_widgets-0.1.2/README.md 2016-11-16 05:15:58.000000000 +0100
+++ new/altair_widgets-0.2.2/README.md 2019-02-28 16:30:44.000000000 +0100
@@ -34,6 +34,9 @@
$ jupyter nbextension enable --py --sys-prefix vega
```
+altair_widgets will not work with Google Colab as Colab does not support
ipywidgets.
+To track ipywidgets support on Google Colab, see
https://github.com/googlecolab/colabtools/issues/60.
+
[Altair]:https://altair-viz.github.io
[vega-lite]:https://vega.github.io
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/altair_widgets-0.1.2/altair_widgets/__init__.py
new/altair_widgets-0.2.2/altair_widgets/__init__.py
--- old/altair_widgets-0.1.2/altair_widgets/__init__.py 2017-07-10
23:31:59.000000000 +0200
+++ new/altair_widgets-0.2.2/altair_widgets/__init__.py 2019-09-18
21:49:24.000000000 +0200
@@ -1,3 +1,4 @@
-__version__ = '0.1.2'
+# update with `python setup.py build; python setup.py sdist upload`
+__version__ = '0.2.2'
from .widget import interact_with
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/altair_widgets-0.1.2/altair_widgets/widget.py
new/altair_widgets-0.2.2/altair_widgets/widget.py
--- old/altair_widgets-0.1.2/altair_widgets/widget.py 2017-04-11
15:13:29.000000000 +0200
+++ new/altair_widgets-0.2.2/altair_widgets/widget.py 2019-02-28
16:32:25.000000000 +0100
@@ -1,7 +1,9 @@
import altair
import ipywidgets as widgets
-from IPython.display import display, clear_output, display_pretty
+from ipywidgets import Layout
+from IPython.display import display, clear_output, display_pretty, HTML,
Image, SVG
import pandas as pd
+import io
def interact_with(df, ndims=3, **kwargs):
@@ -38,17 +40,17 @@
- Interact.plot(self, settings, show=True):
"""
+
def __init__(self, df, ndims=3, show=True):
if not isinstance(df, pd.core.frame.DataFrame):
- raise ValueError('Interact takes a DataFrame as input')
+ raise ValueError("Interact takes a DataFrame as input")
columns = [None] + _get_columns(df)
+ # columns = _get_columns(df)
self.columns = columns
encodings = _get_encodings()
self.df = df
- encodings = [{'encoding': encoding}
- for encoding in encodings[:ndims]]
- self.settings = {'mark': {'mark': 'mark_point'},
- 'encodings': encodings}
+ encodings = [{"encoding": encoding} for encoding in encodings[:ndims]]
+ self.settings = {"mark": {"mark": "mark_point"}, "encodings":
encodings}
self.controller = self._generate_controller(ndims)
self.show = show
@@ -62,32 +64,40 @@
Toggles the "options" items.
"""
- if 'mark' in button.title:
+ if "mark" in button.title:
disable = 2
- defaults = {'log': False, 'bin': False, 'scale': 'linear',
- 'type': 'auto detect', 'aggregate': None, 'zero': True,
- 'color': None,
- 'applyColorToBackground': False,
- 'shortTimeLabels': False}
+ defaults = {
+ "log": False,
+ "bin": False,
+ "scale": "linear",
+ "type": "auto detect",
+ "aggregate": None,
+ "zero": True,
+ "color": None,
+ "applyColorToBackground": False,
+ "shortTimeLabels": False,
+ }
row = button.row
encoding = self.controller.children[row].children[disable].value
adv = _get_advanced_settings(encoding)
controllers = [_controllers_for(a) for a in adv]
for c in controllers:
- if c.title in self.settings['encodings'][row]:
- c.value = self.settings['encodings'][row][c.title]
+ if c.title in self.settings["encodings"][row]:
+ c.value = self.settings["encodings"][row][c.title]
else:
c.value = defaults[c.title]
c.row = row
- c.observe(self._update, names='value')
+ c.observe(self._update, names="value")
- visible = self.controller.children[row].children[-1].visible
- self.controller.children[row].children[disable].disabled = not visible
- self.controller.children[row].children[-1].visible = not visible
- controllers = controllers if not visible else []
- self.controller.children[row].children[-1].children = controllers
+ if False:
+ visible =
self.controller.children[row].children[-1].layout.visiblility
+ visible = bool(visible)
+ self.controller.children[row].children[disable].disabled = not
visible
+ self.controller.children[row].children[-1].visible = not visible
+ controllers = controllers if not visible else []
+ self.controller.children[row].children[-1].children = controllers
def _create_shelf(self, i=0):
"""
@@ -97,29 +107,30 @@
"""
encodings = _get_encodings()
- cols = widgets.Dropdown(options=self.columns, description='encode')
- encoding = widgets.Dropdown(options=encodings, description='as',
- value=encodings[i])
- encoding.layout.width = '20%'
+ cols = widgets.Dropdown(options=self.columns, description="encode")
+ encoding = widgets.Dropdown(
+ options=encodings, description="as", value=encodings[i]
+ )
+ encoding.layout.width = "20%"
- adv = widgets.VBox(children=[], visible=False)
+ adv = widgets.VBox(children=[], visible=False,
layout=Layout(visibility="hidden"))
- button = widgets.Button(description='options')
+ button = widgets.Button(description="options", disabled=True)
button.on_click(self._show_advanced)
- button.layout.width = '10%'
+ button.layout.width = "10%"
# The callbacks when the button is clicked
- encoding.observe(self._update, names='value')
- cols.observe(self._update, names='value')
+ encoding.observe(self._update, names="value")
+ cols.observe(self._update, names="value")
# Making sure we know what row we're in in the callbacks
encoding.row = cols.row = button.row = adv.row = i
# Have the titles so we know what button we're editing
- encoding.title = 'encoding'
- cols.title = 'field'
- button.title = 'button'
- adv.title = 'advanced'
+ encoding.title = "encoding"
+ cols.title = "field"
+ button.title = "button"
+ adv.title = "advanced"
return widgets.HBox([cols, encoding, button, adv])
@@ -137,78 +148,76 @@
Plots the function at the end of the update (this function is called on
click).
"""
- index = event['owner'].row
- title = event['owner'].title
- value = event['owner'].value
+ index = event["owner"].row
+ title = event["owner"].title
+ value = event["owner"].value
if index == -1:
- self.settings['mark'][title] = event['new']
+ self.settings["mark"][title] = event["new"]
else:
- if title == 'type' and 'auto' in value:
- self.settings['encodings'][index].pop('type', None)
- if title == 'text':
- if value is '':
- self.settings['encodings'][index].pop('text', None)
+ if title == "type" and "auto" in value:
+ self.settings["encodings"][index].pop("type", None)
+ if title == "text":
+ if value is "":
+ self.settings["encodings"][index].pop("text", None)
else:
- self.settings['encodings'][index]['field'] = value
+ self.settings["encodings"][index]["field"] = value
else:
- if event['new'] is None:
- self.settings['encodings'][index].pop(title)
+ if event["new"] is None:
+ self.settings["encodings"][index].pop(title)
else:
- self.settings['encodings'][index][title] = event['new']
+ self.settings["encodings"][index][title] = event["new"]
self.plot(self.settings)
def plot(self, show=True):
- """ Assumes nothing in self.settings is None (i.e., there are no keys
- in settings such that settings[key] == None"""
-
- kwargs = {e['encoding']: _get_plot_command(e)
- for e in self.settings['encodings']}
+ kwargs = {
+ e["encoding"]: _get_plot_command(e) for e in
self.settings["encodings"]
+ }
+ kwargs = {k: v for k, v in kwargs.items() if v is not None}
- mark_opts = {k: v for k, v in self.settings['mark'].items()}
- mark = mark_opts.pop('mark')
+ mark_opts = {k: v for k, v in self.settings["mark"].items()}
+ mark = mark_opts.pop("mark")
Chart_mark = getattr(altair.Chart(self.df), mark)
self.chart = Chart_mark(**mark_opts).encode(**kwargs)
if show and self.show:
clear_output()
- display(self.chart)
+ display("Updating...")
+ with io.StringIO() as f:
+ self.chart.save(f, format="svg")
+ f.seek(0)
+ html = f.read()
+ clear_output()
+ display(self.controller)
+ display(SVG(html))
def _generate_controller(self, ndims):
marks = _get_marks()
# mark button
- mark_choose = widgets.Dropdown(options=marks, description='Marks')
- mark_choose.observe(self._update, names='value')
- mark_choose.layout.width = '20%'
+ mark_choose = widgets.Dropdown(options=marks, description="Marks")
+ mark_choose.observe(self._update, names="value")
+ mark_choose.layout.width = "20%"
mark_choose.row = -1
- mark_choose.title = 'mark'
+ mark_choose.title = "mark"
# mark options button
- mark_but = widgets.Button(description='options')
- mark_but.layout.width = '10%'
+ mark_but = widgets.Button(description="options")
+ mark_but.layout.width = "10%"
mark_but.row = -1
- mark_but.title = 'mark_button'
+ mark_but.title = "mark_button"
# Mark options
mark_opt = widgets.VBox(children=[], visible=False)
mark_but.on_click(self._show_advanced)
- mark_opt.title = 'mark_options'
- mark_opt.layout.width = '300px'
+ mark_opt.title = "mark_options"
+ mark_opt.layout.width = "300px"
- add_dim = widgets.Button(description='add encoding')
+ add_dim = widgets.Button(description="add encoding")
add_dim.on_click(self._add_dim)
- to_altair = widgets.Button(description='chart.to_altair()')
- to_altair.on_click(self._to_altair)
-
dims = [self._create_shelf(i=i) for i in range(ndims)]
- choices = dims + [widgets.HBox([add_dim, to_altair, mark_choose,
- mark_but, mark_opt])]
+ choices = dims + [widgets.HBox([add_dim, mark_choose, mark_but,
mark_opt])]
return widgets.VBox(choices)
- def _to_altair(self, button):
- code = self.chart.to_altair()
- display_pretty(code, raw=True)
-
def _add_dim(self, button):
i = len(self.controller.children) - 1
encoding = _get_encodings()[i]
@@ -219,27 +228,35 @@
# clear_output()
# display(self.controller)
- self.settings['encodings'] += [{'encoding': encoding}]
+ self.settings["encodings"] += [{"encoding": encoding}]
self.plot(self.settings)
def _get_columns(df):
- return list(df.columns) + ['*']
+ return list(df.columns) + ["*"]
def _get_types():
- return ['quantitative', 'ordinal', 'nominal', 'temporal']
+ return list(altair.utils.core.TYPECODE_MAP.keys())
def _get_encodings():
- return ['x', 'y', 'color', 'text', 'row', 'column',
- 'opacity', 'shape', 'size']
+ # All the subclasses of altair.FieldChannelMixin, lowercase
+ encodings = []
+ for name in dir(altair):
+ value = getattr(altair, name)
+ if (type(value) is type and
+ issubclass(value, altair.FieldChannelMixin) and
+ name != 'FieldChannelMixin'):
+ encodings.append(name.lower())
+ # reorder to have the most useful encodings at the top
+ top = ['x', 'y', 'color']
+ others = sorted([e for e in encodings if e not in top])
+ return top + others
def _get_functions():
- return ['mean', 'min', 'max', 'median', 'average', 'sum',
- 'count', 'distinct', 'variance', 'stdev', 'q1', 'q3',
- 'argmin', 'argmax']
+ return altair.utils.core.AGGREGATES
def _get_marks():
@@ -247,11 +264,11 @@
>>> _get_marks()[0]
'mark_point'
"""
- return ['mark_' + f for f in ['point', 'circle', 'line', 'bar', 'tick',
- 'text', 'square', 'rule', 'area']]
+ return [m for m in dir(altair.mixins.MarkMethodMixin()) if
+ m.startswith('mark_')]
def _get_mark_params():
- return ['color', 'applyColorToBackground', 'shortTimeLabels']
+ return ["color", "applyColorToBackground", "shortTimeLabels"]
def _get_advanced_settings(e):
@@ -261,11 +278,10 @@
>>> _get_advanced_settings('x')
['type', 'bin', 'aggregate', 'zero', 'scale']
"""
- adv_settings = {e: ['type', 'bin', 'aggregate']
- for e in _get_encodings()}
- adv_settings['x'] += ['zero', 'scale']
- adv_settings['y'] += ['zero', 'scale']
- adv_settings['text'] += ['text']
+ adv_settings = {e: ["type", "bin", "aggregate"] for e in _get_encodings()}
+ adv_settings["x"] += ["zero", "scale"]
+ adv_settings["y"] += ["zero", "scale"]
+ adv_settings["text"] += ["text"]
mark_settings = {mark: _get_mark_params() for mark in _get_marks()}
adv_settings.update(mark_settings)
@@ -278,28 +294,31 @@
command.
"""
- colors = [None, 'blue', 'red', 'green', 'black']
- controllers = {'type': widgets.Dropdown(options=['auto detect'] +\
- _get_types(), description='type'),
- 'bin': widgets.Checkbox(description='bin'),
- 'aggregate': widgets.Dropdown(options=[None] +\
- _get_functions(), description='aggregate'),
- 'zero': widgets.Checkbox(description='zero'),
- 'text': widgets.Text(description='text value'),
- 'scale': widgets.Dropdown(options=['linear', 'log'],
- description='scale'),
- 'color': widgets.Dropdown(options=colors,
- description='main color'),
- 'applyColorToBackground':
widgets.Checkbox(description='applyColorToBackground'),
- 'shortTimeLabels':
widgets.Checkbox(description='shortTimeLabels')
- }
+ colors = [None, "blue", "red", "green", "black"]
+ controllers = {
+ "type": widgets.Dropdown(
+ options=["auto detect"] + _get_types(), description="type"
+ ),
+ "bin": widgets.Checkbox(description="bin"),
+ "aggregate": widgets.Dropdown(
+ options=[None] + _get_functions(), description="aggregate"
+ ),
+ "zero": widgets.Checkbox(description="zero"),
+ "text": widgets.Text(description="text value"),
+ "scale": widgets.Dropdown(options=["linear", "log"],
description="scale"),
+ "color": widgets.Dropdown(options=colors, description="main color"),
+ "applyColorToBackground": widgets.Checkbox(
+ description="applyColorToBackground"
+ ),
+ "shortTimeLabels": widgets.Checkbox(description="shortTimeLabels"),
+ }
for title, controller in controllers.items():
controller.title = title
- if 'Checkbox' in str(controller):
+ if "Checkbox" in str(controller):
# traits = dir(controller.layout)
# traits = [t for t in traits if t[0] != '_']
- controller.layout.max_width = '200ex'
+ controller.layout.max_width = "200ex"
# controller.layout.min_width = '100ex'
# controller.layout.width = '150ex'
@@ -315,16 +334,17 @@
>>> assert r.to_dict() == {'field': 'petalWidth', 'scale': {'type': 'log'}}
"""
d = {k: v for k, v in e.items()}
- if 'field' not in e:
+ if "field" not in e:
return
- encoding = d.pop('encoding')
- column = d.pop('field')
+ encoding = d.pop("encoding")
+ column = d.pop("field")
scale = {}
- if any([key in d for key in ['scale', 'zero']]):
- scale = {'scale': altair.Scale(type=d.pop('scale', None),
- zero=d.pop('zero', None))}
+ if any([key in d for key in ["scale", "zero"]]):
+ scale = {
+ "scale": altair.Scale(type=d.pop("scale", None),
zero=d.pop("zero", None))
+ }
d.update(scale)
return getattr(altair, encoding.capitalize())(column, **d)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/altair_widgets-0.1.2/altair_widgets.egg-info/PKG-INFO
new/altair_widgets-0.2.2/altair_widgets.egg-info/PKG-INFO
--- old/altair_widgets-0.1.2/altair_widgets.egg-info/PKG-INFO 2017-07-11
14:36:28.000000000 +0200
+++ new/altair_widgets-0.2.2/altair_widgets.egg-info/PKG-INFO 2019-09-18
21:49:32.000000000 +0200
@@ -1,10 +1,10 @@
Metadata-Version: 1.1
Name: altair-widgets
-Version: 0.1.2
+Version: 0.2.2
Summary: Altair Widgets: An interactive visualization for statistical data for
Python.
Home-page: http://altair-viz.github.io
Author: Scott Sievert
-Author-email: [email protected]
+Author-email: [email protected]
License: BSD 3-clause
Download-URL: http://github.com/altair-viz/altair_widgets/
Description:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/altair_widgets-0.1.2/altair_widgets.egg-info/requires.txt
new/altair_widgets-0.2.2/altair_widgets.egg-info/requires.txt
--- old/altair_widgets-0.1.2/altair_widgets.egg-info/requires.txt
2017-07-11 14:36:28.000000000 +0200
+++ new/altair_widgets-0.2.2/altair_widgets.egg-info/requires.txt
2019-09-18 21:49:32.000000000 +0200
@@ -1,5 +1,4 @@
ipython
-ipywidgets
-pandas
-altair
+ipywidgets>=7.0.0
+altair>=2.0.0
vega>=0.4.4
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/altair_widgets-0.1.2/setup.cfg
new/altair_widgets-0.2.2/setup.cfg
--- old/altair_widgets-0.1.2/setup.cfg 2017-07-11 14:36:28.000000000 +0200
+++ new/altair_widgets-0.2.2/setup.cfg 2019-09-18 21:49:32.000000000 +0200
@@ -1,5 +1,4 @@
[egg_info]
tag_build =
tag_date = 0
-tag_svn_revision = 0
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/altair_widgets-0.1.2/setup.py
new/altair_widgets-0.2.2/setup.py
--- old/altair_widgets-0.1.2/setup.py 2017-07-10 23:30:42.000000000 +0200
+++ new/altair_widgets-0.2.2/setup.py 2019-09-18 21:48:54.000000000 +0200
@@ -12,12 +12,11 @@
NAME = "altair_widgets"
PACKAGES = ['altair_widgets']
AUTHOR = "Scott Sievert"
-AUTHOR_EMAIL = "[email protected]"
+AUTHOR_EMAIL = "[email protected]"
URL = 'http://altair-viz.github.io'
DOWNLOAD_URL = 'http://github.com/altair-viz/altair_widgets/'
LICENSE = 'BSD 3-clause'
-INSTALL_REQUIRES = ['ipython', 'ipywidgets', 'pandas', 'altair',
- 'vega>=0.4.4']
+INSTALL_REQUIRES = ["ipython", "ipywidgets>=7.0.0", "altair>=2.0.0",
"vega>=0.4.4"]
import io
import os