SkillAgentSearch skills...

Hydralit

A library to create multi-page Streamlit applications with ease.

Install / Use

/learn @TangleSpace/Hydralit
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

Hydralit <img src="https://github.com/TangleSpace/hydralit/raw/main/docs/images/hydra.png" alt="hydra" width="50"/>

The Hydralit package is a wrapping and template project to combine multiple independant (or somewhat dependant) Streamlit applications into a multi-page application.

Currently the project implements a host application HydraApp and each child application simply needs to be either a class deriving from the HydraHeadApp class and implementing a single, simple method, run() for maximum profit, or you can use a Flask style decorator on your functions to add them directly as seperate Streamlit pages.

When converting existing applications, you can effectively put all the existing code inside the run() method and create a wrapper class deriving from HydraHeadApp or put a decorator over the function. Then you create the parent app as an instance of HydraApp, add your child apps to it (see example secure_app.py) and with only a few lines of code everything will magically come together.

<br>

Version 1.0.14 fixes session state refactor performed by Streamlit, maybe after changing it 10 times they'll settle on a way forward, or they're just trying to constantly break the Hydralit package, wtf knows.

  • Now compatible with Streamlit >=1.12, thanks to the tireless efforts of saikumarmk
<br>

Version 1.0.13 fixes the long standing stupidty of Streamlit constantly changing the method name of the session context manager, now works with Streamlit 1.9.x and above.

  • Added the ability to disable to use of the app loader within the constructor. <br>

Version 1.0.12 fixes an edge case when installing with Streamlit for the first time.

<br>

Hydralit now fully supports all versions of Streamlit, including 1.4.0, despite the odd changes made in version 1.4.0 that completely broke Hydralit.

<br>

Hydralit >=1.0.3 now requires a minimum version of Streamlit >=0.86.x to fully support the recently migrated beta containers, if using Streamlit <=0.85.x please continue to use Hydralit <=1.0.2

<br> <p align="center"> <a href="https://pepy.tech/project/hydralit/" alt="PyPI downloads"> <img src="https://pepy.tech/badge/hydralit" /> </a> <a href="https://www.python.org/" alt="Python version"> <img src="https://img.shields.io/pypi/pyversions/hydralit" /></a> <a href="https://pypi.org/project/hydralit/" alt="PyPI version"> <img src="https://img.shields.io/pypi/v/hydralit" /></a> <a href="https://hydralit.aur-license.org/" alt="License"> <img src="http://img.shields.io/:license-Apache-blue.svg?style=flat-square"></a> <a href="https://streamlit.io/" alt="Streamlit"> <img src="http://img.shields.io/:streamlit->=0.86.0-blue.svg?style=flat-square"></a> </p>

Installation

Hydralit can be installed from PyPI:

pip install -U hydralit
<h1><a href="https://hydralit-secure-sample.herokuapp.com/">You can see what's possible using Hydralit here!</a></h1>

Lightning Example

#when we import hydralit, we automatically get all of Streamlit
import hydralit as hy

app = hy.HydraApp(title='Simple Multi-Page App')

@app.addapp()
def my_home():
 hy.info('Hello from app1')

@app.addapp()
def app2():
 hy.info('Hello from app 2')


#Run the whole lot, we get navbar, state management and app isolation, all with this tiny amount of work.
app.run()

This tiny amount of code creates a menu and pages that render when the target function is called by selecting it from the menu.

<p align="center"> <img src="https://github.com/TangleSpace/hydralit_components/blob/main/resources/baby_demo.gif?raw=true" title="Quick Example" alt="Quick Example", width="100%" height="100%"> </p>

Latest features (version 1.0.11)

  • Fully supports all versions of Streamlit, including 1.4.0 (big thanks to oggers for some amazing support!).
  • Fixed the missing error handling bug, now all exceptions are raised to be handled however the user chooses instead of capturing and displaying an image. (big thanks to rambam613 for finding and fixing this bug, very nice!).
  • Can completely customise the Home and Logout menu entries, title and icon data from the add_app entry will be used for these items now as well as the existing.
<p align="center"> <img src="https://github.com/TangleSpace/hydralit_components/blob/main/resources/customised_navbar.PNG?raw=true" title="Navbar" alt="Navbar", width="100%" height="100%"> </p>
  • Cleaned up the formatting when running in sticky and hiding Streamlit headers and footers, yes, they will come back now when using the navbar.
  • Removed the background effort for all loader animations (everyone hated this).
  • Smaller, sleeker navbar, including a much nicer non-animated mode.
