holoviews icon indicating copy to clipboard operation
holoviews copied to clipboard

Pass the `backend` in `holoviews.opts.defaults`

Open LecrisUT opened this issue 1 year ago • 2 comments

This is a quick issue I've found when trying to run:

holoviews.opts.defaults(
    holoviews.opts.Curve(
        fig_size=500,
        linewidth=1,
    ),
    backend="matplotlib",
)

Because the backend is not propagated when doing _expand_options you get:

WARNING:param.main: Option 'fig_size' for Curve type not valid for selected backend ('bokeh'). Option only applies to following backends: ['matplotlib']

It seems that the options are indeed not populated due to the warning (confirmed, that with this PR, the default is set appropriately)

LecrisUT avatar Jul 18 '24 09:07 LecrisUT

Thank you for contributing! To make HoloViews more robust do you think you can add a test that checks if opts are propagated properly using hv.opts.defaults or alternatively checking if the warning is gone?

Maybe in https://github.com/holoviz/holoviews/blob/main/holoviews/tests/plotting/test_plotutils.py (not 100% certain).

ahuang11 avatar Jul 26 '24 18:07 ahuang11

If I have a reference test, I could try and add that.

LecrisUT avatar Aug 02 '24 13:08 LecrisUT

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 88.86%. Comparing base (7aaeebc) to head (d287960). Report is 5 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6331      +/-   ##
==========================================
+ Coverage   88.83%   88.86%   +0.03%     
==========================================
  Files         328      328              
  Lines       69805    69831      +26     
==========================================
+ Hits        62010    62055      +45     
+ Misses       7795     7776      -19     

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

:rocket: New features to boost your workflow:
  • :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

codecov[bot] avatar Jun 16 '25 10:06 codecov[bot]

Thank you for the PR, this will be part of the next release 1.21.0.

hoxbro avatar Jun 16 '25 12:06 hoxbro

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

github-actions[bot] avatar Sep 30 '25 01:09 github-actions[bot]