jupyter-incubator / sparkmagic

Jupyter magics and kernels for working with remote Spark clusters
Other
1.33k stars 447 forks source link

fix: remove duplicate fields #925

Open jeffeth-donaldson opened 3 months ago

jeffeth-donaldson commented 3 months ago

Description

This fixes an issue where the fields are duplicated on newer versions of jupyter.

Checklist

devstein commented 1 month ago

Hey @jeffeth-donaldson thanks for opening a PR! Do you know why this code causes duplicate fields? How can we support older version of Jupyter as well?

jeffeth-donaldson commented 1 month ago

Apologies, @devstein, I'm not terribly familiar with IPywidgets.

I believe the issue is that _repr_html_ is supposed to return an html string whereas here display was called which actually draws the widget to the screen.

I'm guessing in newer versions of Jupyter, the display method gets called recursively on the children already which is why the duplication occurs. I can see if returning all the children's html as a string works on older versions of Jupyter, however, I no longer require sparkmagic so I'm not sure how quickly I'll get around to it. I also do not know what version of Jupyter introduced this issue, so I'd have to figure that out for testing.