streamlit-component-loader 0.2.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- streamlit_component_loader-0.2.0/LICENSE +21 -0
- streamlit_component_loader-0.2.0/PKG-INFO +27 -0
- streamlit_component_loader-0.2.0/README.md +164 -0
- streamlit_component_loader-0.2.0/setup.cfg +4 -0
- streamlit_component_loader-0.2.0/setup.py +47 -0
- streamlit_component_loader-0.2.0/streamlit_component_loader.egg-info/PKG-INFO +27 -0
- streamlit_component_loader-0.2.0/streamlit_component_loader.egg-info/SOURCES.txt +9 -0
- streamlit_component_loader-0.2.0/streamlit_component_loader.egg-info/dependency_links.txt +1 -0
- streamlit_component_loader-0.2.0/streamlit_component_loader.egg-info/requires.txt +1 -0
- streamlit_component_loader-0.2.0/streamlit_component_loader.egg-info/top_level.txt +1 -0
- streamlit_component_loader-0.2.0/streamlit_plugins/components/loader/__init__.py +4431 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2023 Víctor Quilón Ranera
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: streamlit-component-loader
|
|
3
|
+
Version: 0.2.0
|
|
4
|
+
Summary: Components and Frameworks to give new features to streamlit
|
|
5
|
+
Home-page: https://github.com/quiradev/streamlit-plugins
|
|
6
|
+
Author: Victor Quilon Ranera
|
|
7
|
+
Author-email: v.quilonr@gmail.com
|
|
8
|
+
License: MIT
|
|
9
|
+
Keywords: streamlit,plugins,components,loader
|
|
10
|
+
Classifier: Intended Audience :: Developers
|
|
11
|
+
Classifier: Programming Language :: Python
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
15
|
+
Requires-Python: >=3.9
|
|
16
|
+
Description-Content-Type: text/markdown
|
|
17
|
+
License-File: LICENSE
|
|
18
|
+
Requires-Dist: streamlit<=1.37.0
|
|
19
|
+
|
|
20
|
+
# streamlit-plugins
|
|
21
|
+
Components and Frameworks to give new features to streamlit
|
|
22
|
+
|
|
23
|
+
## Components
|
|
24
|
+
The Loader component is inherited from Hydralit components, only to give support to the multilit framework.
|
|
25
|
+
But this version has improve the loaders to be more user-friendly.
|
|
26
|
+
|
|
27
|
+
### Loader (Inherit from Hydralit Components)
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
# streamlit-plugins
|
|
2
|
+
Components and Frameworks to give new features to streamlit
|
|
3
|
+
|
|
4
|
+

