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

Remove dispatcher plot dependencies and upgrade bokeh #279

Open
wants to merge 25 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 8 commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
a426466
Remove dispatcher plot dependencies
ferrigno Aug 20, 2024
9bd0ebe
Requirements.txt n line with setup.py
ferrigno Aug 20, 2024
ef9864b
Remove dispatcher from conftest.py
ferrigno Aug 20, 2024
d6113e2
yodate address in tutorial
ferrigno Aug 20, 2024
02d204d
update index.rst
ferrigno Aug 20, 2024
74ed463
update test requirements
ferrigno Aug 20, 2024
47fe79e
remove references to CDCI in License, Readme and Vocab
ferrigno Aug 20, 2024
15bfa5f
revert conftest.py modifications
ferrigno Aug 20, 2024
b45b207
accept requests by @burnout87
ferrigno Aug 21, 2024
a103607
set requirement editable
burnout87 Aug 21, 2024
7abe190
Merge branch 'master' into no-dispatcher
burnout87 Aug 21, 2024
d81f799
set requirement docs
burnout87 Aug 21, 2024
0473701
Merge branch 'master' of github.com:oda-hub/oda_api into no-dispatcher
burnout87 Aug 21, 2024
3d9201a
Merge branch 'no-dispatcher' of github.com:oda-hub/oda_api into no-di…
burnout87 Aug 21, 2024
693e88d
use bokeh 3.5.1
burnout87 Aug 21, 2024
ba4ec4f
Add comment to requirements.txt
ferrigno Aug 21, 2024
04d428f
Merge branch 'master' into no-dispatcher
burnout87 Jan 24, 2025
0161ffc
dedicated utils module for plot tools
burnout87 Jan 24, 2025
6d83cea
Merge branch 'no-dispatcher' of github.com:oda-hub/oda_api into no-di…
burnout87 Jan 24, 2025
3d90f3e
bokeh version 3.5.1 also for OdaSpectrum
burnout87 Jan 24, 2025
dd60c21
moving Image class in the plot_tools_utils module
burnout87 Jan 24, 2025
006945b
removed commented code
burnout87 Jan 24, 2025
4dff727
Merge branch 'master' into no-dispatcher
burnout87 Jan 27, 2025
148e659
removed unused import
burnout87 Jan 28, 2025
11bebd5
Merge branch 'master' into no-dispatcher
burnout87 Jan 28, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .github/styles/vocab.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
cdci
oda
api
Tramacere
Expand Down
2 changes: 1 addition & 1 deletion LICENSE.rst
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cdci_data_analysis is distributed under the terms of The MIT License (MIT), reproduced below.
oda_api is distributed under the terms of The MIT License (MIT), reproduced below.

