Skip to main content

trame-alerts

A trame package to manage and display alerts/notification while being agnostic of the widget framework you want to use. This can be use to report errors and let the user know about the completions of tasks.

demo

Installing

Install trame_alerts using pip

pip install trame_alerts

If you are planning on using the provided vuetify UI widgets to display the alerts run the following:

pip install trame_alerts[vuetify]

If you are planning on using the provided quasar UI widgets to display the alerts run the following:

pip install trame_alerts[quasar]

Usage

The core component to this library is the AlertsProvider widget. This widget manages a portion of the trame state where the status of the alerts is stored, and provides easy access to set of JavaScript variables and functions to any widgets that are its descendants.

from trame.app import get_server
from trame.widgets import html, alerts
from trame.ui.html import DivLayout

server = get_server(client_type="vue3")

with DivLayout(server) as layout:
    with alerts.AlertsProvider():
        html.Button(
            "Create Error",
            click="createErrorAlert({})",
        )

        html.Button(
            "Clear All",
            click="clearAlerts",
        )

        with html.P(v_for="alert in allAlerts", key="alert.id"):
            html.Span("[{{alert.id}}] {{alert.title}} - {{alert.text}}")
            html.Button("Remove", click="removeAlert(alert.id)")

server.start()

The following variables are be made available in JavaScript:

  • alerts: The raw content of the portion of the state where the alerts status is stored
  • allAlerts: An array containing all the alerts that exist in the state.
  • activeAlerts: An array containing the alerts that have not elapsed yet.
  • elapsedAlerts: An array containing the alerts that have elapsed.
  • createAlert: Function to create a generic alert. It takes an Alert object.
  • createSuccessAlert: Function to create a success alert. It takes an Alert object.
  • createWarningAlert: Function to create a warning alert. It takes an Alert object.
  • createErrorAlert: Function to create an error alert. It takes an Alert object.
  • createInfoAlert: Function to create an info alert. It takes an Alert object.
  • dismissAlert: Function to dismiss an alert. It takes an alert id.
  • removeAlert: Function to remove an alert. It takes an alert id.
  • clearAlerts: Function to remove all the alerts. It takes no arguments.

Examples

Refer to the examples folder for minimal complete applications that use the core library as well as the vuetify and quasar UI implementation.

Developing

Build and install the core Vue components

    cd vue-components/core
    npm i
    npm run build
    cd -

Build and install the vuetify Vue components

    cd vue-components/vuetify
    npm i
    npm run build
    cd -

Build and install the quasar Vue components

    cd vue-components/quasar
    npm i
    npm run build
    cd -

Install the library

pip install -e ".[dev,vuetify,quasar]"

License

trame-alerts is made available under the Apache License, Version 2.0. For more details, see LICENSE

Community

Trame | Discussions | Issues | RoadMap | Contact Us

Enjoying trame?

Share your experience with a testimonial or with a brand approval.

JavaScript dependency

This package optionally depends on trame-vuetify and trame-quasar, but does not bundle any specific external JavaScript library.

Metadata

Release files for trame-alerts 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for trame-alerts 0.2.0
File Size Uploaded Provenance Actions
trame_alerts-0.2.0.tar.gz 159.7 kB With provenance Details for trame_alerts-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for trame-alerts 0.2.0
File Interpreter ABI Platform Actions
trame_alerts-0.2.0-py3-none-any.whl Python 3 none any Details for trame_alerts-0.2.0-py3-none-any.whl

Total release size: 322.8 kB

Release files / trame_alerts-0.2.0.tar.gz

Download URL trame_alerts-0.2.0.tar.gz
Size 159.7 kB
Tags Source
SHA-256 checksum
How to use checksums
94f0ef1e262c6b4056ea5805a4e59a29445e9b6654c6a80e5ac26a0cd4f4a30f
BLAKE2b-256 checksum
How to use checksums
ba7ee8e2ae9b8b76bc9a90bb95c35bed06f943cebc630a017b26752819f2e02d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Feb 20, 2025.

Transparency log

Release files / trame_alerts-0.2.0-py3-none-any.whl

Download URL trame_alerts-0.2.0-py3-none-any.whl
Size 163.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8cd626a2f5b4ca1bd3390c5a9096df1e2af60108c94614339bb56bfc53697ffa
BLAKE2b-256 checksum
How to use checksums
a2f622595bebb3e1455ac4f290ca95cac63da275de4b4e3ea4b4e8be7419dc87
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Feb 20, 2025.

Transparency log

Security for trame-alerts 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for trame_alerts-0.2.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Feb 20, 2025.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page