CDN.css_files returns empty list in Bokeh 1.3.4

Hi all,

It appears that CSN.css_files no longer returns a list of the links to the required CSS files in 1.3.4.

With Bokeh 1.3.4:

In [1]: import bokeh                                                                                                          

In [2]: bokeh.__version__                                                                                                     
Out[2]: '1.3.4'

In [3]: from bokeh.resources import CDN                                                                                       

In [4]: CDN.css_files                                                                                                         
Out[4]: []

In [5]: CDN.js_files                                                                                                          
Out[5]: 
['https://cdn.pydata.org/bokeh/release/bokeh-1.3.4.min.js',
 'https://cdn.pydata.org/bokeh/release/bokeh-widgets-1.3.4.min.js',
 'https://cdn.pydata.org/bokeh/release/bokeh-tables-1.3.4.min.js',
 'https://cdn.pydata.org/bokeh/release/bokeh-gl-1.3.4.min.js']

In [6]:                                                                                                                       

And, with 1.2.0:

In [1]: import bokeh                                                                                                          

In [2]: bokeh.__version__                                                                                                     
Out[2]: '1.2.0'

In [3]: from bokeh.resources import CDN                                                                                       

In [4]: CDN.css_files                                                                                                         
Out[4]: 
['https://cdn.pydata.org/bokeh/release/bokeh-1.2.0.min.css',
 'https://cdn.pydata.org/bokeh/release/bokeh-widgets-1.2.0.min.css',
 'https://cdn.pydata.org/bokeh/release/bokeh-tables-1.2.0.min.css']

In [5]:                                                                                                                       

I use these files to embed bokeh plots in HTML pages like this and enjoyed being able to get the correct links from the Bokeh Python API.

There are no more CSS files required after the recent PR to modularize them:

Which was merged for version 1.3. We still publish empty CSS files with the same naming scheme for compatibility, but those will stop when Bokeh 2.0 is released. After Bokeh 1.3 there are no CSS includes that are necessary (but including ones with the previous naming scheme is harmless).

2 Likes

Ah, that makes sense. Thanks for the info @Bryan!

Do you think it would be helpful to add some kind of warning/throw an error when people try to access the css_files attribute of CDN?

I’m just not sure there is much we can do. There is no reliable way to know (from Python) whether the ultimate output will try to load the CSS files (someone could use .css_files but there is no reason anyone has to to put those links in). And on the JS side there will be console warnings for 404s after 2.0 comes out. I am not sure there is any mechanism to introspect their existence and proactively warn before then, though.

Hi Thanks for this post! I also was surprised by the disappearance of the CSS files. I looked in the release notes and the documentation, and couldn’t find anywhere where it mentions the change, although I probably missed it. It seems to have stopped with v1.3.0 just by trial and error. Cheers!