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: Add dummy widgets to suppress NameError and warn about missing ipywidgets #3747

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mrapacz
Copy link

@mrapacz mrapacz commented Aug 14, 2024

This addresses #3755

Resolution

This PR fixes the issue by defining dummy FloatSlider and IntSlider classes which do not raise exceptions when instantiated. This allows the patched @interact to handle the missing ipywidgets scenario gracefully.

After applying the changes suggested in this PR the ImportError is raised as intended.

$ python -c "import seaborn; seaborn.choose_colorbrewer_palette('quatlitative')"

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "<redacted>/seaborn/seaborn/widgets.py", line 141, in choose_colorbrewer_palette
    @interact
     ^^^^^^^^
  File "<redacted>/seaborn/seaborn/widgets.py", line 10, in interact
    raise ImportError(msg)
ImportError: Interactive palettes require `ipywidgets`, which is not installed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant