Skip to content

Advanced usecase

Now that you know we rely on an <iframe /> to serve the trame application, let's explore how you can tune various parameters to get the most of trame within Jupyter.

Network / iframe builder

Jupyter provide various way to help network application to still work in their environment. You will often find a server proxy extension available, but we also created an extension for trame to better manage the network. But either way, it boils down to selecting an iframe_builder. In some case we try to make that selection for you automatically, but sometime you may want to override the default behavior.

Let's review the various available options

python
from module import App

app = App()  
await app.ui.ready
app.ui.iframe_builder = "..." # <= force an iframe builder
app.ui
from module import App

app = App()  
await app.ui.ready
app.ui.iframe_builder = "..." # <= force an iframe builder
app.ui
iframe_builderURLDefault if
default{iframe_base_url}:{server.port}/Default when nothing is set
serverproxy{iframe_base_url}/{server.port}/-
jupyter-extensionENV(TRAME_JUPYTER_WWW)/servers/{server.name}/Extension loaded and available
jupyter-hubENV(JUPYTERHUB_SERVICE_PREFIX)proxy/{server.port}/If JUPYTERHUB_SERVICE_PREFIX exist
jupyter-hub-hostENV(JUPYTERHUB_SERVICE_PREFIX)proxy/{host}:{server.port}/Never a default

The selection can also be done via the TRAME_IFRAME_BUILDER environment variable.

On top of those presets, you can directly set a function as the iframe_builder. Below is

Configurable properties

On top of the iframe_builder, the following set of attributes can be set by the user.

Property nameDefault valueLayout constructor
iframe_styleborder: none; width: 100%; height: 600px;width="100%", height="600px",
iframe_attrs{}-
iframe_base_urlhttp://localhostbase_url="http://localhost"