sweatstack 0.42.0__py3-none-any.whl → 0.43.0__py3-none-any.whl
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.
- sweatstack/streamlit.py +11 -7
- {sweatstack-0.42.0.dist-info → sweatstack-0.43.0.dist-info}/METADATA +1 -1
- {sweatstack-0.42.0.dist-info → sweatstack-0.43.0.dist-info}/RECORD +5 -5
- {sweatstack-0.42.0.dist-info → sweatstack-0.43.0.dist-info}/WHEEL +0 -0
- {sweatstack-0.42.0.dist-info → sweatstack-0.43.0.dist-info}/entry_points.txt +0 -0
sweatstack/streamlit.py
CHANGED
|
@@ -60,8 +60,9 @@ class StreamlitAuth:
|
|
|
60
60
|
def _running_on_streamlit_cloud(self):
|
|
61
61
|
return os.environ.get("HOSTNAME") == "streamlit"
|
|
62
62
|
|
|
63
|
-
def _show_sweatstack_login(self):
|
|
64
|
-
authorization_url = self.
|
|
63
|
+
def _show_sweatstack_login(self, login_label: str | None = None):
|
|
64
|
+
authorization_url = self.get_authorization_url()
|
|
65
|
+
login_label = login_label or "Connect with SweatStack"
|
|
65
66
|
if not self._running_on_streamlit_cloud():
|
|
66
67
|
st.markdown(
|
|
67
68
|
f"""
|
|
@@ -87,14 +88,14 @@ class StreamlitAuth:
|
|
|
87
88
|
border: none;
|
|
88
89
|
transition: all 0.3s ease;
|
|
89
90
|
cursor: pointer;"
|
|
90
|
-
>
|
|
91
|
+
>{login_label}</a>
|
|
91
92
|
""",
|
|
92
93
|
unsafe_allow_html=True,
|
|
93
94
|
)
|
|
94
95
|
else:
|
|
95
|
-
st.link_button(
|
|
96
|
+
st.link_button(login_label, authorization_url)
|
|
96
97
|
|
|
97
|
-
def
|
|
98
|
+
def get_authorization_url(self):
|
|
98
99
|
params = {
|
|
99
100
|
"client_id": self.client_id,
|
|
100
101
|
"redirect_uri": self.redirect_uri,
|
|
@@ -145,7 +146,7 @@ class StreamlitAuth:
|
|
|
145
146
|
"""
|
|
146
147
|
return self.api_key is not None
|
|
147
148
|
|
|
148
|
-
def authenticate(self):
|
|
149
|
+
def authenticate(self, login_label: str | None = None):
|
|
149
150
|
"""Authenticates the user with SweatStack.
|
|
150
151
|
|
|
151
152
|
This method handles the authentication flow for SweatStack in a Streamlit app.
|
|
@@ -157,6 +158,9 @@ class StreamlitAuth:
|
|
|
157
158
|
to the Streamlit app with an authorization code, which is exchanged for an
|
|
158
159
|
access token.
|
|
159
160
|
|
|
161
|
+
Args:
|
|
162
|
+
login_label: The label to display on the login button. Defaults to "Login with SweatStack".
|
|
163
|
+
|
|
160
164
|
Returns:
|
|
161
165
|
None
|
|
162
166
|
"""
|
|
@@ -170,7 +174,7 @@ class StreamlitAuth:
|
|
|
170
174
|
st.query_params.clear()
|
|
171
175
|
st.rerun()
|
|
172
176
|
else:
|
|
173
|
-
self._show_sweatstack_login()
|
|
177
|
+
self._show_sweatstack_login(login_label)
|
|
174
178
|
|
|
175
179
|
def select_user(self):
|
|
176
180
|
"""Displays a user selection dropdown and switches the client to the selected user.
|
|
@@ -7,11 +7,11 @@ sweatstack/jupyterlab_oauth2_startup.py,sha256=eZ6xi0Sa4hO4vUanimq0SqjduHtiywCUR
|
|
|
7
7
|
sweatstack/openapi_schemas.py,sha256=uS5p_ksdF605FNTOhJ_VPPUCxJHOVJwyIOwVfXS-wEI,37019
|
|
8
8
|
sweatstack/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
9
9
|
sweatstack/schemas.py,sha256=d6KRMJalaABO61CPm3afs-hM6zUcwbGrZ5mc6SVuc54,3370
|
|
10
|
-
sweatstack/streamlit.py,sha256=
|
|
10
|
+
sweatstack/streamlit.py,sha256=_PER03s0dYu5eF1MZdewPDqSvYHqMr0lZLu_EnGit3Y,13257
|
|
11
11
|
sweatstack/sweatshell.py,sha256=MYLNcWbOdceqKJ3S0Pe8dwHXEeYsGJNjQoYUXpMTftA,333
|
|
12
12
|
sweatstack/utils.py,sha256=AwHRdC1ziOZ5o9RBIB21Uxm-DoClVRAJSVvgsmSmvps,1801
|
|
13
13
|
sweatstack/Sweat Stack examples/Getting started.ipynb,sha256=k2hiSffWecoQ0VxjdpDcgFzBXDQiYEebhnAYlu8cgX8,6335204
|
|
14
|
-
sweatstack-0.
|
|
15
|
-
sweatstack-0.
|
|
16
|
-
sweatstack-0.
|
|
17
|
-
sweatstack-0.
|
|
14
|
+
sweatstack-0.43.0.dist-info/METADATA,sha256=GnKcaUO0jixhdxYpvT4uKWLx3jfr3fBYi89FrTohmv0,779
|
|
15
|
+
sweatstack-0.43.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
16
|
+
sweatstack-0.43.0.dist-info/entry_points.txt,sha256=kCzOUQI3dqbTpEYqtgYDeiKFaqaA7BMlV6D24BMzCFU,208
|
|
17
|
+
sweatstack-0.43.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|