Skip to content

bokeh 2.3 ignores plot_width #7292

Closed

Description

@crusaderky

CI has started failing after bokeh was upgraded from 2.2 to 2.3:

______________________________ test_profiler_plot ______________________________
[gw1] linux -- Python 3.8.8 /usr/share/miniconda3/envs/test-environment/bin/python

    @pytest.mark.skipif("not bokeh")
    @ignore_abc_warning
    def test_profiler_plot():
        with prof:
            get(dsk, "e")
        p = prof.visualize(
            plot_width=500,
            plot_height=300,
            tools="hover",
            title="Not the default",
            show=False,
            save=False,
        )
>       assert p.plot_width == 500
E       AssertionError: assert 800 == 500
E        +  where 800 = Figure(id='1002', ...).plot_width

dask/diagnostics/tests/test_profiler.py:241: AssertionError
_________________________ test_resource_profiler_plot __________________________
[gw1] linux -- Python 3.8.8 /usr/share/miniconda3/envs/test-environment/bin/python

    @pytest.mark.skipif("not bokeh")
    @pytest.mark.skipif("not psutil")
    @ignore_abc_warning
    def test_resource_profiler_plot():
        with ResourceProfiler(dt=0.01) as rprof:
            get(dsk2, "c")
        p = rprof.visualize(
            plot_width=500,
            plot_height=300,
            tools="hover",
            title="Not the default",
            show=False,
            save=False,
        )
>       assert p.plot_width == 500
E       AssertionError: assert 800 == 500
E        +  where 800 = Figure(id='1038', ...).plot_width

dask/diagnostics/tests/test_profiler.py:268: AssertionError
___________________________ test_cache_profiler_plot ___________________________
[gw1] linux -- Python 3.8.8 /usr/share/miniconda3/envs/test-environment/bin/python

    @pytest.mark.skipif("not bokeh")
    @ignore_abc_warning
    def test_cache_profiler_plot():
        with CacheProfiler(metric_name="non-standard") as cprof:
            get(dsk, "e")
        p = cprof.visualize(
            plot_width=500,
            plot_height=300,
            tools="hover",
            title="Not the default",
            show=False,
            save=False,
        )
>       assert p.plot_width == 500
E       AssertionError: assert 800 == 500
E        +  where 800 = Figure(id='1095', ...).plot_width

dask/diagnostics/tests/test_profiler.py:303: AssertionError

Activity

  1. jrbourbeau commented on Mar 1, 2021

    @jrbourbeau
    Member

    Thanks for reporting @crusaderky. Cross-referencing dask/distributed#4534 as it's likely related. Also cc @quasiben visibility

  2. jrbourbeau commented on Mar 1, 2021

    @jrbourbeau
    Member
  3. quasiben commented on Mar 1, 2021

    @quasiben
    Member

    Thanks for the ping @jrbourbeau and @crusaderky for reporting. I'll take a look

  4. bryevdv commented on Mar 1, 2021

    @bryevdv
    Contributor

    The change was to use width and height for plots, to (finally) bring them in to alignment with every single other layout-able in Bokeh. However, we left plot_width and plot_height as read/writable aliases, and thought that would be sufficient compatibility (but evidently not). Some thoughts:

    • The correct change on your end would be to now use width and height
    • We may be able to re-include the aliases in the returned properties on our end but it will require some investigation.

    Most importantly (to me) why are these tests not part of the downstream tests we run?

    https://github.com/bokeh/bokeh/runs/2001140304?check_suite_focus=true#step:11:24

    distributed/dashboard/tests/test_bokeh.py .                              [  2%]
    distributed/dashboard/tests/test_components.py ...                       [  8%]
    distributed/dashboard/tests/test_scheduler_bokeh.py ..s................. [ 52%]
    ...............                                                          [ 84%]
    distributed/dashboard/tests/test_worker_bokeh.py ....s..                 [100%]
    
    ======================== 44 passed, 2 skipped in 15.64s ========================
    

    For reference the test runs pytest distributed/dashboard I care very deeply about not breaking Dask specifically, but we need some collaboration/dask expertise in order to have the most thorough downstream tests possible.

    Also last question: is this only an issue for tests on your end? I.e. does it not affect actual users during normal usage? I was not able to see any problems when I was testing manually with Dask before the release, but I may just not know enough to spot problems. If it is just an issue with tests, then I think the minimal appropriate response is to just update the tests.

  5. jrbourbeau commented on Mar 1, 2021

    @jrbourbeau
    Member

    The correct change on your end would be to now use width and height

    Thank you for your help @bryevdv. Should we dispatch using width/height or plot_width/plot_height based on the version of bokeh users have or is using width/height backwards compatible?

    Most importantly (to me) why are these tests not part of the downstream tests we run?

    It looks like bokeh-related tests for distributed are run but not the bokeh-related tests inside dask. For reference, pytest dask/diagnostics should catch all tests bokeh-related tests within the dask codebase. Also, it's really great to see the existence of an upstream CI build in bokeh : )

    is this only an issue for tests on your end?

    This does impact users which specify their own plot_width= /plot_height= keyword argument. Looking at

        @pytest.mark.skipif("not bokeh")
        @ignore_abc_warning
        def test_cache_profiler_plot():
            with CacheProfiler(metric_name="non-standard") as cprof:
                get(dsk, "e")
            p = cprof.visualize(
                plot_width=500,
                plot_height=300,
                tools="hover",
                title="Not the default",
                show=False,
                save=False,
            )
    >       assert p.plot_width == 500
    E       AssertionError: assert 800 == 500
    E        +  where 800 = Figure(id='1095', ...).plot_width
    

    it appears that a user's request for a specific width / height is ignored today

  6. bryevdv commented on Mar 1, 2021

    @bryevdv
    Contributor

    is using width/height backwards compatible?

    AFAIK it is backwards compatible up to some point, but I will have to investigate and get back to you about just how far back that was introduced. cc @mattpap

  7. bryevdv commented on Mar 1, 2021

    @bryevdv
    Contributor

    @jrbourbeau This seems to work at least as far back as 1.0.0

    from bokeh.plotting import figure, show
    
    p = figure(width=200)
    
    #also works
    #p.width = 200
    
    p.circle([1,2,3], [4,5,6])
    
    show(p)
    

    Is that far enough? width and height are also part of properties() as well

  8. jrbourbeau commented on Mar 1, 2021

    @jrbourbeau
    Member

    Going back to 1.0.0 is perfect as that's our minimum supported bokeh version

    dask/setup.py

    Line 26 in ff63ae7

    "diagnostics": ["bokeh >= 1.0.0, != 2.0.0"],

    Also, FWIW I opened up bokeh/bokeh#10979 to add dask/dask tests to bokeh's downstream CI build

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions