Registry / web-framework / trame-client

trame-client

JSON →
library3.13.2pypypi✓ verified 86d ago

trame-client is the internal JavaScript core of the trame framework, providing client-side infrastructure for web applications. It handles connections to a trame server, state synchronization, method calls, dynamic component loading, and template feeding in the browser. It is typically installed as a dependency of the main 'trame' package and is not intended for direct end-user Python interaction. The current version is 3.11.4, and it follows the release cadence of the trame ecosystem.

pip install trame-client
INSTALL
IMPORT
SIG · TRAME-CLIENT
T
trame-client
web-frameworkpythonv3.13.2
Install
3.2s avg
Import
147ms
Disk
34MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v3.13.2 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.940 runs
installs and imports cleanly · install 0.0s · import 0.153s · 33.8MB
glibc
py 3.103.940 runs
installs and imports cleanly · install 3.2s · import 0.141s · 37MB
34MB installed
● package 34MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

trame.widgets.html
from trame.widgets import html
While trame-client is the underlying JavaScript engine, end-users interact with client-side components primarily through trame's Python API, such as widgets exposed in `trame.widgets.html` or other trame widget libraries.

This quickstart demonstrates a basic Trame application, which implicitly uses `trame-client` for its client-side functionality. Since `trame-client` is an internal dependency, end-users typically interact with Trame through its main API and widgets. Run this Python script and navigate to the displayed URL in your browser.

from trame.app import get_server from trame.ui.html import Div from trame.widgets import html # ----------------------------------------------------------------------------- # Trame setup (trame-client is implicitly used by trame) # ----------------------------------------------------------------------------- server = get_server(name="trame_client_example") # Explicitly set client_type for trame v3+ to manage Vue.js version server.client_type = "vue3" state, ctrl = server.state, server.controller # 1. Initial state state.value = 0 state.message = "Initial message" # 2. Callbacks @state.change("value") def update_message(value, **kwargs): state.message = f"Value is now: {value}" def increment(): state.value += 1 # 3. UI definition using trame.widgets.html (which relies on trame-client) with Div(classes="container") as main_layout: with html.Div("Hello Trame-client!", classes="text-h4 q-my-md"): pass with html.Div(classes="text-h6 q-my-md"): html.P("Current message: {{ message }}") with html.Button("Increment", click=increment, classes="q-mr-sm"): pass with html.Span("Value: {{ value }}", classes="q-ml-sm"): pass # 4. Start server if __name__ == "__main__": # This will open a browser window with the Trame application server.start()
Debug
Known issues
breakingTrame v3 (and by extension, trame-client in its context) changed the default client type from Vue 2 to Vue 3 starting December 2023. Existing applications built with Vue 2 components might break if not explicitly configured.
fix
Explicitly set `server.client_type = 'vue2'` in your Trame application if you need to maintain compatibility with Vue 2 components. For new development or migration, embrace Vue 3 and its compatible widgets.
affects: trame >= 3.0.0, trame-client >= 3.0.0
breakingWith trame v3, the default dependency list was shrunk. Core widgets like Vuetify, VTK, and Plotly are no longer bundled by default with the main `trame` package. They must be installed separately as `trame-vuetify`, `trame-vtk`, `trame-plotly`, etc.
fix
Ensure you explicitly install any required trame widget libraries (e.g., `pip install trame-vuetify trame-vtk`) in your project's dependencies if your application uses them.
affects: trame >= 3.0.0, trame-client >= 3.0.0
gotchatrame-client is primarily a client-side (JavaScript) library bundled for Python's trame framework. It is not intended for direct Python imports or standalone usage for application logic. All client-side interactions are abstracted and managed by the main `trame` library.
fix
Avoid attempting to import directly from `trame_client` in your Python application code. Instead, use the `trame` API (e.g., `from trame.app import get_server`, `from trame.widgets import html`).
affects: All versions
gotchaWhen deploying Trame applications, a common issue is the client loading screen appearing before the Trame server's WebSocket connection is fully established, leading to a 'connection_error'.
fix
Ensure that the Trame server is fully started and its WebSocket endpoint is ready before making the application accessible to users (e.g., deferring Nginx startup until the Trame server responds successfully). Consider implementing client-side retries or automatic page refreshes if the WebSocket connection fails initially.
affects: All versions
Errors
Common errors & fixes
WebSocket connection to 'ws://localhost:8080/ws' failed:
The trame Python server, which the trame-client attempts to connect to via WebSockets, is either not running, unreachable, or blocked by a firewall/proxy.
fix
Ensure your trame Python application is running (e.g., `server.start()`), verify the server's host and port, check local firewall settings, and confirm no other process is occupying the specified port.
[Vue warn]: Property or method "myVariable" is not defined on the instance but referenced during render.
A variable, method, or property is referenced within a trame template (which uses Vue syntax via trame-client) but has not been properly defined in the trame application's Python `state` or exposed as a client-side method.
fix
Define the missing property in the trame `state` dictionary (e.g., `state.myVariable = 'initial_value'`) or register the method using appropriate trame decorators or functions in your Python script.
Failed to load component: <my-custom-component>
The trame-client was unable to find or load the specified component, usually because it was not correctly registered on the Python side, or its JavaScript/HTML definition is inaccessible or malformed.
fix
Verify that the component is correctly registered in your trame Python application using `html.client.set_component`, `html.client.load_script`, or `html.client.load_style`, and that its definition is available to the client.
Upgrade
Version history
3.13.2latest on PyPI · released Jun 10, 2026
Audit
Dependencies
tramerequiredtrame-client is an internal component of the trame framework and is generally used as a dependency of the main 'trame' package.
Agent activity
8 hits · last 30 days
node
8
Resources
trame-client — pip install trame-client · libregistry