Skip to main content

An experimental version of Streamlit Multi-Page Apps

Project description

Streamlit-Pages

Build Status

Python Versions

Streamlit versions

License

Black

Streamlit App

Installation

pip install st-pages

Why st-pages?

Streamlit has native support for multi-page apps where page filenames are the source of truth for page settings.

But, you might want to be able to change the names, icons or order of your pages without having to rename the files themselves.

This is an experimental package to try out how page-management might work if you could name the pages whatever you wanted, and could manage which pages are visible, and how they appear in the sidebar, via a setup function.

This enables you to set page name, icon and order independently of file name/path, while still retaining the same sidebar & url behavior of current streamlit multi-page apps.

How to use

Method one: declare pages inside your streamlit code

from st_pages import Page, show_pages, add_page_title

# Optional -- adds the title and icon to the current page
add_page_title()

# Specify what pages should be shown in the sidebar, and what their titles and icons
# should be
show_pages(
    [
        Page("streamlit_app.py", "Home", "🏠"),
        Page("other_pages/page2.py", "Page 2", ":books:"),
    ]
)

Method two: declare pages inside of a config file

Contents of .streamlit/pages.toml

[[pages]]
path = "streamlit_app.py"
name = "Home"
icon = "🏠"

[[pages]]
path = "other_pages/page2.py"
name = "Page 2"
icon = ":books:"

Streamlit code:

from st_pages import show_pages_from_config

show_pages_from_config()

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

st_pages-0.2.0.tar.gz (5.1 kB view hashes)

Uploaded Source

Built Distribution

st_pages-0.2.0-py3-none-any.whl (4.8 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page