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 details)

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

Details for the file st_pages-0.2.0.tar.gz.

File metadata

  • Download URL: st_pages-0.2.0.tar.gz
  • Upload date:
  • Size: 5.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.2.2 CPython/3.10.2 Linux/5.15.0-1022-azure

File hashes

Hashes for st_pages-0.2.0.tar.gz
Algorithm Hash digest
SHA256 f0d8a23d73e0dc0b9b632c289d010551a77cd62618e64e7f1d78f8502c5494a1
MD5 ea7663c7e8d409c796dcca025953f072
BLAKE2b-256 3b64a987ad44b7c9b63de1a9bba7758802531ba7d9526eb6e0b16599367cb18a

See more details on using hashes here.

Provenance

File details

Details for the file st_pages-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: st_pages-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 4.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.2.2 CPython/3.10.2 Linux/5.15.0-1022-azure

File hashes

Hashes for st_pages-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 deea329b789e0de49fe6d67c104f7ab9eaa916944d0a7524827f4827e2d8e892
MD5 76d4a29d2c4e0f28899b56ff88b05e29
BLAKE2b-256 3dbba03731dcfb3c8726a42cfbd5a013f151253a0ce33f2cea14388aa07b46aa

See more details on using hashes here.

Provenance

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