Getting Started

Installation

You can install nova-trame directly with

pip install nova-trame

or with Pixi with:

pixi add --pypi nova-trame

Creating an Application

To create your application, you’ll first need to setup an application class that inherits from nova.trame.TrameApp. This class will provide a default layout and theme for your application.

from trame.widgets import vuetify3 as vuetify
from trame_server.core import Server

class MyTrameApp(ThemedApp):
    def __init__(self, server: Server = None) -> None:
        super().__init__(server=server)

        self.create_ui()

    def create_ui(self) -> None:
        with super().create_ui() as layout:
            with layout.content:
                vuetify.VBtn("Hello World")

Now you can run your application with the following:

app = App(server)
for arg in sys.argv[1:]:
    try:
        key, value = arg.split("=")
        kwargs[key] = int(value)
    except Exception:
        pass
app.server.start(**kwargs)

If you installed via Pixi, you can run the above script with:

pixi run python my_trame_app.py [--server] [--timeout=0]

After running this, if you point your browser to http://localhost:8080, then you should see a basic web application with our default theme and a button that says “Hello World”.

The two optional arguments are passed to the Trame server. --server will prevent Trame from opening a new browser tab on launch, and --timeout=0 will tell the server to never close due to inactivity.