{"id":6271,"library":"trame-server","title":"Trame Server","description":"Trame-server is the internal server-side implementation of the Trame web framework. It provides the core server logic for managing shared state, controllers, and the web server itself. While it can run in various environments like Jupyter or as a standalone desktop application, it's primarily designed to be a dependency of the higher-level `trame` package rather than being used directly by end-users. It is under active development.","status":"active","version":"3.10.0","language":"en","source_language":"en","source_url":"https://github.com/Kitware/trame-server","tags":["web framework","server","reactive","visualization","client-server","trame"],"install":[{"cmd":"pip install --upgrade trame-server","lang":"bash","label":"Install latest version"}],"dependencies":[{"reason":"Asynchronous HTTP client/server framework for its web server functionalities.","package":"aiohttp"},{"reason":"May be used for shared utilities or API definitions between server and client components.","package":"trame-client"},{"reason":"Websocket protocol for client-server communication.","package":"wslink"},{"reason":"While trame-server is a dependency of trame, most users interact with trame-server indirectly through the trame meta-package, which orchestrates the full application stack.","package":"trame","optional":true}],"imports":[{"note":"The `Server` class from `trame_server.core` should not be instantiated directly. `trame.app.get_server()` is the recommended factory function as it properly initializes the server with state and controller, and integrates it within the broader `trame` application context.","wrong":"from trame_server.core import Server","symbol":"get_server","correct":"from trame.app import get_server"}],"quickstart":{"code":"from trame.app import get_server\nfrom trame.ui.vuetify import SinglePageLayout\nfrom trame.widgets import vuetify\n\n# 1. Get a server instance\nserver = get_server(client_type=\"vue3\") # Explicitly set client_type for V3 compatibility\n\n# 2. Add application logic to the state and controller\nstate, ctrl = server.state, server.controller\nstate.count = 0\n\n@state.change('count')\ndef update_title(count, **kwargs):\n    ctrl.trame.title(f'Count is {count}')\n\n@ctrl.add('reset_count')\ndef reset():\n    state.count = 0\n\n# 3. Create the UI\nwith SinglePageLayout(server) as layout:\n    layout.title.set_text(\"Trame Counter\")\n    with layout.content:\n        with vuetify.VContainer(fluid=True):\n            with vuetify.VRow(classes=\"fill-height\", align=\"center\", justify=\"center\"):\n                with vuetify.VCol(cols=4):\n                    vuetify.VSlider(\n                        label=\"Count\",\n                        min=0,\n                        max=100,\n                        step=1,\n                        v_model=(\"count\", 0) # Bind to state.count\n                    )\n                    vuetify.VBtn(\"Reset\", click=ctrl.reset_count)\n\n# 4. Start the server\nif __name__ == \"__main__\":\n    server.start()","lang":"python","description":"This basic example demonstrates how to set up a Trame server, define a reactive state variable ('count'), create a simple UI with a slider and a button using `trame-vuetify`, and bind UI elements to the server's state and controller. It explicitly sets `client_type='vue3'` for V3 compatibility, which is the default for current Trame versions."},"warnings":[{"fix":"Explicitly set `server.client_type = \"vue2\"` when obtaining the server instance via `trame.app.get_server()` if your application is still based on Vue2. New applications should target Vue3.","message":"Trame v3 (which `trame-server` is part of) changed the default client framework from Vue2 to Vue3 around January 2024. Existing Trame applications built with Vue2 may break or behave unexpectedly.","severity":"breaking","affected_versions":">=3.0.0"},{"fix":"Install required widget packages explicitly, e.g., `pip install trame-vuetify trame-vtk trame-plotly`. Then import them from `trame.widgets` (e.g., `from trame.widgets import vuetify`).","message":"Trame v3 no longer bundles all widgets as implicit dependencies. Core widgets like `trame.widgets.html` and `trame.widgets.client` remain, but other common widget sets (e.g., Vuetify, VTK, Plotly) must now be explicitly installed.","severity":"breaking","affected_versions":">=3.0.0"},{"fix":"Remove imports and usage of `trame.app.jupyter`. Refer to the `trame` documentation for updated Jupyter integration patterns, which typically involve layouts like `JupyterLayout`.","message":"The `trame.app.jupyter` package has been removed in Trame v3. Its functionalities for Jupyter integration are now directly handled by the layout components.","severity":"deprecated","affected_versions":">=3.0.0"},{"fix":"Always interact with the Trame server through the `trame` meta-package, typically by calling `from trame.app import get_server()` to obtain a properly configured server instance.","message":"`trame-server` is an internal implementation package. Direct usage and instantiation of its core components (e.g., `trame_server.core.Server`) are generally discouraged.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-14T00:00:00.000Z","next_check":"2026-07-13T00:00:00.000Z"}