From 62c7951681034037983c8db0f2f0f4271cb2c3d3 Mon Sep 17 00:00:00 2001 From: Don McCurdy Date: Thu, 9 May 2024 16:10:05 -0400 Subject: [PATCH 1/2] fix(pydeck): Fix cell height in Google Colab --- bindings/pydeck/pydeck/io/html.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bindings/pydeck/pydeck/io/html.py b/bindings/pydeck/pydeck/io/html.py index 8157b5d394a..188a017f2fb 100644 --- a/bindings/pydeck/pydeck/io/html.py +++ b/bindings/pydeck/pydeck/io/html.py @@ -113,7 +113,7 @@ def iframe_with_srcdoc(html_str, width="100%", height=500): def render_for_colab(html_str, iframe_height): from IPython.display import HTML, Javascript # noqa - js_height_snippet = f"google.colab.output.setIframeHeight({iframe_height}, true, {{minHeight: {iframe_height}}})" + js_height_snippet = f"google.colab.output.setIframeHeight({iframe_height}, true, {{minHeight: {iframe_height}, maxHeight: {iframe_height}}})" display(Javascript(js_height_snippet)) # noqa display(HTML(html_str)) # noqa From 9b6eb042ff0b7867dab03903879b4299c837c892 Mon Sep 17 00:00:00 2001 From: Don McCurdy Date: Fri, 10 May 2024 08:22:00 -0400 Subject: [PATCH 2/2] Add documentation about testing local changes in Google Colab --- bindings/pydeck/docs/contributing.rst | 35 ++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/bindings/pydeck/docs/contributing.rst b/bindings/pydeck/docs/contributing.rst index efeb80afd32..15796a34d14 100644 --- a/bindings/pydeck/docs/contributing.rst +++ b/bindings/pydeck/docs/contributing.rst @@ -36,7 +36,40 @@ enable pydeck to run on JupyterLab and Jupyter Notebook locally: make init make prepare-jupyter -At this point, verify that this new local copy of pydeck works by running ``make test``. +Verify that this new local copy of pydeck works by running ``make test``. + +Local development in Jupyter +~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +To test local changes to Pydeck in a Jupyter notebook, set up a virtual environment as +described above, then start a local Jupyter notebook: + +.. code-block:: bash + + jupyter notebook + +.. CAUTION:: + Additional steps (TODO) required to include local changes to deck.gl in a local Pydeck build. + +Local development in Google Colab +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +To test local changes to Pydeck in a Google Colab notebook, first start a Jupyter runtime with +additional flags to trust WebSocket connections from the Colab frontend: + +.. code-block:: bash + + jupyter notebook \ + --NotebookApp.allow_origin='https://colab.research.google.com' \ + --port=8888 \ + --NotebookApp.port_retries=0 + +After the notebook starts, copy the full (localhost) URL printed to the console. In a Google +Colab notebook, select *Connect to a local runtime* from the additional connection options +dropdown, and provide the local URL when prompted. After a reload, the Colab notebook will have +access to the local Jupyter runtime and its local Pydeck build. + +For more information, refer to Google Colab's `documentation for local runtimes `__. Submitting a PR ^^^^^^^^^^^^^^^