Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Jupyterlab Widget Save/Restore Symmetry #2465

Merged
merged 1 commit into from
Dec 12, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
assure restore symmetry
  • Loading branch information
ada-x64 committed Dec 5, 2023

Unverified

This user has not yet uploaded their public signing key.
commit ac810d0d42b7439830949029d0b461ba318b6a83
14 changes: 14 additions & 0 deletions packages/perspective-jupyterlab/test/jupyter/widget.spec.js
Original file line number Diff line number Diff line change
@@ -410,6 +410,20 @@ assert w.theme == "Pro Dark"
}
);

test_jupyter("Restores from saved config", [], async ({ page }) => {
await execute_all_cells(page);
let errored = await assert_no_error_in_cell(
page,
`
table = perspective.Table(arrow_data)
w = perspective.PerspectiveWidget(table)
config = w.save()
perpsective.PerspectiveWidget(df, **config)
`
);
expect(errored).toBe(false);
});

// *************************
// UTILS
// *************************
5 changes: 5 additions & 0 deletions python/perspective/perspective/viewer/viewer.py
Original file line number Diff line number Diff line change
@@ -76,6 +76,8 @@ def __init__(
settings=True,
theme=None,
title=None,
# ignored, here for restore compatibility
version=None,
):
"""Initialize an instance of `PerspectiveViewer` with the given viewer
configuration. Do not pass a `Table` or data into the constructor -
@@ -107,6 +109,9 @@ def __init__(
settings(:obj:`bool`): Whether the perspective query settings
panel should be open.
theme (:obj:`str`): The color theme to use.
version (:obj:`str`): The version this configuration is restored from.
This should only be used when restoring a configuration,
and should not be set manually.

Examples:
>>> viewer = PerspectiveViewer(