sweatstack 0.27.0__tar.gz → 0.28.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.
Files changed (27) hide show
  1. {sweatstack-0.27.0 → sweatstack-0.28.0}/PKG-INFO +1 -1
  2. {sweatstack-0.27.0 → sweatstack-0.28.0}/pyproject.toml +1 -1
  3. {sweatstack-0.27.0 → sweatstack-0.28.0}/src/sweatstack/streamlit.py +24 -5
  4. {sweatstack-0.27.0 → sweatstack-0.28.0}/.gitignore +0 -0
  5. {sweatstack-0.27.0 → sweatstack-0.28.0}/.python-version +0 -0
  6. {sweatstack-0.27.0 → sweatstack-0.28.0}/DEVELOPMENT.md +0 -0
  7. {sweatstack-0.27.0 → sweatstack-0.28.0}/Makefile +0 -0
  8. {sweatstack-0.27.0 → sweatstack-0.28.0}/README.md +0 -0
  9. {sweatstack-0.27.0 → sweatstack-0.28.0}/playground/.ipynb_checkpoints/Untitled-checkpoint.ipynb +0 -0
  10. {sweatstack-0.27.0 → sweatstack-0.28.0}/playground/README.md +0 -0
  11. {sweatstack-0.27.0 → sweatstack-0.28.0}/playground/Sweat Stack examples/Getting started.ipynb +0 -0
  12. {sweatstack-0.27.0 → sweatstack-0.28.0}/playground/Untitled.ipynb +0 -0
  13. {sweatstack-0.27.0 → sweatstack-0.28.0}/playground/hello.py +0 -0
  14. {sweatstack-0.27.0 → sweatstack-0.28.0}/playground/pyproject.toml +0 -0
  15. {sweatstack-0.27.0 → sweatstack-0.28.0}/src/sweatstack/Sweat Stack examples/Getting started.ipynb +0 -0
  16. {sweatstack-0.27.0 → sweatstack-0.28.0}/src/sweatstack/__init__.py +0 -0
  17. {sweatstack-0.27.0 → sweatstack-0.28.0}/src/sweatstack/cli.py +0 -0
  18. {sweatstack-0.27.0 → sweatstack-0.28.0}/src/sweatstack/client.py +0 -0
  19. {sweatstack-0.27.0 → sweatstack-0.28.0}/src/sweatstack/constants.py +0 -0
  20. {sweatstack-0.27.0 → sweatstack-0.28.0}/src/sweatstack/ipython_init.py +0 -0
  21. {sweatstack-0.27.0 → sweatstack-0.28.0}/src/sweatstack/jupyterlab_oauth2_startup.py +0 -0
  22. {sweatstack-0.27.0 → sweatstack-0.28.0}/src/sweatstack/openapi_schemas.py +0 -0
  23. {sweatstack-0.27.0 → sweatstack-0.28.0}/src/sweatstack/py.typed +0 -0
  24. {sweatstack-0.27.0 → sweatstack-0.28.0}/src/sweatstack/schemas.py +0 -0
  25. {sweatstack-0.27.0 → sweatstack-0.28.0}/src/sweatstack/sweatshell.py +0 -0
  26. {sweatstack-0.27.0 → sweatstack-0.28.0}/src/sweatstack/utils.py +0 -0
  27. {sweatstack-0.27.0 → sweatstack-0.28.0}/uv.lock +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: sweatstack
3
- Version: 0.27.0
3
+ Version: 0.28.0
4
4
  Summary: The official Python client for SweatStack
5
5
  Author-email: Aart Goossens <aart@gssns.io>
6
6
  Requires-Python: >=3.9
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "sweatstack"
3
- version = "0.27.0"
3
+ version = "0.28.0"
4
4
  description = "The official Python client for SweatStack"
5
5
  readme = "README.md"
6
6
  authors = [
@@ -88,6 +88,11 @@ class StreamlitAuth:
88
88
 
89
89
  return authorization_url
90
90
 
91
+ def _set_api_key(self, api_key):
92
+ self.api_key = api_key
93
+ st.session_state["sweatstack_api_key"] = api_key
94
+ self.client = Client(self.api_key, streamlit_compatible=True)
95
+
91
96
  def _exchange_token(self, code):
92
97
  token_data = {
93
98
  "grant_type": "authorization_code",
@@ -107,10 +112,7 @@ class StreamlitAuth:
107
112
  raise Exception(f"SweatStack Python login failed. Please try again.") from e
108
113
  token_response = response.json()
109
114
 
110
- self.api_key = token_response.get("access_token")
111
- st.session_state["sweatstack_api_key"] = self.api_key
112
-
113
- self.client = Client(self.api_key, streamlit_compatible=True)
115
+ self._set_api_key(token_response.get("access_token"))
114
116
 
115
117
  return
116
118
 
@@ -128,4 +130,21 @@ class StreamlitAuth:
128
130
  st.query_params.clear()
129
131
  st.rerun()
130
132
  else:
131
- self._show_sweatstack_login()
133
+ self._show_sweatstack_login()
134
+
135
+ def switch_user(self):
136
+ self.switch_back()
137
+ other_users = self.client.get_users()
138
+ selected_user = st.selectbox(
139
+ "Select a user",
140
+ other_users,
141
+ format_func=lambda user: user.display_name,
142
+ )
143
+ self.client.switch_user(selected_user)
144
+ self._set_api_key(self.client.api_key)
145
+
146
+ return selected_user
147
+
148
+ def switch_back(self):
149
+ self.client.switch_back()
150
+ self._set_api_key(self.client.api_key)
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes