Skip to content

Commit

Permalink
PATCH v0.2.1.1
Browse files Browse the repository at this point in the history
* remove __future__ annotations dependency
* remove channel inheritance in Enhance
* bugfix 3-clause Vis example in 5-datetime.ipynb
* update README
  • Loading branch information
dorisjlee committed Nov 30, 2020
1 parent 1034e2b commit 705cd05
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 18 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,9 @@ This installation includes the Lux Jupyter widget frontend, [lux-widget](https:/
jupyter nbextension enable --py luxwidget
```

If the installation happens correctly, you should see two `- Validating: OK` after executing the two lines above.
If the installation happens correctly, you should see two `- Validating: OK` after executing the two lines above.

Note that Lux currently only works with Jupyter notebooks in Chrome. Support for Jupyter Lab will be coming soon.
If you encounter issues with the installation, please refer to [this page](https://lux-api.readthedocs.io/en/latest/source/guide/FAQ.html#troubleshooting-tips) to troubleshoot the installation. Follow [these instructions](https://lux-api.readthedocs.io/en/latest/source/getting_started/installation.html#manual-installation-dev-setup) to set up Lux for development purposes.

# Support and Resources
Expand Down
2 changes: 1 addition & 1 deletion lux/_version.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env python
# coding: utf-8

version_info = (0, 2, 1)
version_info = (0, 2, 1, 1)
__version__ = ".".join(map(str, version_info))
3 changes: 3 additions & 0 deletions lux/action/enhance.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ def enhance(ldf):
recommendation["collection"] = []
return recommendation
intent = ldf._intent.copy()
# Clear channel so that channel not enforced based on input vis intent
for clause in intent:
clause.channel = ""
intent = filters + attr_specs
intent.append("?")
vlist = lux.vis.VisList.VisList(intent, ldf)
Expand Down
2 changes: 2 additions & 0 deletions lux/core/frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ class LuxDataFrame(pd.DataFrame):
# MUST register here for new properties!!
_metadata = [
"_intent",
"_inferred_intent",
"data_type_lookup",
"data_type",
"data_model_lookup",
Expand All @@ -60,6 +61,7 @@ def __init__(self, *args, **kw):

self._history = History()
self._intent = []
self._inferred_intent = []
self._recommendation = {}
self._saved_export = None
self._current_vis = []
Expand Down
1 change: 0 additions & 1 deletion lux/history/history.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.

from __future__ import annotations
from typing import List, Union, Callable, Dict
from lux.history.event import Event

Expand Down
16 changes: 4 additions & 12 deletions lux/vis/Vis.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.

from __future__ import annotations
from typing import List, Callable, Union
from lux.vis.Clause import Clause
from lux.utils.utils import check_import_lux_widget
Expand Down Expand Up @@ -321,14 +320,7 @@ def check_not_vislist_intent(self):
"For more information, see: https://lux-api.readthedocs.io/en/latest/source/guide/vis.html#working-with-collections-of-visualization-with-vislist"
)

if len(self._intent) < 3:
for i in range(len(self._intent)):
if type(self._intent[i]) != Clause and (
"|" in self._intent[i] or type(self._intent[i]) == list
):
raise TypeError(syntaxMsg)

if len(self._intent) > 2 or "?" in self._intent:
for i in range(len(self._intent)):
if type(self._intent[i]) != Clause:
raise TypeError(syntaxMsg)
for i in range(len(self._intent)):
clause = self._intent[i]
if type(clause) != Clause and ("|" in clause or type(clause) == list or "?" in clause):
raise TypeError(syntaxMsg)
6 changes: 3 additions & 3 deletions lux/vis/VisList.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

from __future__ import annotations

from lux.vislib.altair.AltairRenderer import AltairRenderer
from lux.utils.utils import check_import_lux_widget
from typing import List, Union, Callable, Dict
Expand Down Expand Up @@ -63,7 +63,7 @@ def set_intent(self, intent: List[Clause]) -> None:
self.refresh_source(self._source)

@property
def exported(self) -> VisList:
def exported(self):
"""
Get selected visualizations as exported Vis List
Expand Down Expand Up @@ -100,7 +100,7 @@ def exported(self) -> VisList:

def remove_duplicates(self) -> None:
"""
Removes duplicate visualizations in Vis List
Removes duplicate visualizations in VisList
"""
self._collection = list(set(self._collection))

Expand Down
4 changes: 4 additions & 0 deletions tests/test_action.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ def test_vary_filter_val(global_var):
df.set_intent_as_vis(vis)
df._repr_html_()
assert len(df.recommendation["Filter"]) == len(df["SportType"].unique()) - 1
linechart = list(filter(lambda x: x.mark == "line", df.recommendation["Enhance"]))[0]
assert (
linechart.get_attr_by_channel("x")[0].attribute == "Year"
), "Ensure recommended vis does not inherit input vis channel"


def test_filter_inequality(global_var):
Expand Down

0 comments on commit 705cd05

Please sign in to comment.