Metadata-Version: 2.1
Name: streamlit-app
Version: 0.0.1
Summary: A applet to use streamlit objectification
Home-page: 
Author: changxing
Author-email: 1278729001@qq.com
License: MIT License
Platform: all
Classifier: Intended Audience :: Developers
Classifier: Operating System :: OS Independent
Classifier: Natural Language :: Chinese (Simplified)
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Topic :: Software Development :: Libraries
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: streamlit==1.31.0

# Streamlit 的对象化处理工具

Streamlit-App 通过根据在部署目录自动创建满足 streamlit 多页面要求的 py 脚本的方法，实现了对象化创建 streamlit 服务的功能。

## 安装

```bash
pip install streamlit-app
```

## 使用

```python
import streamlit as st

from streamlit_app import Application, StreamlitPage


class MyMainPage(StreamlitPage):

    @staticmethod
    def page_name() -> str:
        return "test_main_page"

    def draw_page(self) -> None:
        st.title("Main Page Title")
        st.write("streamlit-app app page test")


class MySubPage(StreamlitPage):

    @staticmethod
    def page_name() -> 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)
    application.append_page(MySubPage)
    application.deploy_and_start()
```

实例化 `StreamlitPage.Application` 类，调用 `set_main_page()` 方法设置主页面，使用 `append_page()` 方法设置其他页面，在设置完成后，调用 `deploy_and_start()` 方法部署并启动 Streamlit 服务。
