Tool allowing to stack streamlit commands and resolve them in a controlable manner.
Project description
streamlit_stacker
streamlit_stacker is a python package implementing a main st_stacker class. This class can be used with similar syntax as the streamlit module but the calls to commands will be stacked and rendered latter in a controlable manner.
Useful to implement dynamic execution of streamlit commands in an interactive console interface. Supports (almost) all streamlit methods
Installation
$ pip install streamlit_stacker
Usage
import streamlit as st
from streamlit_stacker import st_stacker
#shortcut
state=st.session_state
#define the stacker in state
if not 'stacker' in state:
state.stacker=st_stacker()
stk=state.stacker
#resets all commands in the stacker to a non-rendered state, so that the next call to refresh will render them again
stk.reset()
if not 'test' in state:
#stack a chat message, won't be rendered immediately
with stk.chat_message():
stk.write("Hello!")
state.test=True
#render the stack: the chat message will appear on screen on every rerun, even though the corresponding commands have been called only once at first run
stk.refresh()
License
This project is licensed. Please see the LICENSE file for more details.
Contributions
Contributions are welcome. Please open an issue or a pull request to suggest changes or additions.
Contact
For any questions or support requests, please contact Baptiste Ferrand at the following address: bferrand.maths@gmail.com.
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
Built Distribution
File details
Details for the file streamlit_stacker-0.0.1.tar.gz
.
File metadata
- Download URL: streamlit_stacker-0.0.1.tar.gz
- Upload date:
- Size: 9.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7663eac4f42fda4af743d2d8b385a9732f90e50e4c6dd47522fd20dc3601d7a1 |
|
MD5 | d7f8cb9ddf13c02f40513bc05f3eeeb7 |
|
BLAKE2b-256 | 063c8d7435d1d2c8e5fb23faaf968ff4a95a5f55ac8a9ffb6ba72b76c1907c6f |
File details
Details for the file streamlit_stacker-0.0.1-py3-none-any.whl
.
File metadata
- Download URL: streamlit_stacker-0.0.1-py3-none-any.whl
- Upload date:
- Size: 9.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3e8cd0052e003489f3f2a7171c9129e879fbdd3ab2ec701460570fdfb5592432 |
|
MD5 | 0ecccf3c32e1884247600c9f83010dde |
|
BLAKE2b-256 | 104cfc0ac7b0b5209c6c3e2d18b5aa2b1690655910a72e0846185d64407388ea |