Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

streamlit-event-hook

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

streamlit-event-hook

A Streamlit component that hooks into page rendering events.

  • 0.3.3
  • PyPI
  • Socket score

Maintainers
1

streamlit-event-hook

Hook Streamlit Event

Requirements: streamlit >= 1.37, Python >= 3.8

Introduction

A Streamlit component that allows you to intercept the start and end of page rendering code written by Streamlit users and listen to events during the rendering process.

Below are the enumerated events:

# The script started running.
SCRIPT_STARTED

# The script run stopped because of a compile error.
SCRIPT_STOPPED_WITH_COMPILE_ERROR

# The script run stopped because it ran to completion, or was
# interrupted by the user.
SCRIPT_STOPPED_WITH_SUCCESS

# The script run stopped in order to start a script run with newer widget state.
SCRIPT_STOPPED_FOR_RERUN

# The script run corresponding to a fragment ran to completion, or was interrupted
# by the user.
FRAGMENT_STOPPED_WITH_SUCCESS

# The ScriptRunner is done processing the ScriptEventQueue and
# is shut down.
SHUTDOWN

# "Data" events. These are emitted when the ScriptRunner's script has
# data to send to the frontend.

# The script has a ForwardMsg to send to the frontend.
ENQUEUE_FORWARD_MSG

Installation instructions

pip install streamlit-event-hook

Usage instructions

from streamlit_event_hook import st_listen, render_interceptor, event_handler

@render_interceptor("before")
def before():
    print("Before render page")

@render_interceptor("after")
def after():
    print("After render page")

@event_handler
def st_event_handler(sender, event, forward_msg):
    print(f"sender: {sender} \nevent: {event} \nforward_msg: {forward_msg}")

st_listen()

FAQs


Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc