sweatstack 0.76.2__tar.gz → 0.77.1__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.76.2 → sweatstack-0.77.1}/.claude/settings.local.json +3 -1
- sweatstack-0.77.1/AGENTS.md +247 -0
- {sweatstack-0.76.2 → sweatstack-0.77.1}/CHANGELOG.md +16 -0
- {sweatstack-0.76.2 → sweatstack-0.77.1}/CONTRIBUTING.md +1 -1
- sweatstack-0.77.1/DEVELOPMENT.md +105 -0
- {sweatstack-0.76.2 → sweatstack-0.77.1}/PKG-INFO +3 -3
- {sweatstack-0.76.2 → sweatstack-0.77.1}/README.md +1 -1
- sweatstack-0.77.1/plans/003_trace_test_linking.md +300 -0
- {sweatstack-0.76.2 → sweatstack-0.77.1}/pyproject.toml +3 -2
- {sweatstack-0.76.2 → sweatstack-0.77.1}/src/sweatstack/client.py +43 -5
- {sweatstack-0.76.2 → sweatstack-0.77.1}/src/sweatstack/openapi_schemas.py +7 -0
- {sweatstack-0.76.2 → sweatstack-0.77.1}/src/sweatstack/schemas.py +1 -1
- sweatstack-0.77.1/tests/test_trace_test_linking.py +90 -0
- {sweatstack-0.76.2 → sweatstack-0.77.1}/uv.lock +37 -1
- sweatstack-0.76.2/DEVELOPMENT.md +0 -13
- {sweatstack-0.76.2 → sweatstack-0.77.1}/.claude/skills/sweatstack-python/SKILL.md +0 -0
- {sweatstack-0.76.2 → sweatstack-0.77.1}/.claude/skills/sweatstack-python/client.md +0 -0
- {sweatstack-0.76.2 → sweatstack-0.77.1}/.claude/skills/sweatstack-python/data-models.md +0 -0
- {sweatstack-0.76.2 → sweatstack-0.77.1}/.claude/skills/sweatstack-python/fastapi.md +0 -0
- {sweatstack-0.76.2 → sweatstack-0.77.1}/.claude/skills/sweatstack-python/streamlit.md +0 -0
- {sweatstack-0.76.2 → sweatstack-0.77.1}/.gitignore +0 -0
- {sweatstack-0.76.2 → sweatstack-0.77.1}/.python-version +0 -0
- {sweatstack-0.76.2 → sweatstack-0.77.1}/LICENSE +0 -0
- {sweatstack-0.76.2 → sweatstack-0.77.1}/Makefile +0 -0
- {sweatstack-0.76.2 → sweatstack-0.77.1}/docs/conf.py +0 -0
- {sweatstack-0.76.2 → sweatstack-0.77.1}/docs/everything.rst +0 -0
- {sweatstack-0.76.2 → sweatstack-0.77.1}/docs/index.rst +0 -0
- {sweatstack-0.76.2 → sweatstack-0.77.1}/examples/fastapi_webhooks_example.py +0 -0
- {sweatstack-0.76.2 → sweatstack-0.77.1}/examples/send_webhook.py +0 -0
- {sweatstack-0.76.2 → sweatstack-0.77.1}/plans/001a_tests.md +0 -0
- {sweatstack-0.76.2 → sweatstack-0.77.1}/plans/001b_metadata.md +0 -0
- {sweatstack-0.76.2 → sweatstack-0.77.1}/plans/001c_dailies.md +0 -0
- {sweatstack-0.76.2 → sweatstack-0.77.1}/plans/002_TYPED_EXCEPTIONS.md +0 -0
- {sweatstack-0.76.2 → sweatstack-0.77.1}/src/sweatstack/Sweat Stack examples/Getting started.ipynb +0 -0
- {sweatstack-0.76.2 → sweatstack-0.77.1}/src/sweatstack/__init__.py +0 -0
- {sweatstack-0.76.2 → sweatstack-0.77.1}/src/sweatstack/cli.py +0 -0
- {sweatstack-0.76.2 → sweatstack-0.77.1}/src/sweatstack/constants.py +0 -0
- {sweatstack-0.76.2 → sweatstack-0.77.1}/src/sweatstack/exceptions.py +0 -0
- {sweatstack-0.76.2 → sweatstack-0.77.1}/src/sweatstack/fastapi/__init__.py +0 -0
- {sweatstack-0.76.2 → sweatstack-0.77.1}/src/sweatstack/fastapi/config.py +0 -0
- {sweatstack-0.76.2 → sweatstack-0.77.1}/src/sweatstack/fastapi/dependencies.py +0 -0
- {sweatstack-0.76.2 → sweatstack-0.77.1}/src/sweatstack/fastapi/models.py +0 -0
- {sweatstack-0.76.2 → sweatstack-0.77.1}/src/sweatstack/fastapi/routes.py +0 -0
- {sweatstack-0.76.2 → sweatstack-0.77.1}/src/sweatstack/fastapi/session.py +0 -0
- {sweatstack-0.76.2 → sweatstack-0.77.1}/src/sweatstack/fastapi/token_stores.py +0 -0
- {sweatstack-0.76.2 → sweatstack-0.77.1}/src/sweatstack/fastapi/webhooks.py +0 -0
- {sweatstack-0.76.2 → sweatstack-0.77.1}/src/sweatstack/ipython_init.py +0 -0
- {sweatstack-0.76.2 → sweatstack-0.77.1}/src/sweatstack/jupyterlab_oauth2_startup.py +0 -0
- {sweatstack-0.76.2 → sweatstack-0.77.1}/src/sweatstack/py.typed +0 -0
- {sweatstack-0.76.2 → sweatstack-0.77.1}/src/sweatstack/streamlit.py +0 -0
- {sweatstack-0.76.2 → sweatstack-0.77.1}/src/sweatstack/sweatshell.py +0 -0
- {sweatstack-0.76.2 → sweatstack-0.77.1}/src/sweatstack/utils.py +0 -0
- {sweatstack-0.76.2 → sweatstack-0.77.1}/tests/__init__.py +0 -0
- {sweatstack-0.76.2 → sweatstack-0.77.1}/tests/test_dailies.py +0 -0
- {sweatstack-0.76.2 → sweatstack-0.77.1}/tests/test_dtype_conversion.py +0 -0
- {sweatstack-0.76.2 → sweatstack-0.77.1}/tests/test_exceptions.py +0 -0
- {sweatstack-0.76.2 → sweatstack-0.77.1}/tests/test_metadata.py +0 -0
- {sweatstack-0.76.2 → sweatstack-0.77.1}/tests/test_teams.py +0 -0
- {sweatstack-0.76.2 → sweatstack-0.77.1}/tests/test_tests.py +0 -0
- {sweatstack-0.76.2 → sweatstack-0.77.1}/tests/test_webhooks.py +0 -0
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
# AGENTS.md
|
|
2
|
+
|
|
3
|
+
Working agreement for agents (and humans) changing this codebase. Read end
|
|
4
|
+
to end before your first change. Mechanics — install, test, regen, release —
|
|
5
|
+
live in [DEVELOPMENT.md](DEVELOPMENT.md).
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
## Guiding principle: mirror the REST API
|
|
9
|
+
|
|
10
|
+
This client is a thin Python projection of the SweatStack REST API. When
|
|
11
|
+
you add or change a surface, the default is to mirror the server:
|
|
12
|
+
|
|
13
|
+
| Server | Python |
|
|
14
|
+
| --------------------------------------- | --------------------------------------- |
|
|
15
|
+
| `GET /api/v1/tests/{id}` | `client.get_test(test_id)` |
|
|
16
|
+
| `POST /api/v1/traces/` | `client.create_trace(...)` |
|
|
17
|
+
| `PUT /api/v1/traces/{id}` (full-replace)| `client.update_trace(trace_id, ...)` |
|
|
18
|
+
| `DELETE /api/v1/dailies/{id}` | `client.delete_daily(daily_id)` |
|
|
19
|
+
| query param `?sport=cycling&sport=running` | `sports=[Sport.cycling, Sport.running]` |
|
|
20
|
+
| JSON body field `test_id` | kwarg `test_id` |
|
|
21
|
+
| OpenAPI enum value `"auto"` | `TraceResolution.auto` |
|
|
22
|
+
|
|
23
|
+
Match the server's field names, enum values, full-replace PUT semantics,
|
|
24
|
+
and pagination shape. Don't redesign the API in Python.
|
|
25
|
+
|
|
26
|
+
**Deliberate deviations** (these are the only ones — don't invent more):
|
|
27
|
+
|
|
28
|
+
- Path-param IDs are positional Python args (`get_test(test_id)`), not part
|
|
29
|
+
of a URL string.
|
|
30
|
+
- Enum-typed params accept `Enum | str` so callers don't need to import the
|
|
31
|
+
enum for one-off use.
|
|
32
|
+
- A `traces=` query parameter renames to `trace_resolution=` on the Python
|
|
33
|
+
side when the wire name would be ambiguous as a kwarg. Document the
|
|
34
|
+
mapping in the docstring.
|
|
35
|
+
- `as_dataframe=True` is a client-side convenience over list endpoints.
|
|
36
|
+
- Convenience composites that wrap multiple calls
|
|
37
|
+
(`get_latest_activity_data`, `get_longitudinal_*`) live alongside the
|
|
38
|
+
literal mirrors. Add new ones sparingly; only when a real workflow is
|
|
39
|
+
awkward through the literal surface.
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
## Project shape
|
|
43
|
+
|
|
44
|
+
```
|
|
45
|
+
src/sweatstack/
|
|
46
|
+
├── openapi_schemas.py # AUTO-GENERATED. Never hand-edit.
|
|
47
|
+
├── schemas.py # Re-exports + Enum._missing_ / display_name helpers.
|
|
48
|
+
├── exceptions.py # Public error contract. No httpx types leak.
|
|
49
|
+
├── client.py # Single Client class + module-level singletons.
|
|
50
|
+
├── utils.py # Dataframe / JWT helpers.
|
|
51
|
+
├── streamlit.py # Streamlit integration (optional extra).
|
|
52
|
+
├── fastapi/ # FastAPI integration (optional extra).
|
|
53
|
+
└── cli.py # Entry points.
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
Adding a new Pydantic model from the server takes three steps:
|
|
57
|
+
|
|
58
|
+
1. Regen `openapi_schemas.py` ([DEVELOPMENT.md](DEVELOPMENT.md#regenerating-openapi_schemaspy)).
|
|
59
|
+
2. Re-export it from `schemas.py`.
|
|
60
|
+
3. Import it into `client.py` so `from sweatstack import *` exposes it.
|
|
61
|
+
|
|
62
|
+
Skipping step 3 silently breaks the public surface. Same for new enums.
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
## Hard rules
|
|
66
|
+
|
|
67
|
+
- **`uv`, never `pip`.** Every command goes through `uv run` / `uv add`.
|
|
68
|
+
- **Never hand-edit `openapi_schemas.py`.** Regenerate.
|
|
69
|
+
- **`Raises:` references the typed exceptions** from
|
|
70
|
+
`sweatstack.exceptions`. Don't write `HTTPStatusError` in new docstrings.
|
|
71
|
+
- **Public methods belong in `_generate_singleton_methods(...)`** at the
|
|
72
|
+
bottom of `client.py`. Forgetting is silent.
|
|
73
|
+
- **Enum-typed params accept `Enum | str`** and route through
|
|
74
|
+
`_enums_to_strings`. Don't introduce strict-enum-only parameters.
|
|
75
|
+
- **Tests are offline.** No network calls. Use `Client.__new__(Client)` to
|
|
76
|
+
bypass init when you need an instance for a helper method.
|
|
77
|
+
- **`update_*` methods are full-replace.** Document the silent-clear
|
|
78
|
+
footgun in the docstring (see below).
|
|
79
|
+
- **CHANGELOG entries are user-facing**, not dev-facing.
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
## Method shape
|
|
83
|
+
|
|
84
|
+
Every method on `Client` follows this shape. Match it.
|
|
85
|
+
|
|
86
|
+
```python
|
|
87
|
+
def do_thing(
|
|
88
|
+
self,
|
|
89
|
+
resource_id: str, # path params: positional
|
|
90
|
+
*, # rest: keyword-only
|
|
91
|
+
timestamp: datetime,
|
|
92
|
+
sport: Sport | str | None = None, # enum params: Enum | str
|
|
93
|
+
tags: list[str] | None = None,
|
|
94
|
+
) -> ThingDetails:
|
|
95
|
+
"""One-line summary.
|
|
96
|
+
|
|
97
|
+
Optional paragraph for non-obvious behaviour (full-replace,
|
|
98
|
+
server-side defaults, side effects).
|
|
99
|
+
|
|
100
|
+
Args:
|
|
101
|
+
...
|
|
102
|
+
|
|
103
|
+
Returns:
|
|
104
|
+
ThingDetails: ...
|
|
105
|
+
|
|
106
|
+
Raises:
|
|
107
|
+
SweatStackNotFoundError: If <specific condition>.
|
|
108
|
+
SweatStackAPIError: If the API request fails for any other reason.
|
|
109
|
+
"""
|
|
110
|
+
sport = self._enums_to_strings([sport])[0] if sport else None
|
|
111
|
+
with self._http_client() as client:
|
|
112
|
+
response = client.post(
|
|
113
|
+
url=f"/api/v1/things/{resource_id}",
|
|
114
|
+
json={"timestamp": timestamp.isoformat(), "sport": sport, "tags": tags},
|
|
115
|
+
)
|
|
116
|
+
self._raise_for_status(response)
|
|
117
|
+
return ThingDetails.model_validate(response.json())
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
Invariants baked into the template:
|
|
121
|
+
|
|
122
|
+
- Path-param IDs positional, everything else keyword-only.
|
|
123
|
+
- Datetimes serialize via `.isoformat()`.
|
|
124
|
+
- Body uses every field explicitly (full-replace contract).
|
|
125
|
+
- Request goes through `self._http_client()` context manager.
|
|
126
|
+
- Response goes through `self._raise_for_status()` before parsing.
|
|
127
|
+
- Return is a validated Pydantic model — never the raw dict.
|
|
128
|
+
- `update_*` methods are typed `-> None`. The server's
|
|
129
|
+
`{"message": "..."}` body carries no useful info.
|
|
130
|
+
|
|
131
|
+
**List endpoints** add a `_get_<resource>_generator()` that yields
|
|
132
|
+
validated objects with internal pagination, plus a `get_<resource>s(...,
|
|
133
|
+
as_dataframe=False)` wrapper. Empty-list DataFrames go through
|
|
134
|
+
`_create_empty_dataframe_from_model(Model, normalize_columns=[...])` so
|
|
135
|
+
column names stay stable. See `get_activities` and `get_tests` for
|
|
136
|
+
exemplars.
|
|
137
|
+
|
|
138
|
+
**Query parameters** are only sent when the caller supplied a non-default
|
|
139
|
+
value. For enum-typed query params with an explicit default, compare
|
|
140
|
+
against the default and skip when equal. Always pass `.value` for enums
|
|
141
|
+
into `httpx.params` — `httpx` calls `str()`, which gives
|
|
142
|
+
`"TraceResolution.linked"`, not `"linked"`.
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
## Full-replace `update_*` methods
|
|
146
|
+
|
|
147
|
+
PUT endpoints overwrite every field, including by setting unsent fields
|
|
148
|
+
to `null`. Two rules:
|
|
149
|
+
|
|
150
|
+
1. **Send every field in the body, even when `None`.** Don't omit.
|
|
151
|
+
2. **Document the silent-clear footgun in the docstring** whenever you
|
|
152
|
+
add a new optional field to an existing `update_*` method, *and*
|
|
153
|
+
call it out in the CHANGELOG `### Changed` section. Existing callers
|
|
154
|
+
who don't know about the new field will silently null it on their
|
|
155
|
+
next update.
|
|
156
|
+
|
|
157
|
+
Don't try to soften the contract with "preserve if omitted" sentinels;
|
|
158
|
+
that diverges from how every other field behaves on these methods.
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
## Exceptions
|
|
162
|
+
|
|
163
|
+
The hierarchy in `sweatstack/exceptions.py` is the **public** error
|
|
164
|
+
contract — consumers should never need to import `httpx`.
|
|
165
|
+
|
|
166
|
+
```
|
|
167
|
+
SweatStackError
|
|
168
|
+
├── SweatStackConnectionError # DNS / timeout / no response
|
|
169
|
+
├── SweatStackTokenRefreshError
|
|
170
|
+
└── SweatStackAPIError # got a response with status >= 400
|
|
171
|
+
├── SweatStackAuthError # 401, 403
|
|
172
|
+
├── SweatStackNotFoundError # 404
|
|
173
|
+
├── SweatStackRateLimitError # 429
|
|
174
|
+
├── SweatStackBadRequestError # other 4xx
|
|
175
|
+
└── SweatStackServerError # 5xx
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
Docstrings: list specific subclasses for meaningful conditions (e.g. 404
|
|
179
|
+
when a path ID may not exist), then a catch-all `SweatStackAPIError`.
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
## Tests
|
|
183
|
+
|
|
184
|
+
Live in `tests/`. Offline only. The workhorse pattern is schema
|
|
185
|
+
round-tripping:
|
|
186
|
+
|
|
187
|
+
```python
|
|
188
|
+
restored = TraceDetails.model_validate(original.model_dump())
|
|
189
|
+
assert restored.test_id == "test_123"
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
Catches missing fields, type drift, and enum-casing changes from regen.
|
|
193
|
+
Exemplars: `tests/test_trace_test_linking.py`, `tests/test_tests.py`,
|
|
194
|
+
`tests/test_dtype_conversion.py`.
|
|
195
|
+
|
|
196
|
+
|
|
197
|
+
## CHANGELOG
|
|
198
|
+
|
|
199
|
+
User-facing only. Lead with what changed for the user; skip regen
|
|
200
|
+
output, file renames, refactors. Loud-callout any behaviour change in
|
|
201
|
+
`### Changed`, especially full-replace footguns. SemVer.
|
|
202
|
+
|
|
203
|
+
Good:
|
|
204
|
+
|
|
205
|
+
> ### Changed
|
|
206
|
+
> - `update_trace()` replaces all fields, including `test_id`. Callers
|
|
207
|
+
> that omit `test_id` will clear any existing link.
|
|
208
|
+
|
|
209
|
+
Bad (belongs in the commit message, not the changelog):
|
|
210
|
+
|
|
211
|
+
> ### Changed
|
|
212
|
+
> - Local datetime fields are now `AwareDatetime`. The
|
|
213
|
+
> `BodyExpressAddEmail...` schema is renamed to
|
|
214
|
+
> `BodyConnectAddEmail...`.
|
|
215
|
+
|
|
216
|
+
|
|
217
|
+
## Known rough edges
|
|
218
|
+
|
|
219
|
+
These are conventions we live with but would reconsider in a rewrite.
|
|
220
|
+
Don't paper over them in new code; flag them in review.
|
|
221
|
+
|
|
222
|
+
- **Singleton functions are injected via `globals()`** at module import.
|
|
223
|
+
The "is this method a singleton?" rule is unwritten, which is exactly
|
|
224
|
+
why `update_trace` and `delete_trace` are missing from the list while
|
|
225
|
+
`update_test` and `delete_test` are present. When you touch an
|
|
226
|
+
unregistered public method, register it.
|
|
227
|
+
- **`__init__.py` uses `from .client import *`.** Explicit re-exports
|
|
228
|
+
would be safer; we haven't done the work.
|
|
229
|
+
- **Docstring exception drift.** Most existing docstrings still say
|
|
230
|
+
`HTTPStatusError`. Fix as you touch them, but a one-shot sweep is also
|
|
231
|
+
welcome.
|
|
232
|
+
- **`pyproject.toml` claims `requires-python = ">=3.9"`** while the code
|
|
233
|
+
uses `X | Y` union syntax (3.10+). The real floor is 3.10. Bump the
|
|
234
|
+
pin when convenient.
|
|
235
|
+
- **No CI type-checker or linter.** For a typed library, this is a gap.
|
|
236
|
+
Don't let new code make it worse.
|
|
237
|
+
|
|
238
|
+
|
|
239
|
+
## When in doubt
|
|
240
|
+
|
|
241
|
+
- Match the nearest existing method in `client.py`. Consistency with the
|
|
242
|
+
surroundings beats local cleverness.
|
|
243
|
+
- Reuse the helpers: `_enums_to_strings`, `_get_*_generator`,
|
|
244
|
+
`_normalize_dataframe_column`, `_create_empty_dataframe_from_model`,
|
|
245
|
+
`_set_app_metadata`. Don't reinvent them.
|
|
246
|
+
- Don't add abstractions for hypothetical future flexibility. Three
|
|
247
|
+
similar blocks is the pattern, not a smell.
|
|
@@ -6,6 +6,22 @@ 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
8
|
|
|
9
|
+
## [0.77.1] - 2026-05-19
|
|
10
|
+
|
|
11
|
+
### Fixed
|
|
12
|
+
- Reverted unrelated OpenAPI schema drift.
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
## [0.77.0] - 2026-05-19
|
|
16
|
+
|
|
17
|
+
### Added
|
|
18
|
+
- Link a trace to a test via the new `test_id` argument on `create_trace()` and `update_trace()`. A linked trace appears in the test's traces regardless of its timestamp.
|
|
19
|
+
- `get_test()` accepts `trace_resolution=TraceResolution.linked` to return only traces explicitly linked to the test. Defaults to `TraceResolution.auto` (unchanged behaviour).
|
|
20
|
+
|
|
21
|
+
### Changed
|
|
22
|
+
- `update_trace()` replaces all fields, including `test_id`. Callers that omit `test_id` will clear any existing link — pass it back in to keep the trace linked.
|
|
23
|
+
|
|
24
|
+
|
|
9
25
|
## [0.76.2] - 2026-04-27
|
|
10
26
|
|
|
11
27
|
### Fixed
|
|
@@ -6,4 +6,4 @@ This repository is open-sourced primarily to make it easier for developers and A
|
|
|
6
6
|
|
|
7
7
|
If you've found a bug or have a question about using the library, feel free to [open an issue](https://github.com/SweatStack/sweatstack-python/issues).
|
|
8
8
|
|
|
9
|
-
For general questions about SweatStack, please refer to the [developer documentation](https://
|
|
9
|
+
For general questions about SweatStack, please refer to the [developer documentation](https://docs.sweatstack.no/getting-started/).
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
# Development
|
|
2
|
+
|
|
3
|
+
Mechanics for working on the SweatStack Python client locally. For the
|
|
4
|
+
conventions you must follow when changing code, see [AGENTS.md](AGENTS.md).
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
## Tooling
|
|
8
|
+
|
|
9
|
+
This project uses [`uv`](https://docs.astral.sh/uv/) for everything.
|
|
10
|
+
**Never use `pip` directly.**
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
uv sync # install/update dependencies
|
|
14
|
+
uv run pytest # run tests
|
|
15
|
+
uv run python -c "..." # ad-hoc scripts
|
|
16
|
+
uv run generate-response-models # regenerate OpenAPI schemas (see below)
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Python ≥ 3.9 is supported; develop against the version pinned in
|
|
20
|
+
`.python-version`.
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
## Running locally
|
|
24
|
+
|
|
25
|
+
For interactive exploration (Jupyter):
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
uvx --with-editable "path/to/sweatstack-python[jupyterlab]" jupyter lab
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Run from a scratch directory so JupyterLab does not litter the repo with
|
|
32
|
+
`Untitled` notebooks.
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
## Running tests
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
uv run pytest # full suite
|
|
39
|
+
uv run pytest tests/test_<name>.py # one file
|
|
40
|
+
uv run pytest --ignore=tests/test_webhooks.py # skip optional-dep tests
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
`tests/test_webhooks.py` requires `fastapi`, which is an optional extra. If
|
|
44
|
+
you have not installed it, ignore that file or `uv sync --extra fastapi`.
|
|
45
|
+
|
|
46
|
+
All tests are offline — no test should make a network call. See
|
|
47
|
+
[AGENTS.md → Testing](AGENTS.md#testing) for how to write new ones.
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
## Regenerating `openapi_schemas.py`
|
|
51
|
+
|
|
52
|
+
`src/sweatstack/openapi_schemas.py` is **fully machine-generated** from the
|
|
53
|
+
backend's OpenAPI document by `datamodel-code-generator`. Never hand-edit it.
|
|
54
|
+
|
|
55
|
+
### Procedure
|
|
56
|
+
|
|
57
|
+
1. Start the SweatStack backend so it serves `http://localhost:8080/openapi.json`.
|
|
58
|
+
2. Run:
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
uv run generate-response-models
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
3. Review the diff carefully. The file is regenerated as a whole, so the
|
|
65
|
+
diff will often include **unrelated upstream changes** since the last
|
|
66
|
+
regeneration (field renames, type tightening, new endpoints).
|
|
67
|
+
|
|
68
|
+
4. If the diff contains changes outside the feature you are working on,
|
|
69
|
+
**split them into a separate commit** (`chore: regenerate openapi
|
|
70
|
+
schemas`) that lands before the feature commit. Keep the feature
|
|
71
|
+
commit minimal so reviewers can read it.
|
|
72
|
+
|
|
73
|
+
### Staging only part of the regenerated file
|
|
74
|
+
|
|
75
|
+
When the regen drift is too large to include in a feature commit but you
|
|
76
|
+
do not want to lose it, stage only the relevant hunks:
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
cp src/sweatstack/openapi_schemas.py /tmp/openapi.full.py
|
|
80
|
+
git checkout HEAD -- src/sweatstack/openapi_schemas.py
|
|
81
|
+
# hand-apply only the lines relevant to your feature
|
|
82
|
+
git add src/sweatstack/openapi_schemas.py
|
|
83
|
+
cp /tmp/openapi.full.py src/sweatstack/openapi_schemas.py # restore working tree
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
The working tree now has the full regen (unstaged), and the index has the
|
|
87
|
+
minimal feature delta. Commit, then handle the remainder separately.
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
## Releasing
|
|
91
|
+
|
|
92
|
+
1. Bump `version` in `pyproject.toml` (SemVer).
|
|
93
|
+
2. Add a CHANGELOG entry — see [AGENTS.md → CHANGELOG](AGENTS.md#changelog).
|
|
94
|
+
3. `make build` and `make publish` (twine to PyPI). The `Makefile` has
|
|
95
|
+
the canonical commands.
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
## Docs
|
|
99
|
+
|
|
100
|
+
```bash
|
|
101
|
+
make docs
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
Renders Sphinx to `docs/_build/markdown/`. Most public classes are
|
|
105
|
+
documented automatically via `autoclass` directives in `docs/everything.rst`.
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: sweatstack
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.77.1
|
|
4
4
|
Summary: The official Python client for SweatStack
|
|
5
5
|
Project-URL: Homepage, https://sweatstack.no
|
|
6
|
-
Project-URL: Documentation, https://
|
|
6
|
+
Project-URL: Documentation, https://docs.sweatstack.no/getting-started/
|
|
7
7
|
Project-URL: Repository, https://github.com/SweatStack/sweatstack-python
|
|
8
8
|
Project-URL: Issues, https://github.com/SweatStack/sweatstack-python/issues
|
|
9
9
|
Project-URL: Changelog, https://github.com/SweatStack/sweatstack-python/blob/main/CHANGELOG.md
|
|
@@ -43,4 +43,4 @@ Description-Content-Type: text/markdown
|
|
|
43
43
|
|
|
44
44
|
This is the official Python client library for SweatStack.
|
|
45
45
|
|
|
46
|
-
Documentation can be found [here](https://
|
|
46
|
+
Documentation can be found [here](https://docs.sweatstack.no/getting-started/).
|
|
@@ -0,0 +1,300 @@
|
|
|
1
|
+
# Plan: Trace ↔ Test linking + `TraceResolution`
|
|
2
|
+
|
|
3
|
+
## Summary
|
|
4
|
+
|
|
5
|
+
Mirror upstream `sweatstack@93cd588` ("Adds trace to test optional foreign key
|
|
6
|
+
relationship") in the Python client:
|
|
7
|
+
|
|
8
|
+
- Traces gain an optional `test_id` FK that *explicitly* links them to a test
|
|
9
|
+
(independent of timestamp).
|
|
10
|
+
- `GET /api/v1/tests/{test_id}` gains a `traces` query parameter
|
|
11
|
+
(`TraceResolution` enum: `auto` | `linked`) that controls how the returned
|
|
12
|
+
`traces` list is resolved.
|
|
13
|
+
- `POST /api/v1/traces/` and `PUT /api/v1/traces/{trace_id}` may now return
|
|
14
|
+
`404` when a referenced `test_id` does not exist.
|
|
15
|
+
|
|
16
|
+
Server-side behaviour:
|
|
17
|
+
|
|
18
|
+
- `auto` (default): traces whose timestamp falls in the test's window, **plus**
|
|
19
|
+
traces explicitly linked to this test, **minus** traces explicitly linked to a
|
|
20
|
+
*different* test.
|
|
21
|
+
- `linked`: only traces explicitly linked via `test_id`; the time window is
|
|
22
|
+
ignored.
|
|
23
|
+
|
|
24
|
+
The `activities` list is unaffected — always time-overlap matched.
|
|
25
|
+
|
|
26
|
+
## Code Quality Requirements
|
|
27
|
+
|
|
28
|
+
Same bar as plan 001a:
|
|
29
|
+
|
|
30
|
+
- Follow existing patterns exactly (keyword-only params, enum handling,
|
|
31
|
+
`_enums_to_strings`, error surface via `_raise_for_status`, docstring style).
|
|
32
|
+
- Comprehensive type hints. No `Any`. No string-typed enums on the surface.
|
|
33
|
+
- Concise Google-style docstrings (Args / Returns / Raises).
|
|
34
|
+
- No dead code, no TODOs, no half-finished branches.
|
|
35
|
+
|
|
36
|
+
## Step 1: Regenerate `openapi_schemas.py`
|
|
37
|
+
|
|
38
|
+
The **user will run the SweatStack server locally** at
|
|
39
|
+
`http://localhost:8080`. Wait for confirmation that the server is up
|
|
40
|
+
before running the regen, and do not attempt to start the server.
|
|
41
|
+
|
|
42
|
+
Then:
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
uv run generate-response-models
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
Expected diff in `src/sweatstack/openapi_schemas.py`:
|
|
49
|
+
|
|
50
|
+
- `TraceDetails`: new `test_id: str | None = Field(None, title='Test Id')`.
|
|
51
|
+
- `TraceCreateOrUpdate`: new `test_id: str | None = Field(None, title='Test Id')`.
|
|
52
|
+
- New top-level enum:
|
|
53
|
+
|
|
54
|
+
```python
|
|
55
|
+
class TraceResolution(Enum):
|
|
56
|
+
auto = 'auto'
|
|
57
|
+
linked = 'linked'
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
**Caveat — regen pulls more than this feature.** Two intervening upstream
|
|
61
|
+
commits since `openapi_schemas.py` was last regenerated also touch the
|
|
62
|
+
schema/API surface: `feebe56` ("Adds security.txt …") and `3f29c1f`
|
|
63
|
+
("Better handling of tags=null"). The regenerated diff will not be
|
|
64
|
+
confined to this plan's scope.
|
|
65
|
+
|
|
66
|
+
Action: review the full diff. If unrelated changes appear, **split them
|
|
67
|
+
into a separate commit** ahead of the trace-linking commit so the
|
|
68
|
+
trace-linking commit stays reviewable. Do not merge regen-noise as part
|
|
69
|
+
of this feature.
|
|
70
|
+
|
|
71
|
+
Also verify on the running server before committing: open
|
|
72
|
+
`http://localhost:8080/openapi.json`, search for `TraceResolution`,
|
|
73
|
+
confirm wire values are `"auto"` and `"linked"` (lowercase). This guards
|
|
74
|
+
against an upstream `BaseEnum` casing change.
|
|
75
|
+
|
|
76
|
+
## Step 2: Re-export `TraceResolution`
|
|
77
|
+
|
|
78
|
+
Two-step exposure (mirrors `Sport`):
|
|
79
|
+
|
|
80
|
+
1. `src/sweatstack/schemas.py` — add `TraceResolution` to the import from
|
|
81
|
+
`openapi_schemas`.
|
|
82
|
+
2. `src/sweatstack/client.py` — add `TraceResolution` to the import block
|
|
83
|
+
pulling enums/schemas from `.schemas` (≈ line 45, where `Sport`,
|
|
84
|
+
`TraceDetails`, etc. are imported).
|
|
85
|
+
|
|
86
|
+
`__init__.py` is `from .client import *`, so step 2 is what actually makes
|
|
87
|
+
`from sweatstack import TraceResolution` work. Verify with a smoke test
|
|
88
|
+
in the REPL after the change. (This is the step that's easy to skip and
|
|
89
|
+
breaks the public surface.)
|
|
90
|
+
|
|
91
|
+
## Step 3: Update `src/sweatstack/client.py`
|
|
92
|
+
|
|
93
|
+
Import `TraceResolution` from `schemas` in the existing imports block
|
|
94
|
+
(≈ line 45, alongside `TraceDetails`).
|
|
95
|
+
|
|
96
|
+
### 3a. `create_trace` — add `test_id` keyword arg
|
|
97
|
+
|
|
98
|
+
Location: ≈ line 1708.
|
|
99
|
+
|
|
100
|
+
- Add `test_id: str | None = None` as the **last** keyword-only param
|
|
101
|
+
(preserves existing call-site compatibility — every existing caller uses
|
|
102
|
+
keyword args, but appending keeps the visual ordering stable).
|
|
103
|
+
- Add `"test_id": test_id` to the JSON body. Do not omit when `None`; the
|
|
104
|
+
server accepts `null` and other optional fields are already passed as
|
|
105
|
+
`None` (consistent with `lactate`, `rpe`, etc.).
|
|
106
|
+
- Docstring:
|
|
107
|
+
- Add `test_id: Optional ID of a test to explicitly link this trace to.
|
|
108
|
+
If the test does not exist, the API raises 404.` to Args.
|
|
109
|
+
- Add a `Raises:` note that an `HTTPStatusError(404)` is raised when
|
|
110
|
+
`test_id` references a non-existent test (existing `_raise_for_status`
|
|
111
|
+
already surfaces this; just document it).
|
|
112
|
+
|
|
113
|
+
### 3b. `update_trace` — add `test_id` keyword arg
|
|
114
|
+
|
|
115
|
+
Location: ≈ line 1762.
|
|
116
|
+
|
|
117
|
+
Identical treatment to `create_trace`. Same docstring additions.
|
|
118
|
+
|
|
119
|
+
**Behavioural-change callout (required in both docstring and CHANGELOG):**
|
|
120
|
+
`update_trace` is full-replace. Once `test_id` is in the signature with a
|
|
121
|
+
default of `None`, **existing callers that don't pass `test_id` will silently
|
|
122
|
+
unlink any previously linked test** the next time they call
|
|
123
|
+
`update_trace`. This is consistent with how every other optional field on
|
|
124
|
+
`update_trace` already behaves (e.g. `lactate=None` nulls lactate), but
|
|
125
|
+
it's a real, observable change for upgraders.
|
|
126
|
+
|
|
127
|
+
Docstring wording suggestion:
|
|
128
|
+
|
|
129
|
+
> Note: This is a full-replace operation. If a trace was previously linked
|
|
130
|
+
> to a test via `test_id`, you must pass that `test_id` again to preserve
|
|
131
|
+
> the link — otherwise it is cleared.
|
|
132
|
+
|
|
133
|
+
Do not try to work around this with "preserve if omitted" sentinels — that
|
|
134
|
+
would diverge from how every other field on this method behaves and rot
|
|
135
|
+
the contract.
|
|
136
|
+
|
|
137
|
+
### 3c. `get_test` — add `trace_resolution` keyword arg
|
|
138
|
+
|
|
139
|
+
Location: ≈ line 1934.
|
|
140
|
+
|
|
141
|
+
Current signature:
|
|
142
|
+
|
|
143
|
+
```python
|
|
144
|
+
def get_test(self, test_id: str) -> TestDetails:
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
New signature:
|
|
148
|
+
|
|
149
|
+
```python
|
|
150
|
+
def get_test(
|
|
151
|
+
self,
|
|
152
|
+
test_id: str,
|
|
153
|
+
*,
|
|
154
|
+
trace_resolution: TraceResolution = TraceResolution.auto,
|
|
155
|
+
) -> TestDetails:
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
Naming decision: **`trace_resolution`, not `traces`.** The wire name is
|
|
159
|
+
`traces=` (server query param), but on the Python method
|
|
160
|
+
`client.get_test("t1", traces=TraceResolution.linked)` reads as "give me
|
|
161
|
+
the test and traces=X" — ambiguous. `trace_resolution=` is
|
|
162
|
+
self-documenting. Note the wire mapping in the docstring so future
|
|
163
|
+
maintainers know they don't match.
|
|
164
|
+
|
|
165
|
+
Typing decision: **strict `TraceResolution`, not `TraceResolution | str`.**
|
|
166
|
+
This diverges from the `Sport | str` pattern used elsewhere in the
|
|
167
|
+
client. The deviation is deliberate: the enum has exactly two values, it
|
|
168
|
+
is a brand-new surface (no historical string callers to support), and
|
|
169
|
+
the brief asks for "extremely clean". Document the deviation in a code
|
|
170
|
+
review note when the PR goes up; don't surprise the reviewer.
|
|
171
|
+
|
|
172
|
+
Implementation:
|
|
173
|
+
|
|
174
|
+
```python
|
|
175
|
+
with self._http_client() as client:
|
|
176
|
+
params = {}
|
|
177
|
+
if trace_resolution is not TraceResolution.auto:
|
|
178
|
+
params["traces"] = trace_resolution.value
|
|
179
|
+
response = client.get(
|
|
180
|
+
url=f"/api/v1/tests/{test_id}",
|
|
181
|
+
params=params,
|
|
182
|
+
)
|
|
183
|
+
self._raise_for_status(response)
|
|
184
|
+
return TestDetails.model_validate(response.json())
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
Notes:
|
|
188
|
+
|
|
189
|
+
- Use `.value` (lowercase `"auto"` / `"linked"`) explicitly. `httpx` does
|
|
190
|
+
not unwrap `Enum.value` on its own — it `str()`s the value, which gives
|
|
191
|
+
`"TraceResolution.linked"`. Verified pattern: `_get_tests_generator` and
|
|
192
|
+
every other enum query usage in this file calls `.value`.
|
|
193
|
+
- **Omit the param when at default** — matches the convention used by
|
|
194
|
+
`_get_activities_generator`, `_get_tests_generator`, etc., which only
|
|
195
|
+
add optional query params when the caller supplied a non-default.
|
|
196
|
+
Sending `?traces=auto` would deviate from this pattern.
|
|
197
|
+
- Keep `test_id` positional (existing call sites pass it positionally);
|
|
198
|
+
only `trace_resolution` is keyword-only. Strictly additive.
|
|
199
|
+
- Docstring: explain `auto` vs `linked` in user terms. Copy the
|
|
200
|
+
server-side wording verbatim from `app/routers/api.py` — it is the
|
|
201
|
+
canonical description and survives doc drift.
|
|
202
|
+
|
|
203
|
+
### 3d. No other method changes
|
|
204
|
+
|
|
205
|
+
- `get_traces()` is unchanged. Upstream does not yet expose a `test_id`
|
|
206
|
+
filter on the list endpoint; do not add a client-side filter
|
|
207
|
+
(out of scope, would lie about API support).
|
|
208
|
+
- `_get_traces_generator()` is unchanged. The new `test_id` field rides
|
|
209
|
+
along automatically in `TraceDetails`.
|
|
210
|
+
|
|
211
|
+
## Step 4: Tests
|
|
212
|
+
|
|
213
|
+
Add `tests/test_trace_test_linking.py`. Follow the no-network pattern
|
|
214
|
+
established by the other tests in this repo.
|
|
215
|
+
|
|
216
|
+
Coverage:
|
|
217
|
+
|
|
218
|
+
- **Schema round-trip**: build a `TraceDetails` with `test_id="t_123"`,
|
|
219
|
+
`.model_dump()` → `.model_validate()` round-trip preserves it.
|
|
220
|
+
- **TraceCreateOrUpdate accepts `test_id`**: `TraceCreateOrUpdate(timestamp=...,
|
|
221
|
+
test_id="t_123")` validates; `.model_dump()` includes the field.
|
|
222
|
+
- **`TraceResolution` enum values**: assert `TraceResolution.auto.value ==
|
|
223
|
+
"auto"` and `TraceResolution.linked.value == "linked"` (guards against the
|
|
224
|
+
generator regenerating the enum with different casing on the wire).
|
|
225
|
+
- **Re-export**: `from sweatstack import TraceResolution` resolves, *and*
|
|
226
|
+
`import sweatstack; sweatstack.TraceResolution` resolves (catches the
|
|
227
|
+
client-level import step easy to skip).
|
|
228
|
+
|
|
229
|
+
If the repo already has an httpx-mock based test harness (it currently does
|
|
230
|
+
not, judging by the existing files), add a single integration-style test for
|
|
231
|
+
`get_test(test_id, traces=TraceResolution.linked)` that asserts the request
|
|
232
|
+
URL carries `?traces=linked`. If not, skip — the enum-value test above
|
|
233
|
+
provides the same guarantee without inventing a test infrastructure for this
|
|
234
|
+
plan alone.
|
|
235
|
+
|
|
236
|
+
## Step 5: Examples / docs
|
|
237
|
+
|
|
238
|
+
- Quick scan of `examples/` — if there is an existing "tests" example, append
|
|
239
|
+
a short snippet showing:
|
|
240
|
+
|
|
241
|
+
```python
|
|
242
|
+
test = client.create_test(sport=Sport.cycling, start=...)
|
|
243
|
+
client.create_trace(timestamp=..., lactate=4.0, test_id=test.id)
|
|
244
|
+
detail = client.get_test(test.id, traces=TraceResolution.linked)
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
If none exists, do **not** add a new example file for this alone.
|
|
248
|
+
|
|
249
|
+
- `docs/everything.rst` — `TraceDetails` and `TraceCreateOrUpdate` autoclass
|
|
250
|
+
entries pick up the new field automatically. Add a `.. autoclass::
|
|
251
|
+
sweatstack.openapi_schemas.TraceResolution` entry in the same enums block
|
|
252
|
+
where `Sport` lives (if `Sport` is documented there — check before adding).
|
|
253
|
+
|
|
254
|
+
- `.claude/skills/sweatstack-python/client.md` — update the `create_trace`,
|
|
255
|
+
`update_trace`, and `get_test` signatures, and add `TraceResolution` to
|
|
256
|
+
the list of exported enums.
|
|
257
|
+
|
|
258
|
+
## Step 6: Changelog + version bump
|
|
259
|
+
|
|
260
|
+
- `CHANGELOG.md`: new entry under the next minor version. Must include
|
|
261
|
+
both the additive feature and the behavioural-change callout.
|
|
262
|
+
Wording suggestion:
|
|
263
|
+
|
|
264
|
+
> **Added** — Traces can be explicitly linked to a test via the new
|
|
265
|
+
> `test_id` parameter on `create_trace` and `update_trace`. `get_test`
|
|
266
|
+
> accepts a `trace_resolution` parameter (`TraceResolution.auto` or
|
|
267
|
+
> `TraceResolution.linked`) controlling how the returned traces list is
|
|
268
|
+
> resolved.
|
|
269
|
+
>
|
|
270
|
+
> **Behaviour change** — `update_trace` is full-replace. Callers that
|
|
271
|
+
> previously linked a trace to a test (e.g. via the SweatStack UI or
|
|
272
|
+
> another client) and then call `update_trace` without passing
|
|
273
|
+
> `test_id` will now unlink that trace. Pass the existing `test_id`
|
|
274
|
+
> back in to preserve the link.
|
|
275
|
+
|
|
276
|
+
- `pyproject.toml`: bump `0.76.2 → 0.77.0` (minor — additive feature, no
|
|
277
|
+
breaking change). Confirm the version cadence with the maintainer if
|
|
278
|
+
unsure; this is the only judgement call in the plan.
|
|
279
|
+
|
|
280
|
+
## API Reference
|
|
281
|
+
|
|
282
|
+
| Method | Path | New parameter | Notes |
|
|
283
|
+
|--------|------|---------------|-------|
|
|
284
|
+
| POST | `/api/v1/traces/` | body `test_id?: str` | 404 if test missing |
|
|
285
|
+
| PUT | `/api/v1/traces/{id}` | body `test_id?: str` | full-replace; `null` unlinks; 404 if test missing |
|
|
286
|
+
| GET | `/api/v1/tests/{id}` | query `traces=auto\|linked` | default `auto` |
|
|
287
|
+
|
|
288
|
+
### Resolution semantics (server-side, reference only)
|
|
289
|
+
|
|
290
|
+
- `auto`: `(traces in window AND not claimed by another test) ∪ (traces with test_id == this test)`
|
|
291
|
+
- `linked`: `traces with test_id == this test` (window ignored)
|
|
292
|
+
|
|
293
|
+
## Out of Scope
|
|
294
|
+
|
|
295
|
+
- Listing/filtering traces by `test_id` on `GET /traces/` (upstream does not
|
|
296
|
+
expose this).
|
|
297
|
+
- Bulk attach/detach helpers (`attach_traces_to_test(...)`). Not requested by
|
|
298
|
+
upstream; would be premature abstraction.
|
|
299
|
+
- A `linked_only: bool` convenience on `get_test`. Rejected in favour of the
|
|
300
|
+
enum to keep a single, faithful surface.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "sweatstack"
|
|
3
|
-
version = "0.
|
|
3
|
+
version = "0.77.1"
|
|
4
4
|
description = "The official Python client for SweatStack"
|
|
5
5
|
readme = "README.md"
|
|
6
6
|
license = "MIT"
|
|
@@ -32,7 +32,7 @@ dependencies = [
|
|
|
32
32
|
|
|
33
33
|
[project.urls]
|
|
34
34
|
Homepage = "https://sweatstack.no"
|
|
35
|
-
Documentation = "https://
|
|
35
|
+
Documentation = "https://docs.sweatstack.no/getting-started/"
|
|
36
36
|
Repository = "https://github.com/SweatStack/sweatstack-python"
|
|
37
37
|
Issues = "https://github.com/SweatStack/sweatstack-python/issues"
|
|
38
38
|
Changelog = "https://github.com/SweatStack/sweatstack-python/blob/main/CHANGELOG.md"
|
|
@@ -64,6 +64,7 @@ build-backend = "hatchling.build"
|
|
|
64
64
|
dev = [
|
|
65
65
|
"datamodel-code-generator[ruff]>=0.54.1",
|
|
66
66
|
"myst-parser>=4.0.1",
|
|
67
|
+
"pytest>=9.0.3",
|
|
67
68
|
"sphinx>=8.2.3",
|
|
68
69
|
"sphinx-markdown-builder>=0.6.8",
|
|
69
70
|
"streamlit>=1.42.0",
|
|
@@ -43,7 +43,7 @@ from .schemas import (
|
|
|
43
43
|
BackfillStatus, DailyMeasure, DailyResponse,
|
|
44
44
|
Marker, Metric, Scope, Sport,
|
|
45
45
|
TeamResponse, TestDetails, TestResults, TestSummary, TokenResponse, TraceDetails,
|
|
46
|
-
UserInfoResponse, UserResponse, UserSummary
|
|
46
|
+
TraceResolution, UserInfoResponse, UserResponse, UserSummary
|
|
47
47
|
)
|
|
48
48
|
from .utils import convert_to_standard_dtypes, decode_jwt_body, make_dataframe_streamlit_compatible
|
|
49
49
|
|
|
@@ -1717,6 +1717,7 @@ class Client(_OAuth2Mixin, _DelegationMixin, _TokenStorageMixin, _LocalCacheMixi
|
|
|
1717
1717
|
heart_rate: int | None = None,
|
|
1718
1718
|
tags: list[str] | None = None,
|
|
1719
1719
|
sport: Sport | str | None = None,
|
|
1720
|
+
test_id: str | None = None,
|
|
1720
1721
|
) -> TraceDetails:
|
|
1721
1722
|
"""Creates a new trace with the specified parameters.
|
|
1722
1723
|
|
|
@@ -1733,12 +1734,18 @@ class Client(_OAuth2Mixin, _DelegationMixin, _TokenStorageMixin, _LocalCacheMixi
|
|
|
1733
1734
|
heart_rate: Optional heart rate measurement in beats per minute.
|
|
1734
1735
|
tags: Optional list of tags to associate with this trace.
|
|
1735
1736
|
sport: Optional sport to associate with this trace.
|
|
1737
|
+
test_id: Optional ID of a test to explicitly link this trace to.
|
|
1738
|
+
The link is independent of timestamp — a linked trace appears
|
|
1739
|
+
in the test's traces list regardless of whether its timestamp
|
|
1740
|
+
falls inside the test window.
|
|
1736
1741
|
|
|
1737
1742
|
Returns:
|
|
1738
1743
|
TraceDetails: The created trace object with all details.
|
|
1739
1744
|
|
|
1740
1745
|
Raises:
|
|
1741
|
-
|
|
1746
|
+
SweatStackNotFoundError: If ``test_id`` references a test that
|
|
1747
|
+
does not exist.
|
|
1748
|
+
SweatStackAPIError: If the API request fails for any other reason.
|
|
1742
1749
|
"""
|
|
1743
1750
|
sport = self._enums_to_strings([sport])[0] if sport else None
|
|
1744
1751
|
with self._http_client() as client:
|
|
@@ -1754,6 +1761,7 @@ class Client(_OAuth2Mixin, _DelegationMixin, _TokenStorageMixin, _LocalCacheMixi
|
|
|
1754
1761
|
"heart_rate": heart_rate,
|
|
1755
1762
|
"tags": tags,
|
|
1756
1763
|
"sport": sport,
|
|
1764
|
+
"test_id": test_id,
|
|
1757
1765
|
},
|
|
1758
1766
|
)
|
|
1759
1767
|
self._raise_for_status(response)
|
|
@@ -1772,6 +1780,7 @@ class Client(_OAuth2Mixin, _DelegationMixin, _TokenStorageMixin, _LocalCacheMixi
|
|
|
1772
1780
|
heart_rate: int | None = None,
|
|
1773
1781
|
tags: list[str] | None = None,
|
|
1774
1782
|
sport: Sport | str | None = None,
|
|
1783
|
+
test_id: str | None = None,
|
|
1775
1784
|
) -> None:
|
|
1776
1785
|
"""Updates a trace by replacing all fields.
|
|
1777
1786
|
|
|
@@ -1779,6 +1788,10 @@ class Client(_OAuth2Mixin, _DelegationMixin, _TokenStorageMixin, _LocalCacheMixi
|
|
|
1779
1788
|
server-side. To modify a single field, first fetch the trace with
|
|
1780
1789
|
``get_traces()``, then pass all fields back.
|
|
1781
1790
|
|
|
1791
|
+
In particular: if the trace was previously linked to a test via
|
|
1792
|
+
``test_id`` and you do not pass ``test_id`` here, the link is cleared.
|
|
1793
|
+
Pass the existing ``test_id`` back in to preserve it.
|
|
1794
|
+
|
|
1782
1795
|
Args:
|
|
1783
1796
|
trace_id: The unique identifier of the trace to update.
|
|
1784
1797
|
timestamp: The date and time when the trace was recorded.
|
|
@@ -1790,9 +1803,13 @@ class Client(_OAuth2Mixin, _DelegationMixin, _TokenStorageMixin, _LocalCacheMixi
|
|
|
1790
1803
|
heart_rate: Optional heart rate measurement in beats per minute.
|
|
1791
1804
|
tags: Optional list of tags to associate with this trace.
|
|
1792
1805
|
sport: Optional sport to associate with this trace.
|
|
1806
|
+
test_id: Optional ID of a test to explicitly link this trace to.
|
|
1807
|
+
Pass ``None`` (or omit) to leave the trace unlinked.
|
|
1793
1808
|
|
|
1794
1809
|
Raises:
|
|
1795
|
-
|
|
1810
|
+
SweatStackNotFoundError: If ``trace_id`` does not exist, or if
|
|
1811
|
+
``test_id`` references a test that does not exist.
|
|
1812
|
+
SweatStackAPIError: If the API request fails for any other reason.
|
|
1796
1813
|
"""
|
|
1797
1814
|
sport = self._enums_to_strings([sport])[0] if sport else None
|
|
1798
1815
|
with self._http_client() as client:
|
|
@@ -1808,6 +1825,7 @@ class Client(_OAuth2Mixin, _DelegationMixin, _TokenStorageMixin, _LocalCacheMixi
|
|
|
1808
1825
|
"heart_rate": heart_rate,
|
|
1809
1826
|
"tags": tags,
|
|
1810
1827
|
"sport": sport,
|
|
1828
|
+
"test_id": test_id,
|
|
1811
1829
|
},
|
|
1812
1830
|
)
|
|
1813
1831
|
self._raise_for_status(response)
|
|
@@ -1931,11 +1949,29 @@ class Client(_OAuth2Mixin, _DelegationMixin, _TokenStorageMixin, _LocalCacheMixi
|
|
|
1931
1949
|
else:
|
|
1932
1950
|
return tests
|
|
1933
1951
|
|
|
1934
|
-
def get_test(
|
|
1952
|
+
def get_test(
|
|
1953
|
+
self,
|
|
1954
|
+
test_id: str,
|
|
1955
|
+
*,
|
|
1956
|
+
trace_resolution: TraceResolution | str = TraceResolution.auto,
|
|
1957
|
+
) -> TestDetails:
|
|
1935
1958
|
"""Gets details for a specific test by ID.
|
|
1936
1959
|
|
|
1937
1960
|
Args:
|
|
1938
1961
|
test_id: The unique identifier of the test to retrieve.
|
|
1962
|
+
trace_resolution: How traces are matched to this test. Affects only
|
|
1963
|
+
the ``traces`` list on the response; ``activities`` is always
|
|
1964
|
+
time-overlap matched. Accepts a ``TraceResolution`` enum or
|
|
1965
|
+
its string value (``"auto"`` or ``"linked"``).
|
|
1966
|
+
|
|
1967
|
+
- ``"auto"`` (default): traces whose timestamp falls in the
|
|
1968
|
+
test's time range, plus any traces explicitly linked to
|
|
1969
|
+
this test, minus any traces explicitly linked to a
|
|
1970
|
+
different test.
|
|
1971
|
+
- ``"linked"``: only traces explicitly linked to this test
|
|
1972
|
+
via ``test_id``, regardless of timestamp.
|
|
1973
|
+
|
|
1974
|
+
Maps to the ``traces`` query parameter on the wire.
|
|
1939
1975
|
|
|
1940
1976
|
Returns:
|
|
1941
1977
|
TestDetails: The test details including resolved traces and overlapping activities.
|
|
@@ -1943,8 +1979,10 @@ class Client(_OAuth2Mixin, _DelegationMixin, _TokenStorageMixin, _LocalCacheMixi
|
|
|
1943
1979
|
Raises:
|
|
1944
1980
|
HTTPStatusError: If the API request fails.
|
|
1945
1981
|
"""
|
|
1982
|
+
resolution = self._enums_to_strings([trace_resolution])[0]
|
|
1983
|
+
params = {} if resolution == TraceResolution.auto.value else {"traces": resolution}
|
|
1946
1984
|
with self._http_client() as client:
|
|
1947
|
-
response = client.get(url=f"/api/v1/tests/{test_id}")
|
|
1985
|
+
response = client.get(url=f"/api/v1/tests/{test_id}", params=params)
|
|
1948
1986
|
self._raise_for_status(response)
|
|
1949
1987
|
return TestDetails.model_validate(response.json())
|
|
1950
1988
|
|
|
@@ -1150,6 +1150,7 @@ class TokenResponse(BaseModel):
|
|
|
1150
1150
|
|
|
1151
1151
|
class TraceCreateOrUpdate(BaseModel):
|
|
1152
1152
|
timestamp: AwareDatetime = Field(..., title='Timestamp')
|
|
1153
|
+
test_id: str | None = Field(None, title='Test Id')
|
|
1153
1154
|
lactate: float | None = Field(None, title='Lactate')
|
|
1154
1155
|
rpe: int | None = Field(None, title='Rpe')
|
|
1155
1156
|
notes: str | None = Field(None, title='Notes')
|
|
@@ -1161,6 +1162,11 @@ class TraceCreateOrUpdate(BaseModel):
|
|
|
1161
1162
|
sport: Sport | None = None
|
|
1162
1163
|
|
|
1163
1164
|
|
|
1165
|
+
class TraceResolution(Enum):
|
|
1166
|
+
auto = 'auto'
|
|
1167
|
+
linked = 'linked'
|
|
1168
|
+
|
|
1169
|
+
|
|
1164
1170
|
class UserFlow(Enum):
|
|
1165
1171
|
session = 'session'
|
|
1166
1172
|
signup = 'signup'
|
|
@@ -1603,6 +1609,7 @@ class TestDetails(BaseModel):
|
|
|
1603
1609
|
class TraceDetails(BaseModel):
|
|
1604
1610
|
tags: list[str] | None = Field(None, title='Tags')
|
|
1605
1611
|
id: str = Field(..., title='Id')
|
|
1612
|
+
test_id: str | None = Field(None, title='Test Id')
|
|
1606
1613
|
timestamp: AwareDatetime = Field(..., title='Timestamp')
|
|
1607
1614
|
lactate: float | None = Field(None, title='Lactate')
|
|
1608
1615
|
rpe: int | None = Field(None, title='Rpe')
|
|
@@ -18,7 +18,7 @@ from .openapi_schemas import (
|
|
|
18
18
|
BackfillStatus, DailyMeasure, DailyResponse,
|
|
19
19
|
Marker, Metric, Scope, Sport,
|
|
20
20
|
TeamResponse, TestDetails, TestResults, TestSummary, TokenResponse, TraceDetails,
|
|
21
|
-
UserInfoResponse, UserResponse, UserSummary
|
|
21
|
+
TraceResolution, UserInfoResponse, UserResponse, UserSummary
|
|
22
22
|
)
|
|
23
23
|
|
|
24
24
|
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
"""Tests for the trace <-> test linking surface.
|
|
2
|
+
|
|
3
|
+
Covers:
|
|
4
|
+
|
|
5
|
+
- ``test_id`` round-trips through ``TraceDetails`` and ``TraceCreateOrUpdate``.
|
|
6
|
+
- ``TraceResolution`` enum wire values are exactly ``"auto"`` / ``"linked"``
|
|
7
|
+
(these are what the server's query parameter accepts).
|
|
8
|
+
- ``TraceResolution`` is exposed on the public package surface.
|
|
9
|
+
"""
|
|
10
|
+
|
|
11
|
+
from datetime import datetime, timezone
|
|
12
|
+
|
|
13
|
+
import sweatstack
|
|
14
|
+
from sweatstack import TraceDetails, TraceResolution
|
|
15
|
+
from sweatstack.openapi_schemas import TraceCreateOrUpdate
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
def _trace_details(**overrides) -> TraceDetails:
|
|
19
|
+
base = dict(
|
|
20
|
+
id="trace_001",
|
|
21
|
+
timestamp=datetime(2026, 3, 15, 9, 30, tzinfo=timezone.utc),
|
|
22
|
+
timestamp_local=datetime(2026, 3, 15, 10, 30),
|
|
23
|
+
)
|
|
24
|
+
base.update(overrides)
|
|
25
|
+
return TraceDetails(**base)
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
class TestTestIdField:
|
|
29
|
+
def test_trace_details_round_trip_with_test_id(self):
|
|
30
|
+
original = _trace_details(test_id="test_123", lactate=4.2)
|
|
31
|
+
restored = TraceDetails.model_validate(original.model_dump())
|
|
32
|
+
|
|
33
|
+
assert restored.test_id == "test_123"
|
|
34
|
+
assert restored.lactate == 4.2
|
|
35
|
+
|
|
36
|
+
def test_trace_details_test_id_defaults_to_none(self):
|
|
37
|
+
trace = _trace_details()
|
|
38
|
+
assert trace.test_id is None
|
|
39
|
+
|
|
40
|
+
def test_trace_create_or_update_accepts_test_id(self):
|
|
41
|
+
payload = TraceCreateOrUpdate(
|
|
42
|
+
timestamp=datetime(2026, 3, 15, 9, 30, tzinfo=timezone.utc),
|
|
43
|
+
lactate=4.2,
|
|
44
|
+
test_id="test_123",
|
|
45
|
+
)
|
|
46
|
+
|
|
47
|
+
dumped = payload.model_dump()
|
|
48
|
+
assert dumped["test_id"] == "test_123"
|
|
49
|
+
|
|
50
|
+
def test_trace_create_or_update_test_id_defaults_to_none(self):
|
|
51
|
+
payload = TraceCreateOrUpdate(
|
|
52
|
+
timestamp=datetime(2026, 3, 15, 9, 30, tzinfo=timezone.utc),
|
|
53
|
+
)
|
|
54
|
+
|
|
55
|
+
assert payload.test_id is None
|
|
56
|
+
assert payload.model_dump()["test_id"] is None
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
class TestGetTestTraceResolution:
|
|
60
|
+
"""``get_test`` should accept both the enum and the bare string for
|
|
61
|
+
``trace_resolution`` (mirroring how ``sport``, ``measure`` etc. work
|
|
62
|
+
elsewhere in the client)."""
|
|
63
|
+
|
|
64
|
+
def _build_client(self):
|
|
65
|
+
from sweatstack.client import Client
|
|
66
|
+
|
|
67
|
+
return Client.__new__(Client)
|
|
68
|
+
|
|
69
|
+
def test_enum_input(self):
|
|
70
|
+
client = self._build_client()
|
|
71
|
+
assert client._enums_to_strings([TraceResolution.linked]) == ["linked"]
|
|
72
|
+
|
|
73
|
+
def test_string_input(self):
|
|
74
|
+
client = self._build_client()
|
|
75
|
+
assert client._enums_to_strings(["linked"]) == ["linked"]
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
class TestTraceResolutionEnum:
|
|
79
|
+
def test_wire_values(self):
|
|
80
|
+
"""The wire values must match the server's query parameter exactly."""
|
|
81
|
+
assert TraceResolution.auto.value == "auto"
|
|
82
|
+
assert TraceResolution.linked.value == "linked"
|
|
83
|
+
|
|
84
|
+
def test_membership(self):
|
|
85
|
+
"""Guards against accidental additions/removals on regen."""
|
|
86
|
+
assert {m.value for m in TraceResolution} == {"auto", "linked"}
|
|
87
|
+
|
|
88
|
+
def test_publicly_exported(self):
|
|
89
|
+
"""Importable from the top-level package, like other enums (e.g. Sport)."""
|
|
90
|
+
assert sweatstack.TraceResolution is TraceResolution
|
|
@@ -893,6 +893,15 @@ wheels = [
|
|
|
893
893
|
{ url = "https://files.pythonhosted.org/packages/8a/eb/427ed2b20a38a4ee29f24dbe4ae2dafab198674fe9a85e3d6adf9e5f5f41/inflect-7.5.0-py3-none-any.whl", hash = "sha256:2aea70e5e70c35d8350b8097396ec155ffd68def678c7ff97f51aa69c1d92344", size = 35197, upload-time = "2024-12-28T17:11:15.931Z" },
|
|
894
894
|
]
|
|
895
895
|
|
|
896
|
+
[[package]]
|
|
897
|
+
name = "iniconfig"
|
|
898
|
+
version = "2.3.0"
|
|
899
|
+
source = { registry = "https://pypi.org/simple" }
|
|
900
|
+
sdist = { url = "https://files.pythonhosted.org/packages/72/34/14ca021ce8e5dfedc35312d08ba8bf51fdd999c576889fc2c24cb97f4f10/iniconfig-2.3.0.tar.gz", hash = "sha256:c76315c77db068650d49c5b56314774a7804df16fee4402c1f19d6d15d8c4730", size = 20503, upload-time = "2025-10-18T21:55:43.219Z" }
|
|
901
|
+
wheels = [
|
|
902
|
+
{ url = "https://files.pythonhosted.org/packages/cb/b1/3846dd7f199d53cb17f49cba7e651e9ce294d8497c8c150530ed11865bb8/iniconfig-2.3.0-py3-none-any.whl", hash = "sha256:f631c04d2c48c52b84d0d0549c99ff3859c98df65b3101406327ecc7d53fbf12", size = 7484, upload-time = "2025-10-18T21:55:41.639Z" },
|
|
903
|
+
]
|
|
904
|
+
|
|
896
905
|
[[package]]
|
|
897
906
|
name = "ipykernel"
|
|
898
907
|
version = "6.29.5"
|
|
@@ -1680,6 +1689,15 @@ dependencies = [
|
|
|
1680
1689
|
[package.metadata]
|
|
1681
1690
|
requires-dist = [{ name = "sweatstack", extras = ["streamlit"], editable = "." }]
|
|
1682
1691
|
|
|
1692
|
+
[[package]]
|
|
1693
|
+
name = "pluggy"
|
|
1694
|
+
version = "1.6.0"
|
|
1695
|
+
source = { registry = "https://pypi.org/simple" }
|
|
1696
|
+
sdist = { url = "https://files.pythonhosted.org/packages/f9/e2/3e91f31a7d2b083fe6ef3fa267035b518369d9511ffab804f839851d2779/pluggy-1.6.0.tar.gz", hash = "sha256:7dcc130b76258d33b90f61b658791dede3486c3e6bfb003ee5c9bfb396dd22f3", size = 69412, upload-time = "2025-05-15T12:30:07.975Z" }
|
|
1697
|
+
wheels = [
|
|
1698
|
+
{ url = "https://files.pythonhosted.org/packages/54/20/4d324d65cc6d9205fabedc306948156824eb9f0ee1633355a8f7ec5c66bf/pluggy-1.6.0-py3-none-any.whl", hash = "sha256:e920276dd6813095e9377c0bc5566d94c932c33b27a3e3945d8389c374dd4746", size = 20538, upload-time = "2025-05-15T12:30:06.134Z" },
|
|
1699
|
+
]
|
|
1700
|
+
|
|
1683
1701
|
[[package]]
|
|
1684
1702
|
name = "prometheus-client"
|
|
1685
1703
|
version = "0.21.1"
|
|
@@ -1901,6 +1919,22 @@ wheels = [
|
|
|
1901
1919
|
{ url = "https://files.pythonhosted.org/packages/1c/a7/c8a2d361bf89c0d9577c934ebb7421b25dc84bf3a8e3ac0a40aed9acc547/pyparsing-3.2.1-py3-none-any.whl", hash = "sha256:506ff4f4386c4cec0590ec19e6302d3aedb992fdc02c761e90416f158dacf8e1", size = 107716, upload-time = "2024-12-31T20:59:42.738Z" },
|
|
1902
1920
|
]
|
|
1903
1921
|
|
|
1922
|
+
[[package]]
|
|
1923
|
+
name = "pytest"
|
|
1924
|
+
version = "9.0.3"
|
|
1925
|
+
source = { registry = "https://pypi.org/simple" }
|
|
1926
|
+
dependencies = [
|
|
1927
|
+
{ name = "colorama", marker = "sys_platform == 'win32'" },
|
|
1928
|
+
{ name = "iniconfig" },
|
|
1929
|
+
{ name = "packaging" },
|
|
1930
|
+
{ name = "pluggy" },
|
|
1931
|
+
{ name = "pygments" },
|
|
1932
|
+
]
|
|
1933
|
+
sdist = { url = "https://files.pythonhosted.org/packages/7d/0d/549bd94f1a0a402dc8cf64563a117c0f3765662e2e668477624baeec44d5/pytest-9.0.3.tar.gz", hash = "sha256:b86ada508af81d19edeb213c681b1d48246c1a91d304c6c81a427674c17eb91c", size = 1572165, upload-time = "2026-04-07T17:16:18.027Z" }
|
|
1934
|
+
wheels = [
|
|
1935
|
+
{ url = "https://files.pythonhosted.org/packages/d4/24/a372aaf5c9b7208e7112038812994107bc65a84cd00e0354a88c2c77a617/pytest-9.0.3-py3-none-any.whl", hash = "sha256:2c5efc453d45394fdd706ade797c0a81091eccd1d6e4bccfcd476e2b8e0ab5d9", size = 375249, upload-time = "2026-04-07T17:16:16.13Z" },
|
|
1936
|
+
]
|
|
1937
|
+
|
|
1904
1938
|
[[package]]
|
|
1905
1939
|
name = "python-dateutil"
|
|
1906
1940
|
version = "2.9.0.post0"
|
|
@@ -2537,7 +2571,7 @@ wheels = [
|
|
|
2537
2571
|
|
|
2538
2572
|
[[package]]
|
|
2539
2573
|
name = "sweatstack"
|
|
2540
|
-
version = "0.
|
|
2574
|
+
version = "0.77.1"
|
|
2541
2575
|
source = { editable = "." }
|
|
2542
2576
|
dependencies = [
|
|
2543
2577
|
{ name = "email-validator" },
|
|
@@ -2566,6 +2600,7 @@ streamlit = [
|
|
|
2566
2600
|
dev = [
|
|
2567
2601
|
{ name = "datamodel-code-generator", extra = ["ruff"] },
|
|
2568
2602
|
{ name = "myst-parser" },
|
|
2603
|
+
{ name = "pytest" },
|
|
2569
2604
|
{ name = "sphinx" },
|
|
2570
2605
|
{ name = "sphinx-markdown-builder" },
|
|
2571
2606
|
{ name = "streamlit" },
|
|
@@ -2592,6 +2627,7 @@ provides-extras = ["streamlit", "jupyter", "fastapi"]
|
|
|
2592
2627
|
dev = [
|
|
2593
2628
|
{ name = "datamodel-code-generator", extras = ["ruff"], specifier = ">=0.54.1" },
|
|
2594
2629
|
{ name = "myst-parser", specifier = ">=4.0.1" },
|
|
2630
|
+
{ name = "pytest", specifier = ">=9.0.3" },
|
|
2595
2631
|
{ name = "sphinx", specifier = ">=8.2.3" },
|
|
2596
2632
|
{ name = "sphinx-markdown-builder", specifier = ">=0.6.8" },
|
|
2597
2633
|
{ name = "streamlit", specifier = ">=1.42.0" },
|
sweatstack-0.76.2/DEVELOPMENT.md
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
# Development
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
## Running locally
|
|
6
|
-
|
|
7
|
-
Point your terminal to some other directory (to not clutter this one with `Untitled` files) and then run:
|
|
8
|
-
|
|
9
|
-
```bash
|
|
10
|
-
uvx --with-editable "path/to/sweatstack-python[jupyterlab]" jupyter lab
|
|
11
|
-
```
|
|
12
|
-
|
|
13
|
-
This will start a JupyterLab instance.
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{sweatstack-0.76.2 → sweatstack-0.77.1}/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
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|