<p align="center"> <img src="https://github.com/TangleSpace/hydralit_components/blob/main/resources/non-animated_navbar.PNG?raw=true" title="Navbar" alt="Navbar", width="100%" height="100%"> </p>
  • Full offline support for Font Awesome and Bootstrap icons for navbar entries, as well as all emojis.
  • Improved performance with some refactoring of the session and transition code, apps load faster now.

<br><br

Version 1.0.10 features

  • Added Flask like decorators to convert any function into a child app (see example below)
  • Can set auto login with guest account when using a secure app
  • Support for a non-secure app in a secure app (like a signup app)
  • Full integration with the Hydralit Navbar that now supports complex nav!
  • some bug fixes where app to app redirect was inconsistant
  • Banners
  • Compression behind download button
  • Hydralit Navbar
  • Can turn off the navbar animation now! (must be using Hydralit_components >=1.0.4)

NOTE

Due to the Streamlit execution model, the ability to use internal nav links from a child app is one-shot when using the navbar. This means that the internal link will redirect to the child, however if a script rerun request is made within the child app (changing the value of a widget for example), the nav will bounce back to the calling app. You can disable the navbar and the Streamlit core components nav menu will appear and the internal links will work as expected.

Complex and sticky nav with no Streamlit markers is as easy as a couple of parameters in the Hydralit constructor.

app = HydraApp(title='Secure Hydralit Data Explorer',favicon="🐙",hide_streamlit_markers=True,use_navbar=True, navbar_sticky=True)

Now powered by Hydralit Components.

The Hydralit Navbar is fully integrated, theme aware and animated (you can turn it off if you like), just add your child apps and go, the navbar will appear automatically.

Navbar - Responsive, theme aware and animated.

<p align="center"> <img src="https://raw.githubusercontent.com/tanglespace/hydralit_components/master/resources/hydralit_navbar.gif" title="Quick Example" alt="Quick Example", width="60%" height="100%"> </p>

Spinners and Loaders

Out of the box you get a nice loader/spinner when navigating between apps/pages. You can also create your own loader app and completely customise every part of how it looks and when it loads, even creating different effects depending on the target application. See the Hydralit secure example code to see what is possible.

<p align="center"> <img src="https://github.com/TangleSpace/hydralit_components/blob/main/resources/standard_loaders.gif?raw=true" title="HyLoaders" alt="HyLoaders", width="45%" height="45%"> <img src="https://github.com/TangleSpace/hydralit_components/blob/main/resources/pretty_loaders.gif?raw=true" title="HyLoaderspretty" alt="HyLoaders", width="45%" height="45%"> <img src="https://github.com/TangleSpace/hydralit_components/blob/main/resources/pulse_bars.gif?raw=true" title="HyLoaderspretty" alt="HyLoaders", width="100%" height="60%">

Quick Start

If you have some functions and want them to run like seperate pages, you can quickly get going with a Flask style decorator over your functions.

#when we import hydralit, we automatically get all of Streamlit
import hydralit as hy

app = hy.HydraApp(title='Simple Multi-Page App')

@app.addapp(is_home=True)
def my_home():
 hy.info('Hello from Home!')

@app.addapp()
def app2():
 hy.info('Hello from app 2')

@app.addapp(title='The Best', icon="🥰")
def app3():
 hy.info('Hello from app 3, A.K.A, The Best 🥰')

#Run the whole lot, we get navbar, state management and app isolation, all with this tiny amount of work.
app.run()

This tiny amount of code creates a nice custom multi-page app as below.

<p align="center"> <img src="https://github.com/TangleSpace/hydralit_components/blob/main/resources/quick_demo.gif?raw=true" title="Quick Example" alt="Quick Example", width="100%" height="100%"> </p>

Examples

You can try it out by running the two sample applications with their children that are located in the hydralit-example repository.

hydralit_example> pip install -r requirements.txt

hydralit_example> streamlit run secure.app
<h1><a href="https://hydralit-secure-sample.herokuapp.com/">You can see this example running here</a></h1>

Converting existing applications

This code sample comes directly from the Streamlit example data explorer

import streamlit as st
import pandas as pd
import numpy as np

st.title('Uber pickups in NYC')

DATE_COL
View on GitHub
GitHub Stars219
CategoryDevelopment
Updated1mo ago
Forks20

Languages

Python

Security Score

100/100

Audited on Feb 22, 2026

No findings