sweatstack 0.44.0__tar.gz → 0.45.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.
- {sweatstack-0.44.0 → sweatstack-0.45.0}/CHANGELOG.md +8 -0
- {sweatstack-0.44.0 → sweatstack-0.45.0}/PKG-INFO +1 -1
- {sweatstack-0.44.0 → sweatstack-0.45.0}/pyproject.toml +1 -1
- {sweatstack-0.44.0 → sweatstack-0.45.0}/src/sweatstack/client.py +27 -0
- {sweatstack-0.44.0 → sweatstack-0.45.0}/src/sweatstack/schemas.py +12 -1
- {sweatstack-0.44.0 → sweatstack-0.45.0}/.gitignore +0 -0
- {sweatstack-0.44.0 → sweatstack-0.45.0}/.python-version +0 -0
- {sweatstack-0.44.0 → sweatstack-0.45.0}/DEVELOPMENT.md +0 -0
- {sweatstack-0.44.0 → sweatstack-0.45.0}/Makefile +0 -0
- {sweatstack-0.44.0 → sweatstack-0.45.0}/README.md +0 -0
- {sweatstack-0.44.0 → sweatstack-0.45.0}/playground/.ipynb_checkpoints/Untitled-checkpoint.ipynb +0 -0
- {sweatstack-0.44.0 → sweatstack-0.45.0}/playground/README.md +0 -0
- {sweatstack-0.44.0 → sweatstack-0.45.0}/playground/Sweat Stack examples/Getting started.ipynb +0 -0
- {sweatstack-0.44.0 → sweatstack-0.45.0}/playground/Untitled.ipynb +0 -0
- {sweatstack-0.44.0 → sweatstack-0.45.0}/playground/hello.py +0 -0
- {sweatstack-0.44.0 → sweatstack-0.45.0}/playground/pyproject.toml +0 -0
- {sweatstack-0.44.0 → sweatstack-0.45.0}/src/sweatstack/Sweat Stack examples/Getting started.ipynb +0 -0
- {sweatstack-0.44.0 → sweatstack-0.45.0}/src/sweatstack/__init__.py +0 -0
- {sweatstack-0.44.0 → sweatstack-0.45.0}/src/sweatstack/cli.py +0 -0
- {sweatstack-0.44.0 → sweatstack-0.45.0}/src/sweatstack/constants.py +0 -0
- {sweatstack-0.44.0 → sweatstack-0.45.0}/src/sweatstack/ipython_init.py +0 -0
- {sweatstack-0.44.0 → sweatstack-0.45.0}/src/sweatstack/jupyterlab_oauth2_startup.py +0 -0
- {sweatstack-0.44.0 → sweatstack-0.45.0}/src/sweatstack/openapi_schemas.py +0 -0
- {sweatstack-0.44.0 → sweatstack-0.45.0}/src/sweatstack/py.typed +0 -0
- {sweatstack-0.44.0 → sweatstack-0.45.0}/src/sweatstack/streamlit.py +0 -0
- {sweatstack-0.44.0 → sweatstack-0.45.0}/src/sweatstack/sweatshell.py +0 -0
- {sweatstack-0.44.0 → sweatstack-0.45.0}/src/sweatstack/utils.py +0 -0
- {sweatstack-0.44.0 → sweatstack-0.45.0}/uv.lock +0 -0
|
@@ -5,6 +5,14 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
|
|
9
|
+
## [0.45.0] - 2025-06-24
|
|
10
|
+
|
|
11
|
+
### Added
|
|
12
|
+
|
|
13
|
+
- Added a new `ss.whoami()` method that returns the authenticated user's summary information. This method is recommended over `ss.get_userinfo()` which only exists for OpenID compatibility and requires the `profile` scope.
|
|
14
|
+
- Added a new `ss.Metric.display_name()` method that returns a human-readable display name for a metric. For example, `ss.Metric.heart_rate.display_name()` returns "heart rate".
|
|
15
|
+
|
|
8
16
|
## [0.44.0] - 2025-06-18
|
|
9
17
|
|
|
10
18
|
### Added
|
|
@@ -1204,6 +1204,32 @@ class Client(OAuth2Mixin, DelegationMixin, TokenStorageMixin):
|
|
|
1204
1204
|
self._raise_for_status(response)
|
|
1205
1205
|
return UserInfoResponse.model_validate(response.json())
|
|
1206
1206
|
|
|
1207
|
+
def whoami(self) -> UserSummary:
|
|
1208
|
+
"""Gets the authenticated user's summary information.
|
|
1209
|
+
|
|
1210
|
+
This method retrieves basic information about the currently authenticated user
|
|
1211
|
+
by extracting the user ID from the JWT token and fetching the user details.
|
|
1212
|
+
|
|
1213
|
+
Returns:
|
|
1214
|
+
UserSummary: A UserSummary object containing the authenticated user's information.
|
|
1215
|
+
|
|
1216
|
+
Raises:
|
|
1217
|
+
ValueError: If no authentication token is available.
|
|
1218
|
+
HTTPStatusError: If the API request fails or user is not found.
|
|
1219
|
+
"""
|
|
1220
|
+
if not self.api_key:
|
|
1221
|
+
raise ValueError("Not authenticated. Please call authenticate() or login() first.")
|
|
1222
|
+
|
|
1223
|
+
try:
|
|
1224
|
+
jwt_body = decode_jwt_body(self.api_key)
|
|
1225
|
+
user_id = jwt_body.get("sub")
|
|
1226
|
+
if not user_id:
|
|
1227
|
+
raise ValueError("Unable to extract user ID from token")
|
|
1228
|
+
except Exception as e:
|
|
1229
|
+
raise ValueError(f"Invalid authentication token: {e}")
|
|
1230
|
+
|
|
1231
|
+
return self._get_user_by_id(user_id)
|
|
1232
|
+
|
|
1207
1233
|
|
|
1208
1234
|
_default_client = Client()
|
|
1209
1235
|
|
|
@@ -1248,6 +1274,7 @@ _generate_singleton_methods(
|
|
|
1248
1274
|
"get_user",
|
|
1249
1275
|
"get_users",
|
|
1250
1276
|
"get_userinfo",
|
|
1277
|
+
"whoami",
|
|
1251
1278
|
|
|
1252
1279
|
"get_activities",
|
|
1253
1280
|
|
|
@@ -101,4 +101,15 @@ def display_name(sport: Sport) -> str:
|
|
|
101
101
|
Sport.root_sport = root_sport
|
|
102
102
|
Sport.parent_sport = parent_sport
|
|
103
103
|
Sport.is_sub_sport_of = is_sub_sport_of
|
|
104
|
-
Sport.display_name = display_name
|
|
104
|
+
Sport.display_name = display_name
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
def metric_display_name(metric: Metric) -> str:
|
|
108
|
+
"""Returns a human-readable display name for a metric.
|
|
109
|
+
|
|
110
|
+
This function converts a Metric enum value into a formatted string suitable for display.
|
|
111
|
+
"""
|
|
112
|
+
return metric.value.replace("_", " ")
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
Metric.display_name = metric_display_name
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{sweatstack-0.44.0 → sweatstack-0.45.0}/playground/.ipynb_checkpoints/Untitled-checkpoint.ipynb
RENAMED
|
File without changes
|
|
File without changes
|
{sweatstack-0.44.0 → sweatstack-0.45.0}/playground/Sweat Stack examples/Getting started.ipynb
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{sweatstack-0.44.0 → sweatstack-0.45.0}/src/sweatstack/Sweat Stack examples/Getting started.ipynb
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|