Skip to main content

No project description provided

Project description

Streamlit Activities Menu

Demo in the Streamlit community cloud

Builds an interactive activities menu to create a multi-page app using Streamlit's sidebar selectbox, as an alternative to the pages implementation. The available activities (pages) are read from a yaml file. These activities can be used to create a multi-page app using Streamlit.

It is recommended to add the app_activities.yaml at the same level as the main streamlit_app.py. Then, an activities folder is recommended to exist as a subdirectory where the streamlit_app.py is located.

The app_activities.yaml follows the following schema:

# Services for multipage Streamlit app
-
  name: 'Home Page'
  description: 'Home page'
  url: "home.py"

-
  name: 'Data Overview'
  description: 'Overall data overview'
  url: "overview.py"

- 
  name: 'Data Processing'
  description: 'Processing page'
  url: "processing.py"

# Add as required

In the streamlit_app.py:

import os
import streamlit as st
from streamlit_activities_menu import get_available_activities, build_activities_menu

# Load the available activities
ACTIVITIES_FILEPATH = st.secrets['PATHS']['ACTIVITIES_FILEPATH']
ACTIVITIES_DIRPATH = st.secrets['PATHS']['ACTIVITIES_DIRPATH']

# Load the `yaml` file with core activities    
core_activities = get_available_activities(
    activities_filepath=os.path.abspath(ACTIVITIES_FILEPATH)        
)

build_activities_menu(
    activities_dict=core_activities, 
    label='**Menu:**', 
    key='activitiesMenu', 
    activities_dirpath=os.path.abspath(ACTIVITIES_DIRPATH),
    disabled=False
    )

Subfolders

The recommended structure of the files within the subdirectory is:

my_app
|-- streamlit_app.py
|-- app_activities.yaml
|-- activities
|   |-- home.py
|   |-- overview.py
|   |-- processing.py

Mantainers

  • José M. Beltrán-Abaunza, PhD | Lund University, Department of Physical Geography and Ecosystem Science

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

streamlit_activities_menu-0.1.4.tar.gz (6.2 kB view details)

Uploaded Source

Built Distribution

File details

Details for the file streamlit_activities_menu-0.1.4.tar.gz.

File metadata

  • Download URL: streamlit_activities_menu-0.1.4.tar.gz
  • Upload date:
  • Size: 6.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 colorama/0.4.4 importlib-metadata/4.6.4 keyring/23.5.0 pkginfo/1.8.2 readme-renderer/34.0 requests-toolbelt/0.9.1 requests/2.25.1 rfc3986/1.5.0 tqdm/4.57.0 urllib3/1.26.5 CPython/3.10.12

File hashes

Hashes for streamlit_activities_menu-0.1.4.tar.gz
Algorithm Hash digest
SHA256 aa52f4bda7b6125536181e9a27fc8e20469251f7461b819c8e869871ce34536a
MD5 2f737358c857b63ce2bd8a42ebeaa862
BLAKE2b-256 3bdd7e2f945b24949fc32f85560f752e4822e2de87e543ed8c598489766fb025

See more details on using hashes here.

File details

Details for the file streamlit_activities_menu-0.1.4-py3-none-any.whl.

File metadata

  • Download URL: streamlit_activities_menu-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 8.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 colorama/0.4.4 importlib-metadata/4.6.4 keyring/23.5.0 pkginfo/1.8.2 readme-renderer/34.0 requests-toolbelt/0.9.1 requests/2.25.1 rfc3986/1.5.0 tqdm/4.57.0 urllib3/1.26.5 CPython/3.10.12

File hashes

Hashes for streamlit_activities_menu-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 1bc565f0274b334a07849f763e327b11b698a091da03961b74c0017c7a6dd0be
MD5 2de6a9c72d5d8aac06785e035ff3672d
BLAKE2b-256 cb0d3de92881610eb892317057084578c11dd526e82f3d865d66e4ccebfeb200

See more details on using hashes here.

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