Extra-Streamlit-Components 项目教程
1. 项目的目录结构及介绍
Extra-Streamlit-Components/
├── LICENSE
├── README.md
├── setup.py
├── extra_streamlit_components/
│ ├── __init__.py
│ ├── components.py
│ ├── router.py
│ └── utils.py
└── examples/
├── basic_example.py
└── advanced_example.py
- LICENSE: 项目许可证文件。
- README.md: 项目说明文档。
- setup.py: 项目安装脚本。
- extra_streamlit_components/: 核心代码目录。
- init.py: 模块初始化文件。
- components.py: 包含自定义组件的实现。
- router.py: 路由功能实现。
- utils.py: 工具函数。
- examples/: 示例代码目录。
- basic_example.py: 基本示例。
- advanced_example.py: 高级示例。
2. 项目的启动文件介绍
项目的启动文件通常是指示例代码中的 basic_example.py
或 advanced_example.py
。这些文件展示了如何使用 extra_streamlit_components
包中的组件。
basic_example.py
import streamlit as st
import extra_streamlit_components as stx
chosen_id = stx.tab_bar(data=[
stx.TabBarItemData(id=1, title="ToDo", description="Tasks to take care of"),
stx.TabBarItemData(id=2, title="Done", description="Tasks taken care of"),
stx.TabBarItemData(id=3, title="Overdue", description="Tasks missed out")
], default=1)
st.info(f"{chosen_id=}")
image_urls = [
"https://streamlit.io/images/brand/streamlit-logo-secondary-colormark-darktext.svg",
"https://streamlit.io/images/brand/streamlit-logo-secondary-lightmark-lighttext.png",
"https://ruslanmv.com/assets/images/posts/2020-10-17-Web-Application-Classification/streamlit_logo.png"
]
stx.bouncing_image(image_source=image_urls[int(chosen_id) - 1], animate=True, animation_time=1500, height=200, width=600)
advanced_example.py
# 高级示例代码
3. 项目的配置文件介绍
项目中没有明确的配置文件,但可以通过 setup.py
文件来了解项目的安装和依赖信息。
setup.py
from setuptools import setup, find_packages
setup(
name="extra_streamlit_components",
version="0.1.71",
packages=find_packages(),
install_requires=[
"streamlit",
# 其他依赖
],
author="Mohamed Abdou",
author_email="your-email@example.com",
description="An all-in-one place to find complex or just not available components by default on streamlit",
license="MIT",
url="https://github.com/Mohamed-512/Extra-Streamlit-Components",
classifiers=[
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
],
)
这个文件定义了项目的名称、版本、依赖、作者等信息,是安装和分发项目的关键文件。
创作声明:本文部分内容由AI辅助生成(AIGC),仅供参考