Skip to content
Open
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
1 change: 1 addition & 0 deletions CONTRIBUTORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
## Individual Contributors

* [Abhishek Chitwar](https://github.com/abhishekchitwar)
* [Dipin](https://github.com/dipinknair)
* [German](https://github.com/germa89)
* [Jorge Martínez](https://github.com/jorgepiloto)
* [Kathy Pippert](https://github.com/PipKat)
Expand Down
1 change: 1 addition & 0 deletions doc/changelog.d/548.fixed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix: auto-detect Jupyter kernel to avoid blank trame renders
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "flit_core.buildapi"

[project]
name = "ansys-tools-visualization-interface"
version = "0.8.dev0"
version = "0.13.dev0"
description = "A Python visualization interface for PyAnsys libraries"
readme = "README.rst"
requires-python = ">=3.10,<4"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -465,6 +465,19 @@ def show(
# Override Jupyter backend if building docs
if viz_interface.USE_HTML_BACKEND:
jupyter_backend = "html"
elif jupyter_backend is None:
# Auto-detect a Jupyter kernel and fall back to a safe html backend.
# Without this, PyVista defaults to "trame" (after installing
# pyvista[jupyter]), which spawns a local server and renders blank
# in VS Code / Spyder embedded notebooks.
try:
from IPython import get_ipython

_ip = get_ipython()
if _ip is not None and "IPKernelApp" in _ip.config:
jupyter_backend = "html"
except Exception:
pass
Comment on lines +468 to +480

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With this change we would force static renderings on Jupyter NB. And PyVista (via trame) supports interactive ones. Let's try to figure out why it's not rendering on the user's machine.

We could have some kind of fallback though in the sense that if the render goes blank (i.e. fails) we attempt to render it statically. But not by default I'd say. Thanks for investigating @dipinknair

@AlejandroFernandezLuces can you sync with @dipinknair to investigate the issue? He'll share details on the user's failure

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, I'll check on my end


# Enabling anti-aliasing by default on scene
self.scene.enable_anti_aliasing("ssaa")
Expand Down
Loading