Open bnaul opened 5 years ago
Just realized this wasn't actually as simple as I thought, the way Mapbox wants the iframe
to look seems incompatible with how the IPython
function produces it. Changed to just suppress the warning unless someone has a better idea (@ryanbaumann ?)
In general I don't think we should support suppressing warnings. Instead let's figure out why the warning is thrown and if there is a workaround or upgrade to make.
Here's the code we use to display an HTML element in Ipython - https://github.com/mapbox/mapboxgl-jupyter/blob/da6830828dbad62d348d5a05a877e54db9d633cd/mapboxgl/viz.py#L5
Here's the docs for Ipython display - https://ipython.readthedocs.io/en/stable/api/generated/IPython.display.html
yeah, that was my first attempt but it didn't end up working.
the function that IPython is trying to force you to use is here: https://github.com/ipython/ipython/blob/56ea43f4378f4a87e3aec4cfae4dca26bb69c2ec/IPython/lib/display.py#L239-L273
it seems that mapbox expects a srcdoc
attribute whereas ipython calls it src
. since there's no way to override that behavior I'm not sure what to do...
Thanks for digging @bnaul . Mapboxgl-Jupyter uses the srcdoc
HTML attribute here as part of the as_iframe
function - https://github.com/mapbox/mapboxgl-jupyter/blob/da6830828dbad62d348d5a05a877e54db9d633cd/mapboxgl/viz.py#L244
We could take two approached - change the as_iframe
function in Mapboxgl-Jupyter, or identify a fix upstream in ipython display. We used srcdoc
in the iframe in order to inject an HTML source as a string into the iframe display, as opposed to referencing a remote source i.e. ./localfile.html
.
We can reference folium to see what approach that SDK uses for loading a dynamic HTML component inline with a Notebook cell.
Not sure if this is only a problem in recent IPython versions but for me every plot is accompanied by:
Seems safe enough...?