MIT License

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ oda_api
[![Documentation Status](https://readthedocs.org/projects/oda-api/badge/?version=latest)](https://oda-api.readthedocs.io/en/latest/?badge=latest)


![Upload Python Package](https://github.com/cdcihub/oda_api/workflows/Upload%20Python%20Package/badge.svg)
![Upload Python Package](https://github.com/oda-hub/oda_api/workflows/Upload%20Python%20Package/badge.svg)
![Prose Linting](https://github.com/volodymyrss/integral-isgri-rate-meaning/workflows/Prose%20Linting/badge.svg)
![Executing Notebook](https://github.com/volodymyrss/integral-isgri-rate-meaning/workflows/Executing%20Notebook/badge.svg)
[![Python package](https://github.com/oda-hub/oda_api/actions/workflows/python-package.yml/badge.svg)](https://github.com/oda-hub/oda_api/actions/workflows/python-package.yml)
Expand Down
4 changes: 2 additions & 2 deletions doc/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@

ODA API documentation
===================================
API for cdci_data_analysis
API for Multi Messenger Online Data Analysis (MMODA)

:Authors: `Andrea Tramacere <[email protected]>, Carlo Ferrigno <[email protected]>`_
:Authors: `Andrea Tramacere <[email protected]>, Carlo Ferrigno <[email protected]>, Gabriele Barni <[email protected]>`_

Documentation
-------------
Expand Down
6 changes: 3 additions & 3 deletions doc/source/user_guide/tutorial_main.rst
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,17 @@ The following tutorial covers a large fraction of the code features. The example

Progress reporting for long running tasks <ProgressReporter.ipynb>

Examples of workflows <https://github.com/cdcihub/oda_api_benchmark>
Examples of workflows <https://github.com/oda-hub/oda_api_benchmark>



.. image:: https://img.shields.io/badge/run%20quick%20start%20-binder-579ACA.svg?logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFkAAABZCAMAAABi1XidAAAB8lBMVEX///9XmsrmZYH1olJXmsr1olJXmsrmZYH1olJXmsr1olJXmsrmZYH1olL1olJXmsr1olJXmsrmZYH1olL1olJXmsrmZYH1olJXmsr1olL1olJXmsrmZYH1olL1olJXmsrmZYH1olL1olL0nFf1olJXmsrmZYH1olJXmsq8dZb1olJXmsrmZYH1olJXmspXmspXmsr1olL1olJXmsrmZYH1olJXmsr1olL1olJXmsrmZYH1olL1olLeaIVXmsrmZYH1olL1olL1olJXmsrmZYH1olLna31Xmsr1olJXmsr1olJXmsrmZYH1olLqoVr1olJXmsr1olJXmsrmZYH1olL1olKkfaPobXvviGabgadXmsqThKuofKHmZ4Dobnr1olJXmsr1olJXmspXmsr1olJXmsrfZ4TuhWn1olL1olJXmsqBi7X1olJXmspZmslbmMhbmsdemsVfl8ZgmsNim8Jpk8F0m7R4m7F5nLB6jbh7jbiDirOEibOGnKaMhq+PnaCVg6qWg6qegKaff6WhnpKofKGtnomxeZy3noG6dZi+n3vCcpPDcpPGn3bLb4/Mb47UbIrVa4rYoGjdaIbeaIXhoWHmZYHobXvpcHjqdHXreHLroVrsfG/uhGnuh2bwj2Hxk17yl1vzmljzm1j0nlX1olL3AJXWAAAAbXRSTlMAEBAQHx8gICAuLjAwMDw9PUBAQEpQUFBXV1hgYGBkcHBwcXl8gICAgoiIkJCQlJicnJ2goKCmqK+wsLC4usDAwMjP0NDQ1NbW3Nzg4ODi5+3v8PDw8/T09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E7Ug0uFOzufJFE2PxBo/YAx8XPPdDwWN0MrDRYIZF0mSMKCNHgaIVFoBbNoLJ7tEQDKxGF0kcLQimojCZopv0OkNOyWCCg9XMVAi7ARJzQdM2QUh0gmBozjc3Skg6dSBRqDGYSUOu66Zg+I2fNZs/M3/f/Grl/XnyF1Gw3VKCez0PN5IUfFLqvgUN4C0qNqYs5YhPL+aVZYDE4IpUk57oSFnJm4FyCqqOE0jhY2SMyLFoo56zyo6becOS5UVDdj7Vih0zp+tcMhwRpBeLyqtIjlJKAIZSbI8SGSF3k0pA3mR5tHuwPFoa7N7reoq2bqCsAk1HqCu5uvI1n6JuRXI+S1Mco54YmYTwcn6Aeic+kssXi8XpXC4V3t7/ADuTNKaQJdScAAAAAElFTkSuQmCC
:target: https://mybinder.org/v2/gh/cdcihub/oda_api/master
:target: https://mybinder.org/v2/gh/oda-hub/oda_api/master






.. image:: https://img.shields.io/badge/run%20examples-binder-579ACA.svg?logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFkAAABZCAMAAABi1XidAAAB8lBMVEX///9XmsrmZYH1olJXmsr1olJXmsrmZYH1olJXmsr1olJXmsrmZYH1olL1olJXmsr1olJXmsrmZYH1olL1olJXmsrmZYH1olJXmsr1olL1olJXmsrmZYH1olL1olJXmsrmZYH1olL1olL0nFf1olJXmsrmZYH1olJXmsq8dZb1olJXmsrmZYH1olJXmspXmspXmsr1olL1olJXmsrmZYH1olJXmsr1olL1olJXmsrmZYH1olL1olLeaIVXmsrmZYH1olL1olL1olJXmsrmZYH1olLna31Xmsr1olJXmsr1olJXmsrmZYH1olLqoVr1olJXmsr1olJXmsrmZYH1olL1olKkfaPobXvviGabgadXmsqThKuofKHmZ4Dobnr1olJXmsr1olJXmspXmsr1olJXmsrfZ4TuhWn1olL1olJXmsqBi7X1olJXmspZmslbmMhbmsdemsVfl8ZgmsNim8Jpk8F0m7R4m7F5nLB6jbh7jbiDirOEibOGnKaMhq+PnaCVg6qWg6qegKaff6WhnpK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s2w7ovVHKtjrX2pd7ZMlTxAYfBAL9jiDwfLkq55Tm7ifhMlTGPyCAs7RFRhn47JnlcB9RM5T97ASuZXIcVNuUDIndpDbdsfrqsOppeXl5Y+XVKdjFCTh+zGaVuj0d9zy05PPK3QzBamxdwtTCrzyg/2Rvf2EstUjordGwa/kx9mSJLr8mLLtCW8HHGJc2R5hS219IiF6PnTusOqcMl57gm0Z8kanKMAQg0qSyuZfn7zItsbGyO9QlnxY0eCuD1XL2ys/MsrQhltE7Ug0uFOzufJFE2PxBo/YAx8XPPdDwWN0MrDRYIZF0mSMKCNHgaIVFoBbNoLJ7tEQDKxGF0kcLQimojCZopv0OkNOyWCCg9XMVAi7ARJzQdM2QUh0gmBozjc3Skg6dSBRqDGYSUOu66Zg+I2fNZs/M3/f/Grl/XnyF1Gw3VKCez0PN5IUfFLqvgUN4C0qNqYs5YhPL+aVZYDE4IpUk57oSFnJm4FyCqqOE0jhY2SMyLFoo56zyo6becOS5UVDdj7Vih0zp+tcMhwRpBeLyqtIjlJKAIZSbI8SGSF3k0pA3mR5tHuwPFoa7N7reoq2bqCsAk1HqCu5uvI1n6JuRXI+S1Mco54YmYTwcn6Aeic+kssXi8XpXC4V3t7/ADuTNKaQJdScAAAAAElFTkSuQmCC
:target: https://mybinder.org/v2/gh/cdcihub/oda_api_benchmark/master
:target: https://mybinder.org/v2/gh/oda-hub/oda_api_benchmark/master
144 changes: 129 additions & 15 deletions oda_api/plot_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,22 @@
import time as _time
import astropy.wcs as wcs

from bokeh.layouts import row, gridplot
#column,
from bokeh.models import HoverTool
# (CustomJS,
# Toggle,
# RangeSlider,
# HoverTool,
# ColorBar,
# LinearColorMapper,
# LabelSet,
# ColumnDataSource,
# LogColorMapper)
from bokeh.embed import components
from bokeh.plotting import figure
#from bokeh.palettes import Plasma256

# NOTE GW, optional
try:
import ligo.skymap.plot
Expand Down Expand Up @@ -691,7 +707,7 @@
return True

def get_html_image(self, source_name, systematic_fraction, color='blue'):
import cdci_data_analysis.analysis.plot_tools

x, dx, y, dy, e_min, e_max = self.get_lc(source_name, systematic_fraction)
mask = numpy.logical_not(numpy.isnan(y))

Expand All @@ -704,10 +720,10 @@
else:
xlabel = 'Time [IJD]'

sp = cdci_data_analysis.analysis.plot_tools.ScatterPlot(w=800, h=600,
x_label=xlabel,
y_label='Rate (%.0f - %.0f keV)' % (e_min, e_max),
title=source_name)
sp = ScatterPlot(w=800, h=600,

Check warning on line 723 in oda_api/plot_tools.py

View check run for this annotation

Codecov / codecov/patch

oda_api/plot_tools.py#L723

Added line #L723 was not covered by tests
x_label=xlabel,
y_label='Rate (%.0f - %.0f keV)' % (e_min, e_max),
title=source_name)

sp.add_errorbar(x, y, yerr=dy, xerr=dx, color=color)
html_dict = sp.get_html_draw()
Expand Down Expand Up @@ -774,8 +790,7 @@
plt.show()

def get_html_image(self, in_source_name, systematic_fraction, x_range=None, y_range=None, color='blue'):
import cdci_data_analysis.analysis.plot_tools


x, dx, y, dy = self.get_values(in_source_name, systematic_fraction)

if len(x) == 0:
Expand All @@ -787,14 +802,14 @@
if y_range is None:
y_range = [numpy.max([1e-4, (y-dy)[x < x_range[1]].min()]), (y+dy).max()]

sp = cdci_data_analysis.analysis.plot_tools.ScatterPlot(w=800, h=600,
x_label="Energy [keV]",
y_label='Counts/s/keV',
x_axis_type='log',
y_axis_type='log',
x_range=x_range,
y_range=y_range,
title=in_source_name)
sp = ScatterPlot(w=800, h=600,

Check warning on line 805 in oda_api/plot_tools.py

View check run for this annotation

Codecov / codecov/patch

oda_api/plot_tools.py#L805

Added line #L805 was not covered by tests
x_label="Energy [keV]",
y_label='Counts/s/keV',
x_axis_type='log',
y_axis_type='log',
x_range=x_range,
y_range=y_range,
title=in_source_name)
if len(x) == 0:
return ''
sp.add_errorbar(x, y, yerr=dy, xerr=dx, color=color)
Expand Down Expand Up @@ -1051,3 +1066,102 @@
# TODO can an implementation of this method provided?
def write_fits(self):
raise NotImplementedError


class ScatterPlot(object):

def __init__(self,w,h,x_label=None,y_label=None,x_range=None,y_range=None,title=None,y_axis_type='linear',x_axis_type='linear'):
hover = HoverTool(tooltips=[("x", "$x"), ("y", "$y")])

Check warning on line 1074 in oda_api/plot_tools.py

View check run for this annotation

Codecov / codecov/patch

oda_api/plot_tools.py#L1074

Added line #L1074 was not covered by tests

self.fig = figure(title=title, width=w, height=h,x_range=x_range,y_range=y_range,

Check warning on line 1076 in oda_api/plot_tools.py

View check run for this annotation

Codecov / codecov/patch

oda_api/plot_tools.py#L1076

Added line #L1076 was not covered by tests
y_axis_type=y_axis_type,
x_axis_type=x_axis_type,
tools=[hover, 'pan,box_zoom,box_select,wheel_zoom,reset,save,crosshair']
)

if x_label is not None:
self.fig.xaxis.axis_label = x_label

Check warning on line 1083 in oda_api/plot_tools.py

View check run for this annotation

Codecov / codecov/patch

oda_api/plot_tools.py#L1082-L1083

Added lines #L1082 - L1083 were not covered by tests

if y_label is not None:
self.fig.yaxis.axis_label = y_label

Check warning on line 1086 in oda_api/plot_tools.py

View check run for this annotation

Codecov / codecov/patch

oda_api/plot_tools.py#L1085-L1086

Added lines #L1085 - L1086 were not covered by tests

def add_errorbar(self, x, y, xerr=None, yerr=None, color='red',
point_kwargs={}, error_kwargs={}):

self.fig.circle(x, y, color=color, **point_kwargs)

Check warning on line 1091 in oda_api/plot_tools.py

View check run for this annotation

Codecov / codecov/patch

oda_api/plot_tools.py#L1091

Added line #L1091 was not covered by tests

if xerr is not None:
x_err_x = []
x_err_y = []
for px, py, err in zip(x, y, xerr):
x_err_x.append((px - err, px + err))
x_err_y.append((py, py))
self.fig.multi_line(x_err_x, x_err_y, color=color, **error_kwargs)

Check warning on line 1099 in oda_api/plot_tools.py

View check run for this annotation

Codecov / codecov/patch

oda_api/plot_tools.py#L1093-L1099

Added lines #L1093 - L1099 were not covered by tests

if yerr is not None:
y_err_x = []
y_err_y = []
for px, py, err in zip(x, y, yerr):
y_err_x.append((px, px))
y_err_y.append((py - err, py + err))
self.fig.multi_line(y_err_x, y_err_y, color=color, **error_kwargs)

Check warning on line 1107 in oda_api/plot_tools.py

View check run for this annotation

Codecov / codecov/patch

oda_api/plot_tools.py#L1101-L1107

Added lines #L1101 - L1107 were not covered by tests



def add_step_line(self, x, y, legend=None):
if legend:
self.fig.step(x, y, legend_label=legend, mode="center")

Check warning on line 1113 in oda_api/plot_tools.py

View check run for this annotation

Codecov / codecov/patch

oda_api/plot_tools.py#L1112-L1113

Added lines #L1112 - L1113 were not covered by tests
else:
self.fig.step(x, y, mode="center")

Check warning on line 1115 in oda_api/plot_tools.py

View check run for this annotation

Codecov / codecov/patch

oda_api/plot_tools.py#L1115

Added line #L1115 was not covered by tests

def add_line(self, x, y, legend=None, color='red'):
if legend:
self.fig.line(x, y, legend_label=legend, line_color=color)

Check warning on line 1119 in oda_api/plot_tools.py

View check run for this annotation

Codecov / codecov/patch

oda_api/plot_tools.py#L1118-L1119

Added lines #L1118 - L1119 were not covered by tests
else:
self.fig.line(x, y, line_color=color)

Check warning on line 1121 in oda_api/plot_tools.py

View check run for this annotation

Codecov / codecov/patch

oda_api/plot_tools.py#L1121

Added line #L1121 was not covered by tests

def get_html_draw(self):



layout = row(

Check warning on line 1127 in oda_api/plot_tools.py

View check run for this annotation

Codecov / codecov/patch

oda_api/plot_tools.py#L1127

Added line #L1127 was not covered by tests
self.fig
)
#curdoc().add_root(layout)


#show(layout)

script, div = components(layout)

Check warning on line 1135 in oda_api/plot_tools.py

View check run for this annotation

Codecov / codecov/patch

oda_api/plot_tools.py#L1135

Added line #L1135 was not covered by tests

#print ('script',script)
#print ('div',div)

html_dict = {}
html_dict['script'] = script
html_dict['div'] = div
return html_dict

Check warning on line 1143 in oda_api/plot_tools.py

View check run for this annotation

Codecov / codecov/patch

oda_api/plot_tools.py#L1140-L1143

Added lines #L1140 - L1143 were not covered by tests


class GridPlot(object):

def __init__(self,f1,f2,w=None,h=None):

self.f1=f1
self.f2=f2

Check warning on line 1151 in oda_api/plot_tools.py

View check run for this annotation

Codecov / codecov/patch

oda_api/plot_tools.py#L1150-L1151

Added lines #L1150 - L1151 were not covered by tests

def get_html_draw(self,w=None,h=None):
#l = layout([self.f1.fig],[self.f2.fig])


grid = gridplot([self.f1.fig,self.f2.fig],ncols=1,plot_width=w, plot_height=h)

Check warning on line 1157 in oda_api/plot_tools.py

View check run for this annotation

Codecov / codecov/patch

oda_api/plot_tools.py#L1157

Added line #L1157 was not covered by tests
#curdoc().add_root(grid)
#show(grid)
#output_file("test.html")
script, div = components(grid)

Check warning on line 1161 in oda_api/plot_tools.py

View check run for this annotation

Codecov / codecov/patch

oda_api/plot_tools.py#L1161

Added line #L1161 was not covered by tests

html_dict={}
html_dict['script']=script
html_dict['div'] = div
return html_dict

Check warning on line 1166 in oda_api/plot_tools.py

View check run for this annotation

Codecov / codecov/patch

oda_api/plot_tools.py#L1163-L1166

Added lines #L1163 - L1166 were not covered by tests

11 changes: 7 additions & 4 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
requests
future
astropy
astropy>=3.2
ferrigno marked this conversation as resolved.
Show resolved Hide resolved
json_tricks
matplotlib
numpy
jsonschema
pyjwt
astroquery
-e git+https://github.com/oda-hub/dispatcher-app.git#egg=cdci_data_analysis[test]
simplejson
sentry_sdk
scipy
rdflib
black
bokeh
git+https://github.com/oda-hub/dispatcher-app.git#egg=cdci_data_analysis[test]

2 changes: 1 addition & 1 deletion requirements_docker.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
-e git://github.com/andreatramacere/oda_api.git#egg=oda_api
-e git://github.com/oda-hub/oda_api.git#egg=oda_api
matplotlib
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 1.2.25
current_version = 1.2.26
burnout87 marked this conversation as resolved.
Show resolved Hide resolved
commit = True
tag = False
parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)(\-(?P<release>[a-z]+)(?P<build>\d+))?
Expand Down
8 changes: 5 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

setup(name='oda_api',
version=__version__,
description='API plugin for CDCI online data analysis',
description='API plugin for Multi-Messenger online data analysis',
author='Andrea Tramacere, Volodymyr Savchenko',
author_email='[email protected]',
packages=packs,
Expand All @@ -42,13 +42,15 @@
"astroquery",
"scipy",
"rdflib",
"black"
"black",
"bokeh"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In dispatcher, we fixed the bokeh version to be exactly 2.4.2
The purpose of this is that it has to coincide with the version of the accompanying js library in the frontend.

On the other hand, it's probably a good time to update it to the latest version, which is currently 3.5.1. One of the motivations is that, strictly speaking, the support for python 3.10 was added in bokeh 3.0, and we test oda_api package against 3.8 - 3.11

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some complication is that it should be done in coordinated fashion between oda_api, dispatcher, frontend, and possibly gallery (not sure, please confirm)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can probably drop 3.8 and maybe 3.9 but we need to update the container base to reconcile all.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for the gallery it should not be necessary, same for the frontend, so it's probably only oda_api and dispatcher

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same for the frontend

Frontend serves bokeh js libs that are used in conjunction with what dispatcher returns. That's why I also thought about gallery, if there are any bokeh-based products there.
So the change is small, just to updating the version, but it's backwards-incompatible.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

with 693e88d the html output for LCs will have bokeh-3.5.1

Need to try, how it works with frontend, because it injects bokeh==2.4.2 in a page head

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

with 693e88d the html output for LCs will have bokeh-3.5.1

I forgot to specify, the update is about the get_html_image function used to generate LC plots for the gallery.

For the frontend, a dedicated PR is needed on the dispatcher

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't quite follow how it works in gallery. Each plot there have their own bokeh version injected, and they don't conflict because each product is on a different page, right?
In frontend, it may be more complicated, say some products are cached with previous version of bokeh, and some other is generated with recent version injected. But all the tabs are on the same page, and here we may encounter problems

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't quite follow how it works in gallery. Each plot there have their own bokeh version injected, and they don't conflict because each product is on a different page, right?

Exactly, more specifically, it is done here:

html_str = html_dict['div'] + '\n'
html_str += '<script src="https://cdn.bokeh.org/bokeh/release/bokeh-2.4.2.min.js"></script>\n' + \
'<script src="https://cdn.bokeh.org/bokeh/release/bokeh-widgets-2.4.2.min.js"></script>\n'
html_str += html_dict['script']

In frontend, it may be more complicated, say some products are cached with previous version of bokeh, and some other is generated with recent version injected. But all the tabs are on the same page, and here we may encounter problems

Yes I can totally see it. And a potential workaround would require probably a lot of work. is it for sure not retro-compatible ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I saw failures when bokeh version in python and js are different. Between major releases, they surely won't be compatible.

],
extras_require={
'test': [
"pytest-xdist[psutil]",
"astroquery>=0.4.4",
"sentry_sdk"
"sentry_sdk",
"cdci_data_analysis"
],
'extra-test': [
"pytest-xdist[psutil]",
Expand Down
1 change: 0 additions & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ def pytest_collection_modifyitems(config, items):
item.add_marker(pytest.mark.skip(reason=f"--run-only-{option} prevents this test from running"))



@pytest.fixture
def dispatcher_api(dispatcher_live_fixture):
import oda_api
Expand Down
Loading