st_tools
Tools for streamlit.
Persistent session_state across restarts.
Installation
pip install st-tools
Usage
import streamlit as st
from st_tools import SessionStateManager
valid_values = [
"",
"choice 1",
"choice 2",
"choice 3",
"choice 4",
]
# 1. Create a Session State Manager
# with a main key, valid values,
# and default:
config = SessionStateManager(
instance_id="unique-name",
main_key=("selected_item", "", valid_values),
keys=["pagesize"],
)
# 2. Use the main key, save it when changes:
selected_item = st.selectbox(
"Pick item:",
valid_values,
key="selected_item",
on_change=config.save
)
if selected_item:
# 3. load the settings for the main-key-value:
config.initialize({"pagesize": 20})
# 4. Use the settings, save it when it changes
pagesize = st.number_input(
"Page size:", min_value=1, max_value=100, key="pagesize", on_change=config.save
)
print(pagesize)
# 5. Save the settings
config.save()
If you reload the page, it will keep the session_state keys.
Metadata
Release files for st-tools 1.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| st_tools-1.0.1.tar.gz | 3.7 kB | Without provenance | Details for st_tools-1.0.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| st_tools-1.0.1-py3-none-any.whl | Python 3 | none | any | Details for st_tools-1.0.1-py3-none-any.whl |
Total release size: 7.8 kB
Release files / st_tools-1.0.1.tar.gz
| Download URL | st_tools-1.0.1.tar.gz |
|---|---|
| Size | 3.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
295bb2402e0d39da7a9bc58bd04553bbcfd3bead5a48dc0e3b31654e78aac7be
|
|
BLAKE2b-256 checksum How to use checksums |
f04c892efd65507398a41b6ebc2ef924349f9a920d7e8512858cd2366681df42
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.13
|
Release files / st_tools-1.0.1-py3-none-any.whl
| Download URL | st_tools-1.0.1-py3-none-any.whl |
|---|---|
| Size | 4.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
06a4707bc48ba1b000af055877bebc48c8f40805c1a1cba5ace5bef2e8e76804
|
|
BLAKE2b-256 checksum How to use checksums |
76c7c4929fec6831f8b543b9e2993c3d220f137344f1e56e77510820fbc608da
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.13
|
Security for st-tools 1.0.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.