|
|
5
|
+
|
|
6
|
+
## Frameworks
|
|
7
|
+
### Multilit (Inherit from Hydralit)
|
|
8
|
+
This is a fork of [Hydralit](https://github.com/TangleSpace/hydralit).
|
|
9
|
+
|
|
10
|
+
In this version, I update all the code to be compatible with the last version of streamlit.
|
|
11
|
+
And it improves the interface to be more user-friendly. Also, it respects the strealit active theme and can be override by the user.
|
|
12
|
+
In a future is planned to incorporate the new multipage native of streamlit. Instead of the current implementation.
|
|
13
|
+
|
|
14
|
+
Can use built-in buttons to change the page, or use a function to change the page programmatically.
|
|
15
|
+

|
|
16
|
+
|
|
17
|
+
## Components
|
|
18
|
+
The Navbar and Loader component are inherited from Hydralit components, only to give support to the multilit framework.
|
|
19
|
+
But this version has improve the interface and loaders to be more user-friendly.
|
|
20
|
+
|
|
21
|
+
### Navbar (Inherit from Hydralit Components)
|
|
22
|
+
Component to use when you want to have a navbar in your streamlit app.
|
|
23
|
+
It can be used with native multipage streamlit, or use the multilit framework.
|
|
24
|
+
|
|
25
|
+
If you want to use the native multipage streamlit, you can use the `st_navbar` function to create the navbar.
|
|
26
|
+
|
|
27
|
+
This component it returns the id of the defined menu that has to run the page.
|
|
28
|
+
|
|
29
|
+
This is an example of multipage with native streamlit
|
|
30
|
+
```python
|
|
31
|
+
import streamlit as st
|
|
32
|
+
|
|
33
|
+
if "logged_in" not in st.session_state:
|
|
34
|
+
st.session_state.logged_in = False
|
|
35
|
+
|
|
36
|
+
def login():
|
|
37
|
+
if st.button("Log in"):
|
|
38
|
+
st.session_state.logged_in = True
|
|
39
|
+
st.rerun()
|
|
40
|
+
|
|
41
|
+
def logout():
|
|
42
|
+
if st.button("Log out"):
|
|
43
|
+
st.session_state.logged_in = False
|
|
44
|
+
st.rerun()
|
|
45
|
+
|
|
46
|
+
login_page = st.Page(login, title="Log in", icon=":material/login:")
|
|
47
|
+
logout_page = st.Page(logout, title="Log out", icon=":material/logout:")
|
|
48
|
+
|
|
49
|
+
dashboard = st.Page(
|
|
50
|
+
"reports/dashboard.py", title="Dashboard", icon=":material/dashboard:", default=True
|
|
51
|
+
)
|
|
52
|
+
bugs = st.Page("reports/bugs.py", title="Bug reports", icon=":material/bug_report:")
|
|
53
|
+
alerts = st.Page(
|
|
54
|
+
"reports/alerts.py", title="System alerts", icon=":material/notification_important:"
|
|
55
|
+
)
|
|
56
|
+
|
|
57
|
+
search = st.Page("tools/search.py", title="Search", icon=":material/search:")
|
|
58
|
+
history = st.Page("tools/history.py", title="History", icon=":material/history:")
|
|
59
|
+
|
|
60
|
+
if st.session_state.logged_in:
|
|
61
|
+
pg = st.navigation(
|
|
62
|
+
{
|
|
63
|
+
"Account": [logout_page],
|
|
64
|
+
"Reports": [dashboard, bugs, alerts],
|
|
65
|
+
"Tools": [search, history],
|
|
66
|
+
}
|
|
67
|
+
)
|
|
68
|
+
else:
|
|
69
|
+
pg = st.navigation([login_page])
|
|
70
|
+
|
|
71
|
+
pg.run()
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
And if you want to use streamlit Navbar, it has to be addapted to this code:
|
|
75
|
+
```python
|
|
76
|
+
import streamlit as st
|
|
77
|
+
|
|
78
|
+
st.set_page_config(layout="wide")
|
|
79
|
+
|
|
80
|
+
if "logged_in" not in st.session_state:
|
|
81
|
+
st.session_state.logged_in = False
|
|
82
|
+
|
|
83
|
+
if "app_id" not in st.session_state:
|
|
84
|
+
st.session_state.app_id = None
|
|
85
|
+
|
|
86
|
+
def login():
|
|
87
|
+
if st.button("Log in"):
|
|
88
|
+
st.session_state.logged_in = True
|
|
89
|
+
st.session_state.app_id = "app_default"
|
|
90
|
+
st.rerun()
|
|
91
|
+
|
|
92
|
+
def logout():
|
|
93
|
+
if st.button("Log out"):
|
|
94
|
+
st.session_state.logged_in = False
|
|
95
|
+
st.session_state.app_id = None
|
|
96
|
+
st.rerun()
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
login_page = st.Page(login, title="Log in", icon=":material/login:")
|
|
100
|
+
logout_page = st.Page(logout, title="Log out", icon=":material/logout:")
|
|
101
|
+
|
|
102
|
+
dashboard = st.Page(
|
|
103
|
+
"reports/dashboard.py", title="Dashboard", icon=":material/dashboard:", default=True
|
|
104
|
+
)
|
|
105
|
+
bugs = st.Page("reports/bugs.py", title="Bug reports", icon=":material/bug_report:")
|
|
106
|
+
alerts = st.Page(
|
|
107
|
+
"reports/alerts.py", title="System alerts", icon=":material/notification_important:"
|
|
108
|
+
)
|
|
109
|
+
|
|
110
|
+
search = st.Page("tools/search.py", title="Search", icon=":material/search:")
|
|
111
|
+
history = st.Page("tools/history.py", title="History", icon=":material/history:")
|
|
112
|
+
|
|
113
|
+
# HERE IS THE CHANGE
|
|
114
|
+
from streamlit_plugins.components.navbar import st_navbar, build_menu_from_st_pages
|
|
115
|
+
|
|
116
|
+
menu_data, app_map = build_menu_from_st_pages(
|
|
117
|
+
{"Reports": [dashboard, bugs, alerts]}, {"Tools": [search, history]},
|
|
118
|
+
login_app=login_page,
|
|
119
|
+
logout_app=logout_page,
|
|
120
|
+
)
|
|
121
|
+
|
|
122
|
+
app_id = st_navbar(
|
|
123
|
+
menu_definition=menu_data if st.session_state.logged_in else [],
|
|
124
|
+
login_name=logout_page.title if st.session_state.logged_in else login_page.title,
|
|
125
|
+
hide_streamlit_markers=False,
|
|
126
|
+
override_app_selected_id=st.session_state.app_id,
|
|
127
|
+
sticky_nav=True, # at the top or not
|
|
128
|
+
sticky_mode='pinned', # sticky or pinned
|
|
129
|
+
)
|
|
130
|
+
if app_id == "app_login":
|
|
131
|
+
if st.session_state.logged_in:
|
|
132
|
+
app_id = "app_logout"
|
|
133
|
+
|
|
134
|
+
st.session_state.app_id = None # Added to fix login/logout issue
|
|
135
|
+
app_map[app_id]._can_be_called = True
|
|
136
|
+
app_map[app_id].run()
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
# if st.session_state.logged_in:
|
|
140
|
+
# pg = st.navigation(
|
|
141
|
+
# {
|
|
142
|
+
# "Account": [logout_page],
|
|
143
|
+
# "Reports": [dashboard, bugs, alerts],
|
|
144
|
+
# "Tools": [search, history],
|
|
145
|
+
# },
|
|
146
|
+
# position="hidden"
|
|
147
|
+
# )
|
|
148
|
+
#
|
|
149
|
+
# else:
|
|
150
|
+
# pg = st.navigation([login_page], position="hidden")
|
|
151
|
+
#
|
|
152
|
+
#
|
|
153
|
+
# pg.run()
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
### Loader (Inherit from Hydralit Components)
|
|
157
|
+
|
|
158
|
+
### AnnotatedText (Inspired from SpaCy Anotated Text)
|
|
159
|
+
|
|
160
|
+
### LabelStudio (Developing)
|
|
161
|
+
LabelStudio adapter for NERs into streamlit
|
|
162
|
+
|
|
163
|
+
### SnakeViz
|
|
164
|
+
Interface in streamlit to measue bottlenecks in yout code
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import os
|
|
2
|
+
from io import open
|
|
3
|
+
from pathlib import Path
|
|
4
|
+
|
|
5
|
+
from setuptools import setup, find_packages
|
|
6
|
+
|
|
7
|
+
with open(os.path.join(Path(__file__).parent / 'README.md'), encoding='utf-8') as f:
|
|
8
|
+
long_description = f.read()
|
|
9
|
+
|
|
10
|
+
# Se leen los requirements de requirements.txt
|
|
11
|
+
with open(os.path.join(Path(__file__).parent, 'requirements.txt'), encoding='utf-8') as f:
|
|
12
|
+
requirements = f.read().splitlines()
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
setup(
|
|
16
|
+
name='streamlit-plugins',
|
|
17
|
+
version='0.2.0',
|
|
18
|
+
license='MIT',
|
|
19
|
+
url='https://github.com/quiradev/streamlit-plugins',
|
|
20
|
+
description='Components and Frameworks to give new features to streamlit',
|
|
21
|
+
long_description=long_description,
|
|
22
|
+
long_description_content_type="text/markdown",
|
|
23
|
+
author_email='v.quilonr@gmail.com',
|
|
24
|
+
author='Victor Quilon Ranera',
|
|
25
|
+
packages=find_packages(),
|
|
26
|
+
python_requires='>=3.9',
|
|
27
|
+
install_requires=[
|
|
28
|
+
*requirements,
|
|
29
|
+
],
|
|
30
|
+
include_package_data=True,
|
|
31
|
+
package_data={
|
|
32
|
+
"streamlit_plugins": ["components/*/frontend/build/**/*"]
|
|
33
|
+
},
|
|
34
|
+
classifiers=[
|
|
35
|
+
'Intended Audience :: Developers',
|
|
36
|
+
'Programming Language :: Python',
|
|
37
|
+
'Programming Language :: Python :: 3.9',
|
|
38
|
+
'Programming Language :: Python :: 3.10',
|
|
39
|
+
'Programming Language :: Python :: 3.11',
|
|
40
|
+
],
|
|
41
|
+
keywords=["streamlit", "plugins", "framework", "components", "navbar", "loader", "multilit"],
|
|
42
|
+
options={
|
|
43
|
+
'sdist': {'dist_dir': './dist/streamlit-plugins'},
|
|
44
|
+
'bdist_wheel': {'dist_dir': './dist/streamlit-plugins'},
|
|
45
|
+
'build': {'build_base': './build/streamlit-plugins'}
|
|
46
|
+
}
|
|
47
|
+
)
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: streamlit-component-loader
|
|
3
|
+
Version: 0.2.0
|
|
4
|
+
Summary: Components and Frameworks to give new features to streamlit
|
|
5
|
+
Home-page: https://github.com/quiradev/streamlit-plugins
|
|
6
|
+
Author: Victor Quilon Ranera
|
|
7
|
+
Author-email: v.quilonr@gmail.com
|
|
8
|
+
License: MIT
|
|
9
|
+
Keywords: streamlit,plugins,components,loader
|
|
10
|
+
Classifier: Intended Audience :: Developers
|
|
11
|
+
Classifier: Programming Language :: Python
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
15
|
+
Requires-Python: >=3.9
|
|
16
|
+
Description-Content-Type: text/markdown
|
|
17
|
+
License-File: LICENSE
|
|
18
|
+
Requires-Dist: streamlit<=1.37.0
|
|
19
|
+
|
|
20
|
+
# streamlit-plugins
|
|
21
|
+
Components and Frameworks to give new features to streamlit
|
|
22
|
+
|
|
23
|
+
## Components
|
|
24
|
+
The Loader component is inherited from Hydralit components, only to give support to the multilit framework.
|
|
25
|
+
But this version has improve the loaders to be more user-friendly.
|
|
26
|
+
|
|
27
|
+
### Loader (Inherit from Hydralit Components)
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
LICENSE
|
|
2
|
+
README.md
|
|
3
|
+
setup.py
|
|
4
|
+
streamlit_component_loader.egg-info/PKG-INFO
|
|
5
|
+
streamlit_component_loader.egg-info/SOURCES.txt
|
|
6
|
+
streamlit_component_loader.egg-info/dependency_links.txt
|
|
7
|
+
streamlit_component_loader.egg-info/requires.txt
|
|
8
|
+
streamlit_component_loader.egg-info/top_level.txt
|
|
9
|
+
streamlit_plugins/components/loader/__init__.py
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
streamlit<=1.37.0
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
streamlit_plugins
|