Skip to content

Commit

Permalink
Merge pull request #13 from man-group/dtale_2.16.0
Browse files Browse the repository at this point in the history
Bumped D-Tale requirement to 2.16.0
  • Loading branch information
aschonfeld authored May 16, 2023
2 parents 94b950a + be48a27 commit 22bab75
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 29 deletions.
5 changes: 3 additions & 2 deletions autoplot-display/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
0.4.0
0.5.0
=====

- Compatibility bugfixes for D-Tale 2.15.2
- Bumped D-Tale dependency to 2.16.0


0.3.0
=====
Expand Down
2 changes: 1 addition & 1 deletion autoplot-display/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@mangroup/jupyterlab-autoplot-display",
"version": "0.4.0",
"version": "0.5.0",
"description": "The JupyterLab component for the Autoplot JupyterLab extension.",
"license": "BSD-3-Clause",
"keywords": [
Expand Down
2 changes: 1 addition & 1 deletion autoplot-display/src/version.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/
export namespace VERSION {
export const title = 'Autoplot Display';
export const version = '0.4.0';
export const version = '0.5.0';
export const module = '@jupyter-widgets/autoplot-display';

export const modelName = 'AutoplotDisplayModel';
Expand Down
13 changes: 4 additions & 9 deletions ipython-extension/autoplot/dtaler/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ def update_variables(self, pandas_vars: Dict[str, Union[pd.Series, pd.DataFrame]

def draw(self, force: bool, output: AutoplotDisplay) -> None:
refresh = False
current = dtale.get_instance(int(output.data_id))
current = dtale.get_instance(output.data_id)
if current is None:
current = Image(data=resource_filename(__name__, "assets/imgs/dtale.png"))
# The conditionals below encode precedence. Whatever the user wants to show takes is the preferred value to
Expand Down Expand Up @@ -173,12 +173,7 @@ def _remove_tracked_var(self, var_name: str):
if vardata:
data_id = vardata.dd._data_id
dtale.global_state.cleanup(data_id)
try:
# this will be fixed in newer version of D-Tale
del dtale.global_state._default_store._data_names[var_name]
except KeyError:
pass
self._deleted.append(str(vardata.dd._data_id))
self._deleted.append(vardata.dd._data_id)

def _add_tracked_var(self, name, var):
dd = self._dtale_show(data=var, ignore_duplicate=True, reaper_on=False, name=name, hide_shutdown=True)
Expand All @@ -189,13 +184,13 @@ def _update_tracked_var(self, name, var):
vardata = self._tracked[name]
vardata.dd.data = var
self._tracked[name] = VarData(pdf=var, dd=vardata.dd)
self._updated.append(str(vardata.dd._data_id))
self._updated.append(vardata.dd._data_id)


def _removed_in_dtale(tracked: Iterable) -> Set[str]:
removed: Set[str] = set()
for name, vardata in tracked:
if dtale.get_instance(int(vardata.dd._data_id)) is None:
if dtale.get_instance(vardata.dd._data_id) is None:
removed.add(name)
return removed

Expand Down
2 changes: 1 addition & 1 deletion ipython-extension/autoplot/extensions/autoplot_display.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

# these values must mach those in autoplot-display/version.ts
EXTENSION_TITLE = "Autoplot Display"
EXTENSION_VERSION = "0.4.0"
EXTENSION_VERSION = "0.5.0"
MODULE_NAME = "@jupyter-widgets/autoplot-display"

MODEL_NAME = "AutoplotDisplayModel"
Expand Down
4 changes: 2 additions & 2 deletions ipython-extension/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ def get_long_description():

setup(
name="jupyterlab-autoplot",
version="0.4.0",
version="0.5.0",
author="Man Alpha Technology",
author_email="[email protected]",
license="BSD 3-Clause",
Expand All @@ -19,7 +19,7 @@ def get_long_description():
keywords=["jupyter", "jupyterlab", "matplotlib", "mpld3", "time series"],
packages=find_packages(include=["autoplot", "autoplot.*"], exclude=["tests", "tests.*"]),
include_package_data=True,
install_requires=["ipywidgets", "ipython", "numpy", "pandas", "matplotlib", "mpld3", "dtale>=2.15.2"],
install_requires=["ipywidgets", "ipython", "numpy", "pandas", "matplotlib", "mpld3", "dtale>=2.16.0"],
tests_require=["pytest", "pytest-cov", "mock"],
classifiers=[
"Programming Language :: Python :: 3",
Expand Down
26 changes: 13 additions & 13 deletions ipython-extension/tests/unit/autoplot/test_dtaler.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def test_draw_new_dataframe(display_mock, dtaler):

vars["df2"] = df2
dtaler.update_variables(vars)
output.data_id = str(dtaler._tracked["df1"].dd._data_id)
output.data_id = dtaler._tracked["df1"].dd._data_id
dtaler.draw(False, output)

assert all(_get_parameter(display_mock).data == df2)
Expand All @@ -76,7 +76,7 @@ def test_draw_reassigned_dataframe(display_mock, dtaler):
new_df1 = pd.DataFrame({"a": [7, 8, 9]})
vars["df1"] = new_df1
dtaler.update_variables(vars)
output.data_id = str(dtaler._tracked["df1"].dd._data_id)
output.data_id = dtaler._tracked["df1"].dd._data_id
dtaler.draw(False, output)

assert all(_get_parameter(display_mock).data == df1)
Expand All @@ -95,7 +95,7 @@ def test_draw_does_not_reload_hidden_df(display_mock, dtaler):

vars["df1"] = pd.DataFrame({"a": [1, 2, 3]})
dtaler.update_variables(vars)
output.data_id = str(dtaler._tracked["df2"].dd._data_id)
output.data_id = dtaler._tracked["df2"].dd._data_id
dtaler.draw(False, output)

assert not display_mock.called
Expand All @@ -113,7 +113,7 @@ def test_draw_external_data_id_does_not_reload(display_mock, dtaler):
dtaler.update_variables(vars)

vars["df1"] = pd.DataFrame({"a": [1, 2, 3]})
output.data_id = str(dtale.show(df3, ignore_duplicate=True)._data_id)
output.data_id = dtale.show(df3, ignore_duplicate=True)._data_id
dtaler.update_variables(vars)
dtaler.draw(False, output)

Expand Down Expand Up @@ -163,7 +163,7 @@ def test_draw_doesnt_reload_hidden_dfs(display_mock, dtaler):
vars = {"df1": df1, "df2": df2}
dtaler.update_variables(vars)

output.data_id = str(dtaler._tracked["df1"].dd._data_id)
output.data_id = dtaler._tracked["df1"].dd._data_id
vars.pop("df2")
dtaler.update_variables(vars)
dtaler.draw(False, output)
Expand All @@ -181,7 +181,7 @@ def test_draw_reloads_when_visible_df_deleted(display_mock, dtaler):
vars = {"df1": df1, "df2": df2}
dtaler.update_variables(vars)

output.data_id = str(dtaler._tracked["df2"].dd._data_id)
output.data_id = dtaler._tracked["df2"].dd._data_id
vars.pop("df2")
dtaler.update_variables(vars)
dtaler.draw(False, output)
Expand Down Expand Up @@ -292,7 +292,7 @@ def test_ignore_current_variable_no_fallback(display_mock, dtaler):

dtaler.update_variables({"df1": df1})

output.data_id = str(dtaler._tracked["df1"].dd._data_id)
output.data_id = dtaler._tracked["df1"].dd._data_id
dtaler.ignore_variable(Toast(Output()), "df1")
dtaler.update_variables({"df1": df1})
dtaler.draw(False, output)
Expand All @@ -310,7 +310,7 @@ def test_ignore_current_variable_with_fallback(display_mock, dtaler):

dtaler.update_variables({"df1": df1, "df2": df2})

output.data_id = str(dtaler._tracked["df1"].dd._data_id)
output.data_id = dtaler._tracked["df1"].dd._data_id
dtaler.ignore_variable(Toast(Output()), "df1")
dtaler.update_variables({"df1": df1, "df2": df2})
dtaler.draw(False, output)
Expand All @@ -328,7 +328,7 @@ def test_ignore_other_variable_with_fallback(display_mock, dtaler):

dtaler.update_variables({"df1": df1, "df2": df2})

output.data_id = str(dtaler._tracked["df1"].dd._data_id)
output.data_id = dtaler._tracked["df1"].dd._data_id
dtaler.ignore_variable(Toast(Output()), "df2")
dtaler.update_variables({"df1": df1, "df2": df2})
dtaler.draw(False, output)
Expand All @@ -346,7 +346,7 @@ def test_show_ignored_variable(display_mock, dtaler):

dtaler.update_variables({"df1": df1, "df2": df2})

output.data_id = str(dtaler._tracked["df1"].dd._data_id)
output.data_id = dtaler._tracked["df1"].dd._data_id
dtaler.ignore_variable(Toast(Output()), "df2")
dtaler.update_variables({"df1": df1, "df2": df2})

Expand All @@ -367,7 +367,7 @@ def test_show_variable(display_mock, dtaler):

dtaler.update_variables({"df1": df1, "df2": df2})

output.data_id = str(dtaler._tracked["df2"].dd._data_id)
output.data_id = dtaler._tracked["df2"].dd._data_id
dtaler.show_variable(Toast(Output()), "df1")
dtaler.update_variables({"df1": df1, "df2": df2})
dtaler.draw(False, output)
Expand All @@ -385,7 +385,7 @@ def test_show_frozen_variable(display_mock, dtaler):

dtaler.update_variables({"df1": df1})

output.data_id = str(dtaler._tracked["df1"].dd._data_id)
output.data_id = dtaler._tracked["df1"].dd._data_id
dtaler.freeze(Toast(Output()))

dtaler.update_variables({"df1": df1, "df2": df2})
Expand All @@ -409,7 +409,7 @@ def test_delete_from_dtale_and_namespace(display_mock, dtaler):
output = AutoplotDisplay()

dtaler.update_variables({"df1": df1, "df2": df2})
output.data_id = str(dtaler._tracked["df1"].dd._data_id)
output.data_id = dtaler._tracked["df1"].dd._data_id

dtale.global_state.cleanup(dtaler._tracked["df1"].dd._data_id)
dtaler.update_variables({"df2": df2})
Expand Down

0 comments on commit 22bab75

Please sign in to comment.