Streamlit 的对象化处理工具
Streamlit-App 通过根据在部署目录自动创建满足 streamlit 多页面要求的 py 脚本的方法,实现了对象化创建 streamlit 服务的功能。
安装
pip install streamlit-app
使用
import streamlit as st
from streamlit_app import Application, StreamlitPage
class MyMainPage(StreamlitPage):
def page_name(self) -> str:
return self.params.get("name")
def draw_page(self) -> None:
st.title("Main Page Title")
st.write("streamlit-app app page test")
class MySubPage(StreamlitPage):
def page_name(self) -> str:
return "test_sub_page"
def draw_page(self) -> None:
st.title("Sub Page Title")
st.write("streamlit-app sub page test")
if __name__ == "__main__":
application = Application()
application.set_main_page(MyMainPage, params={"name": "Main Page Title"})
application.append_page(MySubPage)
application.deploy_and_start()
实例化 StreamlitPage.Application 类,调用 set_main_page() 方法设置主页面,使用 append_page() 方法设置其他页面,在设置完成后,调用 deploy_and_start() 方法部署并启动 Streamlit 服务。
修改记录
0.0.3
- 新增:根据调用栈自动计算组件的唯一键的工具
- 修复:修复不同路径下 py 脚本文件名相同无法正常展示的 Bug
0.0.2
- 新增:支持在初始化 StreamPage 时添加参数,将 StreamPage 的静态方法改为非静态方法
0.0.1:初始化
Metadata
Release files for streamlit-app 0.0.3
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 |
|---|---|---|---|---|
| streamlit-app-0.0.3.tar.gz | 6.2 kB | Without provenance | Details for streamlit-app-0.0.3.tar.gz |
Release files / streamlit-app-0.0.3.tar.gz
| Download URL | streamlit-app-0.0.3.tar.gz |
|---|---|
| Size | 6.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6ec74ae26366aab05bbf272ad366dc14bb4f6d0dde38e3f291f513526a517f8c
|
|
BLAKE2b-256 checksum How to use checksums |
74ab26175fc79bfdcecf4415cca3b49d50eaed511f25709f68686ef4a44c661d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.0.0 CPython/3.11.5
|
Security for streamlit-app 0.0.3
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.