Skip to main content

streamlit-router

Install

pip install streamlit-router

20240423141943

Example

import streamlit as st
from streamlit_router import StreamlitRouter


def index(router):
    st.text("fron page index")
    x = st.number_input("task id")
    if st.button("create task"):
        router.redirect(*router.build("create_task", {"x": x}))
    if st.button("cancel task"):
        router.redirect(*router.build("cancel_task", {"x": x}))
    if st.button("view task"):
        router.redirect(*router.build("view_task", {"x": x}))
    st.text("others on page index")


# variable router auto inject if as first params
def cancel_task(router, x):
    st.text(f"fron page cancel task x={x}")
    if st.button("back to index"):
        router.redirect(*router.build("index"))
    st.text("others on page cancel task")


# variable router auto inject if as first params
def create_task(x, router):
    st.text(f"fron page create task x={x}")
    if st.button("back to index"):
        router.redirect(*router.build("index"))
    st.text("others on page create task")


router = StreamlitRouter()
router.register(index, "/")
router.register(cancel_task, "/tasks/<int:x>", methods=["DELETE"])
router.register(create_task, "/tasks/<int:x>", methods=["POST"])


# deco also works
@router.map("/tasks/<int:x>")
def view_task(x):
    st.text(f"fron page view task x={x}")
    if st.button("back to index 2"):
        router.redirect(*router.build("index"))
    st.text("others on page view task")


router.serve()

Metadata

Release files for streamlit-router 0.1.8

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

Source distribution (sdist)

Source distribution for streamlit-router 0.1.8
File Size Uploaded Provenance Actions
streamlit_router-0.1.8.tar.gz 3.3 kB Without provenance Details for streamlit_router-0.1.8.tar.gz

Release files / streamlit_router-0.1.8.tar.gz

Download URL streamlit_router-0.1.8.tar.gz
Size 3.3 kB
Tags Source
SHA-256 checksum
How to use checksums
ff9d8f655cd2e0e39a4b6f3a079bfb383ebeb1205adfa9b677c9d5593693c440
BLAKE2b-256 checksum
How to use checksums
0e9fd45842bb91956379b8469c71f923dcb7be722f98e76538a898eae20c82cc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.0 CPython/3.12.3

Security for streamlit-router 0.1.8

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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.

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