repwise 2.1.1__tar.gz → 2.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.
- {repwise-2.1.1/src/repwise.egg-info → repwise-2.2.0}/PKG-INFO +3 -2
- {repwise-2.1.1 → repwise-2.2.0}/README.md +2 -1
- {repwise-2.1.1 → repwise-2.2.0}/pyproject.toml +3 -3
- {repwise-2.1.1 → repwise-2.2.0}/src/repwise/__init__.py +1 -1
- {repwise-2.1.1 → repwise-2.2.0}/src/repwise/app/update.py +4 -2
- {repwise-2.1.1 → repwise-2.2.0}/src/repwise/config.py +35 -6
- {repwise-2.1.1 → repwise-2.2.0}/src/repwise/domain/models.py +7 -0
- {repwise-2.1.1 → repwise-2.2.0}/src/repwise/domain/progression.py +29 -3
- {repwise-2.1.1 → repwise-2.2.0}/src/repwise/planner.py +107 -25
- {repwise-2.1.1 → repwise-2.2.0/src/repwise.egg-info}/PKG-INFO +3 -2
- {repwise-2.1.1 → repwise-2.2.0}/tests/test_config.py +30 -0
- {repwise-2.1.1 → repwise-2.2.0}/tests/test_planner.py +85 -0
- {repwise-2.1.1 → repwise-2.2.0}/tests/test_progression.py +55 -0
- {repwise-2.1.1 → repwise-2.2.0}/LICENSE +0 -0
- {repwise-2.1.1 → repwise-2.2.0}/setup.cfg +0 -0
- {repwise-2.1.1 → repwise-2.2.0}/src/repwise/__main__.py +0 -0
- {repwise-2.1.1 → repwise-2.2.0}/src/repwise/app/__init__.py +0 -0
- {repwise-2.1.1 → repwise-2.2.0}/src/repwise/app/checking.py +0 -0
- {repwise-2.1.1 → repwise-2.2.0}/src/repwise/app/fetch.py +0 -0
- {repwise-2.1.1 → repwise-2.2.0}/src/repwise/app/importing.py +0 -0
- {repwise-2.1.1 → repwise-2.2.0}/src/repwise/app/listing.py +0 -0
- {repwise-2.1.1 → repwise-2.2.0}/src/repwise/app/logout.py +0 -0
- {repwise-2.1.1 → repwise-2.2.0}/src/repwise/app/report.py +0 -0
- {repwise-2.1.1 → repwise-2.2.0}/src/repwise/checker.py +0 -0
- {repwise-2.1.1 → repwise-2.2.0}/src/repwise/cli/__init__.py +0 -0
- {repwise-2.1.1 → repwise-2.2.0}/src/repwise/cli/completion.py +0 -0
- {repwise-2.1.1 → repwise-2.2.0}/src/repwise/cli/parser.py +0 -0
- {repwise-2.1.1 → repwise-2.2.0}/src/repwise/domain/__init__.py +0 -0
- {repwise-2.1.1 → repwise-2.2.0}/src/repwise/domain/effort.py +0 -0
- {repwise-2.1.1 → repwise-2.2.0}/src/repwise/domain/matching.py +0 -0
- {repwise-2.1.1 → repwise-2.2.0}/src/repwise/dumps.py +0 -0
- {repwise-2.1.1 → repwise-2.2.0}/src/repwise/errors.py +0 -0
- {repwise-2.1.1 → repwise-2.2.0}/src/repwise/garmin/__init__.py +0 -0
- {repwise-2.1.1 → repwise-2.2.0}/src/repwise/garmin/catalog.py +0 -0
- {repwise-2.1.1 → repwise-2.2.0}/src/repwise/garmin/client.py +0 -0
- {repwise-2.1.1 → repwise-2.2.0}/src/repwise/garmin/payloads.py +0 -0
- {repwise-2.1.1 → repwise-2.2.0}/src/repwise/importer.py +0 -0
- {repwise-2.1.1 → repwise-2.2.0}/src/repwise/log.py +0 -0
- {repwise-2.1.1 → repwise-2.2.0}/src/repwise/yamlio.py +0 -0
- {repwise-2.1.1 → repwise-2.2.0}/src/repwise.egg-info/SOURCES.txt +0 -0
- {repwise-2.1.1 → repwise-2.2.0}/src/repwise.egg-info/dependency_links.txt +0 -0
- {repwise-2.1.1 → repwise-2.2.0}/src/repwise.egg-info/entry_points.txt +0 -0
- {repwise-2.1.1 → repwise-2.2.0}/src/repwise.egg-info/requires.txt +0 -0
- {repwise-2.1.1 → repwise-2.2.0}/src/repwise.egg-info/top_level.txt +0 -0
- {repwise-2.1.1 → repwise-2.2.0}/tests/test_catalog.py +0 -0
- {repwise-2.1.1 → repwise-2.2.0}/tests/test_checker.py +0 -0
- {repwise-2.1.1 → repwise-2.2.0}/tests/test_checking.py +0 -0
- {repwise-2.1.1 → repwise-2.2.0}/tests/test_cli.py +0 -0
- {repwise-2.1.1 → repwise-2.2.0}/tests/test_client.py +0 -0
- {repwise-2.1.1 → repwise-2.2.0}/tests/test_completion.py +0 -0
- {repwise-2.1.1 → repwise-2.2.0}/tests/test_dumps.py +0 -0
- {repwise-2.1.1 → repwise-2.2.0}/tests/test_effort.py +0 -0
- {repwise-2.1.1 → repwise-2.2.0}/tests/test_fetch.py +0 -0
- {repwise-2.1.1 → repwise-2.2.0}/tests/test_importer.py +0 -0
- {repwise-2.1.1 → repwise-2.2.0}/tests/test_log.py +0 -0
- {repwise-2.1.1 → repwise-2.2.0}/tests/test_logout.py +0 -0
- {repwise-2.1.1 → repwise-2.2.0}/tests/test_main.py +0 -0
- {repwise-2.1.1 → repwise-2.2.0}/tests/test_matching.py +0 -0
- {repwise-2.1.1 → repwise-2.2.0}/tests/test_models.py +0 -0
- {repwise-2.1.1 → repwise-2.2.0}/tests/test_payloads.py +0 -0
- {repwise-2.1.1 → repwise-2.2.0}/tests/test_report.py +0 -0
- {repwise-2.1.1 → repwise-2.2.0}/tests/test_update.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: repwise
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.2.0
|
|
4
4
|
Summary: Advance Garmin strength workout targets using double progression
|
|
5
5
|
Author-email: Adam Żmuda <adam@zmuda.pro>
|
|
6
6
|
License-Expression: MIT
|
|
@@ -92,7 +92,8 @@ Three things it handles that a spreadsheet would not:
|
|
|
92
92
|
pull the target somewhere you cannot repeat.
|
|
93
93
|
- **It eases you back after a stall.** Miss a target twice and the session that
|
|
94
94
|
finally beats it earns a rep on two of your four sets rather than on all of
|
|
95
|
-
them, so you are not asked again for the jump that just failed.
|
|
95
|
+
them, so you are not asked again for the jump that just failed. Set
|
|
96
|
+
`partial_progression: false` if you would rather every set moved together.
|
|
96
97
|
- **It follows the weight you actually used.** Bump the load mid-session and the
|
|
97
98
|
new load is banked, not discarded.
|
|
98
99
|
- **It won't keep a load you didn't earn.** Take the 4 kg dumbbells because the
|
|
@@ -65,7 +65,8 @@ Three things it handles that a spreadsheet would not:
|
|
|
65
65
|
pull the target somewhere you cannot repeat.
|
|
66
66
|
- **It eases you back after a stall.** Miss a target twice and the session that
|
|
67
67
|
finally beats it earns a rep on two of your four sets rather than on all of
|
|
68
|
-
them, so you are not asked again for the jump that just failed.
|
|
68
|
+
them, so you are not asked again for the jump that just failed. Set
|
|
69
|
+
`partial_progression: false` if you would rather every set moved together.
|
|
69
70
|
- **It follows the weight you actually used.** Bump the load mid-session and the
|
|
70
71
|
new load is banked, not discarded.
|
|
71
72
|
- **It won't keep a load you didn't earn.** Take the 4 kg dumbbells because the
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "repwise"
|
|
7
|
-
version = "2.
|
|
7
|
+
version = "2.2.0"
|
|
8
8
|
description = "Advance Garmin strength workout targets using double progression"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
license = "MIT"
|
|
@@ -63,14 +63,14 @@ Issues = "https://github.com/theadzik/repwise/issues"
|
|
|
63
63
|
# workflow cannot disagree about the answer.
|
|
64
64
|
[dependency-groups]
|
|
65
65
|
release = [
|
|
66
|
-
"commitizen==4.
|
|
66
|
+
"commitizen==4.18.0",
|
|
67
67
|
]
|
|
68
68
|
dev = [
|
|
69
69
|
{ include-group = "release" },
|
|
70
70
|
"mypy==2.3.1",
|
|
71
71
|
"pre-commit==4.6.2",
|
|
72
72
|
"pytest==9.1.1",
|
|
73
|
-
"ruff==0.16.
|
|
73
|
+
"ruff==0.16.4",
|
|
74
74
|
"types-PyYAML==6.0.12.20260815",
|
|
75
75
|
]
|
|
76
76
|
|
|
@@ -362,8 +362,10 @@ def shape_untrained(
|
|
|
362
362
|
"""Bring every workout with no session behind it in line with the config.
|
|
363
363
|
|
|
364
364
|
Only the shape: which exercises, in what order, how many sets, resting how
|
|
365
|
-
long, described how. Nothing here was earned in a session, so
|
|
366
|
-
|
|
365
|
+
long, described how. Nothing here was earned in a session, so the one target
|
|
366
|
+
that can move is the one the config settles on its own - an uneven target
|
|
367
|
+
evened out because partial progression has been turned off - and nothing is
|
|
368
|
+
warned about not having been performed.
|
|
367
369
|
"""
|
|
368
370
|
plans: list[Plan] = []
|
|
369
371
|
for workout in config:
|
|
@@ -106,6 +106,9 @@ def default_dump_dir() -> str:
|
|
|
106
106
|
def _flag(declared: Any, key: str, default: bool) -> bool:
|
|
107
107
|
"""A yes-or-no setting, read as one rather than coerced into one.
|
|
108
108
|
|
|
109
|
+
`key` is the whole dotted path, since these live at more than one level of
|
|
110
|
+
the file and a message naming the wrong one is worse than no message.
|
|
111
|
+
|
|
109
112
|
YAML has booleans, so a setting that wants one should insist: `bool()`
|
|
110
113
|
would read the string `"false"` as true and turn a feature on for someone
|
|
111
114
|
who wrote it in quotes, which is the kind of mistake a config file should
|
|
@@ -119,7 +122,7 @@ def _flag(declared: Any, key: str, default: bool) -> bool:
|
|
|
119
122
|
return default
|
|
120
123
|
if not isinstance(declared, bool):
|
|
121
124
|
raise ConfigError(
|
|
122
|
-
f"settings.
|
|
125
|
+
f"settings.{key} should be true or false, not "
|
|
123
126
|
f"{declared!r}. Unquoted, so that YAML reads it as a boolean."
|
|
124
127
|
)
|
|
125
128
|
return declared
|
|
@@ -363,7 +366,12 @@ def _bodyweight_factor(raw: dict, where: str, problems: Problems) -> float:
|
|
|
363
366
|
|
|
364
367
|
|
|
365
368
|
def _build_exercise(
|
|
366
|
-
raw: dict,
|
|
369
|
+
raw: dict,
|
|
370
|
+
loads: LoadRules,
|
|
371
|
+
where: str,
|
|
372
|
+
problems: Problems,
|
|
373
|
+
*,
|
|
374
|
+
partial_progression: bool = True,
|
|
367
375
|
) -> ExerciseSpec | None:
|
|
368
376
|
missing = [key for key in _REQUIRED if raw.get(key) is None]
|
|
369
377
|
if missing:
|
|
@@ -438,11 +446,17 @@ def _build_exercise(
|
|
|
438
446
|
min_weight=min_weight,
|
|
439
447
|
max_weight=max_weight,
|
|
440
448
|
bodyweight_factor=bodyweight_factor,
|
|
449
|
+
partial_progression=partial_progression,
|
|
441
450
|
)
|
|
442
451
|
|
|
443
452
|
|
|
444
453
|
def _build_workout(
|
|
445
|
-
entry: dict,
|
|
454
|
+
entry: dict,
|
|
455
|
+
loads: LoadRules,
|
|
456
|
+
path: str,
|
|
457
|
+
problems: Problems,
|
|
458
|
+
*,
|
|
459
|
+
partial_progression: bool = True,
|
|
446
460
|
) -> Workout | None:
|
|
447
461
|
key = entry.get("key")
|
|
448
462
|
if not key:
|
|
@@ -455,7 +469,13 @@ def _build_workout(
|
|
|
455
469
|
|
|
456
470
|
exercises = []
|
|
457
471
|
for raw in entry.get("exercises") or []:
|
|
458
|
-
spec = _build_exercise(
|
|
472
|
+
spec = _build_exercise(
|
|
473
|
+
raw,
|
|
474
|
+
loads,
|
|
475
|
+
f"{path}:{key}",
|
|
476
|
+
problems,
|
|
477
|
+
partial_progression=partial_progression,
|
|
478
|
+
)
|
|
459
479
|
if spec is not None:
|
|
460
480
|
exercises.append(spec)
|
|
461
481
|
|
|
@@ -550,12 +570,19 @@ def load_config(path: str | None = None) -> Config:
|
|
|
550
570
|
),
|
|
551
571
|
activity_caching=_flag(
|
|
552
572
|
garmin_raw.get("activity_caching"),
|
|
553
|
-
"activity_caching",
|
|
573
|
+
"garmin.activity_caching",
|
|
554
574
|
defaults.activity_caching,
|
|
555
575
|
),
|
|
556
576
|
)
|
|
557
577
|
_warn_if_wandering(garmin)
|
|
558
578
|
|
|
579
|
+
# Whether a hit after a stall may move only some of the sets. Resolved onto
|
|
580
|
+
# every exercise, the way a load type's weight step is: the rules read it
|
|
581
|
+
# off the spec in hand rather than being handed the settings.
|
|
582
|
+
partial_progression = _flag(
|
|
583
|
+
settings.get("partial_progression"), "partial_progression", True
|
|
584
|
+
)
|
|
585
|
+
|
|
559
586
|
# Unset means "ask Garmin", which is the better answer for anyone who
|
|
560
587
|
# weighs in: it stays current on its own. Stating it here is for accounts
|
|
561
588
|
# with no weigh-ins, and for tests that should not need a network.
|
|
@@ -565,7 +592,9 @@ def load_config(path: str | None = None) -> Config:
|
|
|
565
592
|
problems = Problems()
|
|
566
593
|
workouts: dict[str, Workout] = {}
|
|
567
594
|
for entry in data["workouts"]:
|
|
568
|
-
workout = _build_workout(
|
|
595
|
+
workout = _build_workout(
|
|
596
|
+
entry, loads, path, problems, partial_progression=partial_progression
|
|
597
|
+
)
|
|
569
598
|
if workout is None:
|
|
570
599
|
continue
|
|
571
600
|
if workout.key in workouts:
|
|
@@ -50,6 +50,13 @@ class ExerciseSpec:
|
|
|
50
50
|
#: carries none of you - so the default is to count only the stored weight.
|
|
51
51
|
#: Read by `check` alone; see `domain/effort.py`.
|
|
52
52
|
bodyweight_factor: float = 0.0
|
|
53
|
+
#: Whether a hit after a stall may move only some of the sets. On - the
|
|
54
|
+
#: default - a target can ramp, `8+2` being eight reps with two of the sets
|
|
55
|
+
#: asked for nine. Off, every set moves together however long the stall,
|
|
56
|
+
#: and a deload steps the whole target down rather than one set of it.
|
|
57
|
+
#: Declared once as settings.partial_progression and resolved onto every
|
|
58
|
+
#: exercise, the way a load type's weight step is.
|
|
59
|
+
partial_progression: bool = True
|
|
53
60
|
|
|
54
61
|
@property
|
|
55
62
|
def bodyweight(self) -> bool:
|
|
@@ -187,7 +187,18 @@ def _ladder(spec: ExerciseSpec, target: Target) -> int:
|
|
|
187
187
|
|
|
188
188
|
|
|
189
189
|
def _one_rung_down(spec: ExerciseSpec, target: Target) -> Target:
|
|
190
|
-
"""The target one set easier: the exact inverse of a single advance.
|
|
190
|
+
"""The target one set easier: the exact inverse of a single advance.
|
|
191
|
+
|
|
192
|
+
Without partial progression an advance is the whole target, so the inverse
|
|
193
|
+
is too: the base comes down a step and every set comes with it. A ramp left
|
|
194
|
+
over from before the setting changed loses its lead here along with the
|
|
195
|
+
step, which is the one place this drops by more than a single rung. What
|
|
196
|
+
bounds it is `_deload`, which never eases *above* what the session managed
|
|
197
|
+
and never below `rep_low` - not that it stops at where the session landed,
|
|
198
|
+
since a near miss is exactly the case that eases past it.
|
|
199
|
+
"""
|
|
200
|
+
if not spec.partial_progression:
|
|
201
|
+
return Target(target.reps - spec.rep_step, target.weight)
|
|
191
202
|
if target.lead:
|
|
192
203
|
return Target(target.reps, target.weight, target.lead - 1)
|
|
193
204
|
return Target(target.reps - spec.rep_step, target.weight, spec.sets - 1)
|
|
@@ -202,6 +213,10 @@ def _achieved(spec: ExerciseSpec, weight: float, reps: list[int]) -> Target:
|
|
|
202
213
|
and asking for less than was managed is the safe direction to round.
|
|
203
214
|
"""
|
|
204
215
|
floor = min(reps)
|
|
216
|
+
if not spec.partial_progression:
|
|
217
|
+
# No rung between two flat targets to land on, so what the session
|
|
218
|
+
# managed is what every set managed.
|
|
219
|
+
return Target(floor, weight)
|
|
205
220
|
higher = floor + spec.rep_step
|
|
206
221
|
beat = sum(1 for done in reps if done >= higher)
|
|
207
222
|
return Target(floor, weight, min(beat, spec.sets - 1))
|
|
@@ -265,7 +280,16 @@ def _deload(
|
|
|
265
280
|
if eased == bottom:
|
|
266
281
|
return eased, "missed twice, ease to the bottom of the range"
|
|
267
282
|
if eased == down:
|
|
268
|
-
|
|
283
|
+
# With partial progression off there is no set to name: every set moved
|
|
284
|
+
# together on the way up, and the whole target comes down together too.
|
|
285
|
+
unit = "second" if spec.time_based else "rep"
|
|
286
|
+
plural = "" if spec.rep_step == 1 else "s"
|
|
287
|
+
by = (
|
|
288
|
+
"ease by one set"
|
|
289
|
+
if spec.partial_progression
|
|
290
|
+
else f"take {spec.rep_step} {unit}{plural} off"
|
|
291
|
+
)
|
|
292
|
+
return eased, f"missed twice, {by}"
|
|
269
293
|
return eased, "missed twice, ease to where the session landed"
|
|
270
294
|
|
|
271
295
|
|
|
@@ -345,7 +369,9 @@ def _advance(
|
|
|
345
369
|
# whole target moving as it always has, and every miss in the streak behind
|
|
346
370
|
# it costs one of them. A hit always earns at least one, however long the
|
|
347
371
|
# streak, or a stall could never end.
|
|
348
|
-
|
|
372
|
+
# Unless partial progression is off, in which case the streak buys nothing:
|
|
373
|
+
# every set moves together, so a hit is always the whole target moving.
|
|
374
|
+
units = spec.sets if not spec.partial_progression else max(spec.sets - streak, 1)
|
|
349
375
|
if lead:
|
|
350
376
|
# Level the sets before the base moves. The ramp is a way through a
|
|
351
377
|
# stall rather than a shape to keep, so it closes at the first
|
|
@@ -386,6 +386,82 @@ def _streak(
|
|
|
386
386
|
return miss_streak(spec, past, working_weight(logged))
|
|
387
387
|
|
|
388
388
|
|
|
389
|
+
#: Why a target that was part-way up a ramp is evened out. Worth saying in the
|
|
390
|
+
#: report because nothing else in the run accounts for it: no session earned
|
|
391
|
+
#: it, and the figure in workouts.yaml did not move.
|
|
392
|
+
LEVELLED = "partial progression is off, levelled up"
|
|
393
|
+
|
|
394
|
+
#: What a session that cannot say anything about the stored target reports.
|
|
395
|
+
#: Named because the levelling below has to recognise it: it is a statement
|
|
396
|
+
#: about the session, and it stops being true the moment the target moves.
|
|
397
|
+
UP_TO_DATE = "up to date"
|
|
398
|
+
|
|
399
|
+
|
|
400
|
+
def _levelled(spec: ExerciseSpec, target: Target) -> Target:
|
|
401
|
+
"""A ramp evened out - upwards - once partial progression is turned off.
|
|
402
|
+
|
|
403
|
+
Up rather than down because the leading sets have already been carried at
|
|
404
|
+
the higher figure: asking the rest to match it is the smaller of the two
|
|
405
|
+
demands, and dropping to the base would hand back reps that were earned.
|
|
406
|
+
|
|
407
|
+
Only ever reached by a ramp Garmin already holds. With the setting off the
|
|
408
|
+
rules build no new ones, so this is what turning it off does to the ones
|
|
409
|
+
left behind, and each of them meets it once.
|
|
410
|
+
"""
|
|
411
|
+
if spec.partial_progression or not target.lead:
|
|
412
|
+
return target
|
|
413
|
+
return Target(min(target.reps + spec.rep_step, spec.rep_high), target.weight)
|
|
414
|
+
|
|
415
|
+
|
|
416
|
+
def _judge( # noqa: PLR0913 - each argument is one independent input
|
|
417
|
+
spec: ExerciseSpec,
|
|
418
|
+
block: ExerciseBlock,
|
|
419
|
+
current: Target | None,
|
|
420
|
+
performed: Performed | None,
|
|
421
|
+
*,
|
|
422
|
+
history: History | None,
|
|
423
|
+
asked: dict[str, Target] | None,
|
|
424
|
+
specs: ExerciseIndex[ExerciseSpec],
|
|
425
|
+
added: set[int],
|
|
426
|
+
shaped: _Shaping,
|
|
427
|
+
) -> Change | None:
|
|
428
|
+
"""What the session says about one exercise, or None when it says nothing.
|
|
429
|
+
|
|
430
|
+
Kept apart from the loop that writes the workout because a target the
|
|
431
|
+
session leaves alone - or never saw - can still be levelled afterwards, and
|
|
432
|
+
that has to happen once, after every reason a session might say nothing.
|
|
433
|
+
"""
|
|
434
|
+
step = block.step
|
|
435
|
+
|
|
436
|
+
if performed is None or id(block.outer) in added:
|
|
437
|
+
# Either no session to learn from, or a step this run has just
|
|
438
|
+
# built, which already holds exactly what the config asks for.
|
|
439
|
+
return None
|
|
440
|
+
|
|
441
|
+
if current is not None and _moved_on(spec, current, asked):
|
|
442
|
+
# Already learned from, or overtaken by a hand edit. Either way this
|
|
443
|
+
# session has nothing left to say about a target it never saw.
|
|
444
|
+
return Change(spec, current, current, UP_TO_DATE)
|
|
445
|
+
|
|
446
|
+
if current is None:
|
|
447
|
+
kind = "time" if spec.time_based else "rep"
|
|
448
|
+
label = step_exercise_name(step) or step_category(step)
|
|
449
|
+
shaped.warnings.append(f"{label}: step has no {kind} target, skipped")
|
|
450
|
+
return None
|
|
451
|
+
|
|
452
|
+
logged = _logged_for(spec, step, performed, specs)
|
|
453
|
+
if not logged:
|
|
454
|
+
shaped.warnings.append(f"{spec.name}: not found in the activity, skipped")
|
|
455
|
+
return None
|
|
456
|
+
|
|
457
|
+
if spec.time_based:
|
|
458
|
+
# Garmin logs a hold as 1 rep; the duration is the real figure.
|
|
459
|
+
logged = [entry.as_time() for entry in logged]
|
|
460
|
+
|
|
461
|
+
new, why = next_target(spec, current, logged, _streak(spec, logged, history))
|
|
462
|
+
return Change(spec, current, new, why)
|
|
463
|
+
|
|
464
|
+
|
|
389
465
|
def _refresh_note(
|
|
390
466
|
block: ExerciseBlock,
|
|
391
467
|
spec: ExerciseSpec,
|
|
@@ -909,36 +985,42 @@ def plan_workout( # noqa: PLR0913 - each argument is one independent input
|
|
|
909
985
|
if recounted is not None:
|
|
910
986
|
reshaped |= _relay(layout, position, recounted)
|
|
911
987
|
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
988
|
+
change = _judge(
|
|
989
|
+
spec,
|
|
990
|
+
block,
|
|
991
|
+
current,
|
|
992
|
+
performed,
|
|
993
|
+
history=history,
|
|
994
|
+
asked=asked,
|
|
995
|
+
specs=specs,
|
|
996
|
+
added=added,
|
|
997
|
+
shaped=shaped,
|
|
998
|
+
)
|
|
922
999
|
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
1000
|
+
# The last word on the target, whether a session decided it or nobody
|
|
1001
|
+
# did: with partial progression off, a ramp is not a shape this workout
|
|
1002
|
+
# is allowed to hold, so it is evened out here rather than left for a
|
|
1003
|
+
# session that may not come.
|
|
1004
|
+
decided = change.new if change is not None else current
|
|
1005
|
+
if decided is not None:
|
|
1006
|
+
levelled = _levelled(spec, decided)
|
|
1007
|
+
if levelled != decided:
|
|
1008
|
+
# Whatever the session found is still worth saying alongside -
|
|
1009
|
+
# except that it had nothing to say, which beside a target that
|
|
1010
|
+
# has just moved would read as a contradiction.
|
|
1011
|
+
said = change.reason if change is not None else ""
|
|
1012
|
+
change = Change(
|
|
1013
|
+
spec,
|
|
1014
|
+
change.old if change is not None else decided,
|
|
1015
|
+
levelled,
|
|
1016
|
+
f"{said}; {LEVELLED}" if said and said != UP_TO_DATE else LEVELLED,
|
|
1017
|
+
)
|
|
927
1018
|
|
|
928
|
-
|
|
929
|
-
if not logged:
|
|
930
|
-
shaped.warnings.append(f"{spec.name}: not found in the activity, skipped")
|
|
1019
|
+
if change is None:
|
|
931
1020
|
continue
|
|
932
|
-
|
|
933
|
-
if spec.time_based:
|
|
934
|
-
# Garmin logs a hold as 1 rep; the duration is the real figure.
|
|
935
|
-
logged = [entry.as_time() for entry in logged]
|
|
936
|
-
|
|
937
|
-
new, why = next_target(spec, current, logged, _streak(spec, logged, history))
|
|
938
|
-
change = Change(spec, current, new, why)
|
|
939
1021
|
changes.append(change)
|
|
940
1022
|
if change.moved:
|
|
941
|
-
reshaped |= _relay(layout, position, apply_block(block, spec, new))
|
|
1023
|
+
reshaped |= _relay(layout, position, apply_block(block, spec, change.new))
|
|
942
1024
|
|
|
943
1025
|
if reshaped:
|
|
944
1026
|
set_exercise_steps(
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: repwise
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.2.0
|
|
4
4
|
Summary: Advance Garmin strength workout targets using double progression
|
|
5
5
|
Author-email: Adam Żmuda <adam@zmuda.pro>
|
|
6
6
|
License-Expression: MIT
|
|
@@ -92,7 +92,8 @@ Three things it handles that a spreadsheet would not:
|
|
|
92
92
|
pull the target somewhere you cannot repeat.
|
|
93
93
|
- **It eases you back after a stall.** Miss a target twice and the session that
|
|
94
94
|
finally beats it earns a rep on two of your four sets rather than on all of
|
|
95
|
-
them, so you are not asked again for the jump that just failed.
|
|
95
|
+
them, so you are not asked again for the jump that just failed. Set
|
|
96
|
+
`partial_progression: false` if you would rather every set moved together.
|
|
96
97
|
- **It follows the weight you actually used.** Bump the load mid-session and the
|
|
97
98
|
new load is banked, not discarded.
|
|
98
99
|
- **It won't keep a load you didn't earn.** Take the 4 kg dumbbells because the
|
|
@@ -379,6 +379,36 @@ def test_caching_turned_off_by_hand_is_not_read_as_unset(write_config):
|
|
|
379
379
|
assert load_config(write_config(text)).garmin.activity_caching is False
|
|
380
380
|
|
|
381
381
|
|
|
382
|
+
def test_partial_progression_is_on_unless_the_file_says_otherwise(write_config):
|
|
383
|
+
"""The behaviour every config written before the setting existed has."""
|
|
384
|
+
config = load_config(write_config(FIXTURE))
|
|
385
|
+
|
|
386
|
+
assert all(
|
|
387
|
+
spec.partial_progression for workout in config for spec in workout.exercises
|
|
388
|
+
)
|
|
389
|
+
|
|
390
|
+
|
|
391
|
+
def test_partial_progression_reaches_every_exercise(write_config):
|
|
392
|
+
"""Declared once, and resolved onto the specs the rules actually read."""
|
|
393
|
+
text = FIXTURE.replace(
|
|
394
|
+
"settings:\n", "settings:\n partial_progression: false\n", 1
|
|
395
|
+
)
|
|
396
|
+
config = load_config(write_config(text))
|
|
397
|
+
|
|
398
|
+
assert not any(
|
|
399
|
+
spec.partial_progression for workout in config for spec in workout.exercises
|
|
400
|
+
)
|
|
401
|
+
|
|
402
|
+
|
|
403
|
+
def test_partial_progression_must_be_a_boolean(write_config):
|
|
404
|
+
text = FIXTURE.replace(
|
|
405
|
+
"settings:\n", "settings:\n partial_progression: 'false'\n", 1
|
|
406
|
+
)
|
|
407
|
+
|
|
408
|
+
with pytest.raises(ConfigError, match=r"settings\.partial_progression"):
|
|
409
|
+
load_config(write_config(text))
|
|
410
|
+
|
|
411
|
+
|
|
382
412
|
# --- validation -----------------------------------------------------------
|
|
383
413
|
|
|
384
414
|
|
|
@@ -1156,3 +1156,88 @@ def test_without_a_catalog_the_category_still_rescues_the_step():
|
|
|
1156
1156
|
plan_workout(a_workout(exercises=[SEATED_CALF]), built, ({}, {}))
|
|
1157
1157
|
|
|
1158
1158
|
assert calf_steps(built) == ["WEIGHTED_STANDING_CALF_RAISE"]
|
|
1159
|
+
|
|
1160
|
+
|
|
1161
|
+
# --- partial progression turned off ---------------------------------------
|
|
1162
|
+
#
|
|
1163
|
+
# The rules build no ramps with the setting off, so what is left to do here is
|
|
1164
|
+
# the ones Garmin is still holding from before it was turned off: they are
|
|
1165
|
+
# evened out, upwards, the next time a run reads the workout.
|
|
1166
|
+
|
|
1167
|
+
FLAT_SQUAT = replace(SQUAT, partial_progression=False)
|
|
1168
|
+
|
|
1169
|
+
|
|
1170
|
+
def a_ramped_squat(base=8, lead=1, sets=3, weight=20.0):
|
|
1171
|
+
"""A squat stored as Garmin holds a ramp: two adjacent groups."""
|
|
1172
|
+
return workout(
|
|
1173
|
+
repeat(rep_step("BARBELL_BACK_SQUAT", "SQUAT", base + 1, weight), sets=lead),
|
|
1174
|
+
repeat(rep_step("BARBELL_BACK_SQUAT", "SQUAT", base, weight), sets=sets - lead),
|
|
1175
|
+
)
|
|
1176
|
+
|
|
1177
|
+
|
|
1178
|
+
def test_a_stored_ramp_is_levelled_up_with_no_session_at_all():
|
|
1179
|
+
"""A config edit is the whole reason, so it need not wait to be trained."""
|
|
1180
|
+
built = a_ramped_squat()
|
|
1181
|
+
plan = plan_workout(a_workout(exercises=[FLAT_SQUAT]), built)
|
|
1182
|
+
|
|
1183
|
+
assert [c.new for c in plan.moved] == [Target(9, 20.0)]
|
|
1184
|
+
assert plan.changes[0].reason == "partial progression is off, levelled up"
|
|
1185
|
+
assert [step_target(b.step) for b in iter_exercise_blocks(built)] == [
|
|
1186
|
+
Target(9, 20.0)
|
|
1187
|
+
], "one group again, asking nine on every set"
|
|
1188
|
+
|
|
1189
|
+
|
|
1190
|
+
def test_a_session_that_missed_still_levels_the_ramp_up():
|
|
1191
|
+
"""8,8,8 misses the nine it was asked for, and the target still evens out."""
|
|
1192
|
+
built = a_ramped_squat()
|
|
1193
|
+
plan = plan_workout(a_workout(exercises=[FLAT_SQUAT]), built, a_squat_session(8))
|
|
1194
|
+
|
|
1195
|
+
assert [c.new for c in plan.moved] == [Target(9, 20.0)]
|
|
1196
|
+
assert "missed target" in plan.changes[0].reason
|
|
1197
|
+
assert "partial progression is off" in plan.changes[0].reason
|
|
1198
|
+
|
|
1199
|
+
|
|
1200
|
+
def test_a_session_that_hit_advances_from_the_ramp_it_was_asked_for():
|
|
1201
|
+
"""9,8,8 met the ramp. Judged against the levelled target it would miss."""
|
|
1202
|
+
built = a_ramped_squat()
|
|
1203
|
+
session = performed_sets(
|
|
1204
|
+
{
|
|
1205
|
+
"exerciseSets": [
|
|
1206
|
+
active("BARBELL_BACK_SQUAT", "SQUAT", reps, 20000.0)
|
|
1207
|
+
for reps in (9, 8, 8)
|
|
1208
|
+
]
|
|
1209
|
+
}
|
|
1210
|
+
)
|
|
1211
|
+
plan = plan_workout(a_workout(exercises=[FLAT_SQUAT]), built, session)
|
|
1212
|
+
|
|
1213
|
+
assert [c.new for c in plan.moved] == [Target(9, 20.0)]
|
|
1214
|
+
assert "add 1 rep" in plan.changes[0].reason
|
|
1215
|
+
|
|
1216
|
+
|
|
1217
|
+
def test_a_session_with_nothing_to_say_does_not_say_it_beside_a_move():
|
|
1218
|
+
"""The session had nothing to say; the config moved the target anyway."""
|
|
1219
|
+
built = a_ramped_squat()
|
|
1220
|
+
plan = plan_workout(
|
|
1221
|
+
a_workout(exercises=[FLAT_SQUAT]),
|
|
1222
|
+
built,
|
|
1223
|
+
a_squat_session(8),
|
|
1224
|
+
asked={"barbellbacksquat": Target(8, 0.0)},
|
|
1225
|
+
)
|
|
1226
|
+
|
|
1227
|
+
assert [c.new for c in plan.moved] == [Target(9, 20.0)]
|
|
1228
|
+
assert plan.changes[0].reason == "partial progression is off, levelled up"
|
|
1229
|
+
|
|
1230
|
+
|
|
1231
|
+
def test_levelling_up_stops_at_the_top_of_the_range():
|
|
1232
|
+
"""A ramp on top of rep_high has nowhere higher to even out to."""
|
|
1233
|
+
built = a_ramped_squat(base=FLAT_SQUAT.rep_high)
|
|
1234
|
+
plan = plan_workout(a_workout(exercises=[FLAT_SQUAT]), built)
|
|
1235
|
+
|
|
1236
|
+
assert [c.new for c in plan.moved] == [Target(FLAT_SQUAT.rep_high, 20.0)]
|
|
1237
|
+
|
|
1238
|
+
|
|
1239
|
+
def test_a_ramp_is_left_alone_while_partial_progression_is_on():
|
|
1240
|
+
built = a_ramped_squat()
|
|
1241
|
+
plan = plan_workout(a_workout(exercises=[SQUAT]), built)
|
|
1242
|
+
|
|
1243
|
+
assert not plan.moved
|
|
@@ -444,6 +444,61 @@ def test_a_timed_hold_names_seconds_on_a_partial_advance():
|
|
|
444
444
|
assert "add 1 second on 2 of 3 sets" in why, why
|
|
445
445
|
|
|
446
446
|
|
|
447
|
+
# --- partial progression turned off ---------------------------------------
|
|
448
|
+
#
|
|
449
|
+
# settings.partial_progression: false. The streak stops buying a smaller
|
|
450
|
+
# advance, and every set moves together in both directions: a hit adds a whole
|
|
451
|
+
# rep to the target, and an ease takes one off it.
|
|
452
|
+
|
|
453
|
+
WHOLE_SET_SQUAT = spec(sets=4, weight_step=2.5, partial_progression=False)
|
|
454
|
+
|
|
455
|
+
|
|
456
|
+
def test_a_hit_after_a_stall_still_moves_the_whole_target():
|
|
457
|
+
target, why = next_target(
|
|
458
|
+
WHOLE_SET_SQUAT, Target(8, 20.0), [P(8, 20.0)] * 4, streak=2
|
|
459
|
+
)
|
|
460
|
+
assert target == Target(9, 20.0), why
|
|
461
|
+
assert "add 1 rep" in why
|
|
462
|
+
assert "of 4 sets" not in why, "nothing was held back"
|
|
463
|
+
|
|
464
|
+
|
|
465
|
+
def test_a_hit_after_a_long_stall_moves_the_whole_target_too():
|
|
466
|
+
"""However long the streak: there is no smaller step to take."""
|
|
467
|
+
target, why = next_target(
|
|
468
|
+
WHOLE_SET_SQUAT, Target(8, 20.0), [P(8, 20.0)] * 4, streak=9
|
|
469
|
+
)
|
|
470
|
+
assert target == Target(9, 20.0), why
|
|
471
|
+
|
|
472
|
+
|
|
473
|
+
def test_a_ramp_left_behind_is_spent_by_the_next_hit():
|
|
474
|
+
"""A target ramped before the setting changed levels up and stays flat."""
|
|
475
|
+
target, why = next_target(
|
|
476
|
+
WHOLE_SET_SQUAT, Target(8, 20.0, lead=2), [P(9, 20.0)] * 2 + [P(8, 20.0)] * 2
|
|
477
|
+
)
|
|
478
|
+
assert target == Target(9, 20.0), why
|
|
479
|
+
|
|
480
|
+
|
|
481
|
+
def test_easing_takes_a_whole_rep_off_rather_than_one_set():
|
|
482
|
+
"""9,9,9,8 against a target of 9 eases to 8 everywhere, not to `8+3`."""
|
|
483
|
+
target, why = next_target(
|
|
484
|
+
WHOLE_SET_SQUAT,
|
|
485
|
+
Target(9, 20.0),
|
|
486
|
+
[P(9, 20.0)] * 3 + [P(8, 20.0)],
|
|
487
|
+
streak=1,
|
|
488
|
+
)
|
|
489
|
+
assert target == Target(8, 20.0), why
|
|
490
|
+
assert target.spread(4) == "8"
|
|
491
|
+
assert "take 1 rep off" in why, "no set to name when they all moved"
|
|
492
|
+
|
|
493
|
+
|
|
494
|
+
def test_easing_still_stops_at_the_bottom_of_the_range():
|
|
495
|
+
"""Out of range is out of range, and then the load comes off."""
|
|
496
|
+
target, why = next_target(
|
|
497
|
+
WHOLE_SET_SQUAT, Target(6, 20.0), [P(5, 20.0)] * 4, streak=1
|
|
498
|
+
)
|
|
499
|
+
assert target == Target(6, 17.5), why
|
|
500
|
+
|
|
501
|
+
|
|
447
502
|
# --- how a target is written ----------------------------------------------
|
|
448
503
|
|
|
449
504
|
|
|
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
|
|
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
|