Skip to content

Commit

Permalink
pydeck: Change cell height and enable _repr_html_ in Colab (#5657)
Browse files Browse the repository at this point in the history
  • Loading branch information
ajduberstein authored Apr 15, 2021
1 parent f726e84 commit 2fbd91d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
4 changes: 2 additions & 2 deletions bindings/pydeck/pydeck/io/html.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,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 = "google.colab.output.setIframeHeight(0, true, {maxHeight: %s})" % iframe_height
js_height_snippet = f"google.colab.output.setIframeHeight({iframe_height}, true, {{minHeight: {iframe_height}}})"
display(Javascript(js_height_snippet)) # noqa
display(HTML(html_str)) # noqa

Expand Down Expand Up @@ -153,7 +153,7 @@ def deck_to_html(

if notebook_display and in_google_colab:
render_for_colab(html_str, iframe_height)
return
return html_str
elif not filename and as_string:
return html_str
elif notebook_display:
Expand Down
13 changes: 11 additions & 2 deletions bindings/pydeck/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,12 +124,20 @@ def run(self):
if build_all:
log.info("Installing build dependencies with yarn. This may take a while...")
check_call(
["yarn", "bootstrap"], cwd=yarn_root, stdout=sys.stdout, stderr=sys.stderr, env=env,
["yarn", "bootstrap"],
cwd=yarn_root,
stdout=sys.stdout,
stderr=sys.stderr,
env=env,
)
else:
log.info("Installing build dependencies with `npm run build`.")
check_call(
["npm", "run", "build"], cwd=widget_dir, stdout=sys.stdout, stderr=sys.stderr, env=env,
["npm", "run", "build"],
cwd=widget_dir,
stdout=sys.stdout,
stderr=sys.stderr,
env=env,
)

self.clean_frontend_build()
Expand Down Expand Up @@ -185,6 +193,7 @@ def run(self):
author_email="ajduberstein@gmail.com",
url="https://github.com/visgl/deck.gl/tree/master/bindings/pydeck",
keywords=["data", "visualization", "graphics", "GIS", "maps"],
python_requires=">=3.7",
classifiers=[
"Intended Audience :: Developers",
"Intended Audience :: Science/Research",
Expand Down

0 comments on commit 2fbd91d

Please sign in to comment.