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
Allow bokeh=3
#5648
Allow bokeh=3
#5648
Conversation
Unit Test ResultsSee test report for an extended history of previous test failures. This is useful for diagnosing flaky tests. 15 files ± 0 15 suites ±0 6h 45m 19s ⏱️ + 15m 50s For more details on these failures, see this check. Results for commit b38f6d9. ± Comparison against base commit a4bfd0e. ♻️ This comment has been updated with latest results. |
bokeh
bokeh=3
compatibility
# "border": "1px solid lightgray", | ||
# "box-shadow": "inset 1px 0 8px 0 lightgray", | ||
# "overflow": "auto", | ||
# }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you can now accomplish this similar to:
https://github.com/bokeh/bokeh/blob/branch-3.0/examples/basic/layouts/sizing_mode.py#L19
container.stylesheets.append(":host { border: 10px solid grey; }")
cc @mattpap for the best approach to support both 2.x and 3.x
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
UIElement.styles
is the replacement (works for all UI elements not just markup widgets). The name is styles
and not style
, so that people don't confuse this with DOM style
attribute. I suppose we could have a deprecated alias in markup widgets for some time in 3.x.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -2902,7 +2902,7 @@ def __init__(self, scheduler, **kwargs): | |||
y_range = Range1d(0, max(self.plugin.nthreads)) | |||
|
|||
self.root = figure( | |||
id="bk-task-group-progress-plot", | |||
# id="bk-task-group-progress-plot", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A better alternative that should also work with 2.x is to set name
instead of id
. AFAIK that ill add a name
class to the element that can be used for CSS selection. (cc @mattpap).
Edit: or of these are not being used for anything in particular, then they can just be omitted entirely
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good to know. I tried that initially, but it looks like we're defining a name
and id
for some figures already (not sure why). I wanted to see if CI breaks if we just don't specify an id
at all
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
alternatively css_classes
is still also an option
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ian-r-rose do you have any insight here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I took a brief look through the dashboard codebase and didn't see anywhere where the DOM ids are explicitly used, so I think it should be relatively safe to just remove these id=
parameters.
I do see a couple of places where bokeh components have custom CSS styling, and that will likely need some updating here. But that is a separate concern from the id
parameters here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do see a couple of places where bokeh components have custom CSS styling, and that will likely need some updating here
Could you point me to those?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm referring to these:
distributed/distributed/http/static/css/base.css
Lines 100 to 107 in 5dccad4
.bk-root .bk-toolbar-box .bk-toolbar-right { | |
top: 4px; | |
right: 4px; | |
} | |
.bk-root .bk-data-table { | |
z-index: 0; | |
} |
I'm not sure if they will work with Bokeh 3, but my read of the changelog is that the CSS system has been overhauled, so it may be worth verifying.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mattpap can you advise?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Due to migration to shadow DOM (or web components, or modularized CSS; different names same idea), styling of bokeh's components with external style sheets is not possible anymore. Each component has to be styled individually. Many CSS classes are gone (e.g. .bk-toolbar-box
) or renamed (simplified) (e.g. .bk-toolbar-right
becomes .bk-right
), because complex selectors are not needed anymore with modularized CSS. .bk-root
is gone, because it's not needed anymore. Also the general structure of bokehjs components' DOM and CSS changed significantly, so even if custom CSS is updated to work with shadow DOM, it still will likely not do what's expected without additional changes.
If you have only individual (instances) components to style, then this should work (give or take, I didn't test it):
.bk-root .bk-toolbar-box .bk-toolbar-right {
top: 4px;
right: 4px;
}
Toolbar(stylesheets=["""
:host(.bk-right) {
top: 4px;
right: 4px;
}
"""])
.bk-root .bk-data-table {
z-index: 0;
}
DataTable(stylesheets=["""
.bk-data-table {
z-index: 0;
}
"""])
Most likely you don't need the second one, as we hopefully fixed all issues with overlapping components.
If you want to style all components of a given kind, like all toolbars, then we don't have a good replacement right now. It's possible to configure stylesheets
property via a theme, but we are still working one something more robust. The current advice is that, if you have a lot of custom CSS, then probably you will have to postpone migration to 3.0 for a moment (until 3.0.n or 3.1; in particular in 3.1 we intend to define an "API" for bokehjs' CSS). If you have just a little bit of customization, then we can figure it out on case-by-case basis.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the context and code snippets @mattpap!
Many CSS classes are gone (e.g. .bk-toolbar-box) or renamed (simplified) (e.g. .bk-toolbar-right becomes .bk-right)
Grepping through distributed
I don't see us using Toolbar
object. Maybe this CSS isn't needed anymore?
Most likely you don't need the second one, as we hopefully fixed all issues with overlapping components.
I found that without adding the DataTable
CSS I ran into #5136 (the original issue why this custom CSS was added). Thanks again for adding the exact I needed to keep this CSS around for bokeh=3
: )
Thanks for all the feedback @mattpap @bryevdv. Looking at the dashboard with the current state of this PR the only thing that stands out with distributed/distributed/dashboard/components/scheduler.py Lines 4311 to 4317 in 9fa952b
are squished vertically (see the tabs in the lower-lefthand part of the screenshots below) With With Do either of you have any insight into what might be going wrong here? |
I'm not sure and I'm also afk all today dealing with a family issue. One thing you might try first just in case, is using the latest release candidate (3.0.0rc5) |
No worries -- hope all is well.
Good point. I'm seeing the same thing when I update to |
I am not sure what is going wrong here. In 2.4.x, the I took a crack at trying to reproduce this outside of the dask dashboard, but was unsuccessful thus far. |
@jrbourbeau just checking in, we do plan to release 3.0 on Monday, in case a version pin is best immediate-term option |
Thanks for the update @bryevdv. This PR is really close, but unfortunately it's not quite ready to be merged. I'm going to include dask/dask#9607 and #7219 in the release later today |
Circling back here after being on PTO last week. I just tried out the changes here with the |
Okay, I'd like to get this PR in and released sooner rather than later as users are reporting breakages ( @fjetter @jacobtomlinson any objections to including this PR in the release later today? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That sounds fine. I expect we will get bug reports that things don't look right but that's better than breakages.
Okay, interesting...we're seeing AttributeError: module 'importlib' has no attribute 'metadata' errors in CI. We saw something similar over in |
@jrbourbeau that might be this: That is going in a 3.0.2 that I will probably release tonight. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm with jacob on this. Lifting a pinning is worth a couple of (hopefully temporary) bugs in the visuals
Thanks for pointing to that PR @bryevdv, that certainly looks related. I was able to reproduce the |
Okay, We currently have two failures related to the current
|
@jrbourbeau FYI Bokeh 3.0.2 is published to PyPI and the Bokeh channel on anaconda.org (C-F and defaults to follow at their own pace) |
Thanks @bryevdv -- thanks was quick! Trying |
Pushing on conda-forge over in conda-forge/bokeh-feedstock#85 |
rerun tests |
xref #5643 (comment)