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

pydeck: Change cell height and enable _repr_html_ in Colab #5657

Merged
merged 2 commits into from
Apr 15, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
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