pr-pro 1.0.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.

Potentially problematic release.


This version of pr-pro might be problematic. Click here for more details.

Files changed (39) hide show
  1. pr_pro-1.0.0/.devcontainer/devcontainer.json +33 -0
  2. pr_pro-1.0.0/.github/workflows/ci.yaml +57 -0
  3. pr_pro-1.0.0/.gitignore +180 -0
  4. pr_pro-1.0.0/.pre-commit-config.yaml +18 -0
  5. pr_pro-1.0.0/.python-version +1 -0
  6. pr_pro-1.0.0/PKG-INFO +26 -0
  7. pr_pro-1.0.0/README.md +6 -0
  8. pr_pro-1.0.0/example/example_plan.py +140 -0
  9. pr_pro-1.0.0/example/example_plan_abbv.py +124 -0
  10. pr_pro-1.0.0/example/plot_1rm.py +44 -0
  11. pr_pro-1.0.0/example/test.py +51 -0
  12. pr_pro-1.0.0/pyproject.toml +52 -0
  13. pr_pro-1.0.0/src/pr_pro/__init__.py +0 -0
  14. pr_pro-1.0.0/src/pr_pro/abbreviations.py +2 -0
  15. pr_pro-1.0.0/src/pr_pro/configs.py +8 -0
  16. pr_pro-1.0.0/src/pr_pro/example.py +221 -0
  17. pr_pro-1.0.0/src/pr_pro/exercise.py +158 -0
  18. pr_pro-1.0.0/src/pr_pro/exercises/common.py +21 -0
  19. pr_pro-1.0.0/src/pr_pro/functions.py +122 -0
  20. pr_pro-1.0.0/src/pr_pro/program.py +70 -0
  21. pr_pro-1.0.0/src/pr_pro/sets.py +148 -0
  22. pr_pro-1.0.0/src/pr_pro/streamlit_vis/__init__.py +6 -0
  23. pr_pro-1.0.0/src/pr_pro/streamlit_vis/session.py +44 -0
  24. pr_pro-1.0.0/src/pr_pro/streamlit_vis/sets.py +165 -0
  25. pr_pro-1.0.0/src/pr_pro/streamlit_vis/state.py +80 -0
  26. pr_pro-1.0.0/src/pr_pro/streamlit_vis/streamlit_app.py +71 -0
  27. pr_pro-1.0.0/src/pr_pro/streamlit_vis/workout_component.py +111 -0
  28. pr_pro-1.0.0/src/pr_pro/workout_component.py +248 -0
  29. pr_pro-1.0.0/src/pr_pro/workout_session.py +101 -0
  30. pr_pro-1.0.0/tests/conftest.py +53 -0
  31. pr_pro-1.0.0/tests/system_tests/test_one_rm_calculator.py +39 -0
  32. pr_pro-1.0.0/tests/system_tests/test_programs.py +31 -0
  33. pr_pro-1.0.0/tests/test_import.py +2 -0
  34. pr_pro-1.0.0/tests/unit_tests/test_component_from_previous.py +44 -0
  35. pr_pro-1.0.0/tests/unit_tests/test_compute_values.py +102 -0
  36. pr_pro-1.0.0/tests/unit_tests/test_program.py +44 -0
  37. pr_pro-1.0.0/tests/unit_tests/test_session.py +52 -0
  38. pr_pro-1.0.0/tests/unit_tests/test_workout_component.py +115 -0
  39. pr_pro-1.0.0/uv.lock +1027 -0
@@ -0,0 +1,33 @@
1
+ {
2
+ "name": "Python 3",
3
+ // Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
4
+ "image": "mcr.microsoft.com/devcontainers/python:1-3.11-bullseye",
5
+ "customizations": {
6
+ "codespaces": {
7
+ "openFiles": [
8
+ "README.md",
9
+ "src/pr_pro/streamlit_vis/streamlit_app.py"
10
+ ]
11
+ },
12
+ "vscode": {
13
+ "settings": {},
14
+ "extensions": [
15
+ "ms-python.python",
16
+ "ms-python.vscode-pylance"
17
+ ]
18
+ }
19
+ },
20
+ "updateContentCommand": "[ -f packages.txt ] && sudo apt update && sudo apt upgrade -y && sudo xargs apt install -y <packages.txt; [ -f requirements.txt ] && pip3 install --user -r requirements.txt; pip3 install --user streamlit; echo '✅ Packages installed and Requirements met'",
21
+ "postAttachCommand": {
22
+ "server": "streamlit run src/pr_pro/streamlit_vis/streamlit_app.py --server.enableCORS false --server.enableXsrfProtection false"
23
+ },
24
+ "portsAttributes": {
25
+ "8501": {
26
+ "label": "Application",
27
+ "onAutoForward": "openPreview"
28
+ }
29
+ },
30
+ "forwardPorts": [
31
+ 8501
32
+ ]
33
+ }
@@ -0,0 +1,57 @@
1
+ name: Python CI
2
+
3
+ on:
4
+ push:
5
+ branches: ["**"]
6
+ pull_request:
7
+ branches: ["main"]
8
+
9
+ jobs:
10
+ lint:
11
+ runs-on: ubuntu-latest
12
+ steps:
13
+ - name: Checkout code
14
+ uses: actions/checkout@v4
15
+
16
+ - name: Set up Python 3.12
17
+ uses: actions/setup-python@v5
18
+ with:
19
+ python-version: "3.12"
20
+
21
+ - name: Install dependencies
22
+ run: |
23
+ python -m pip install --upgrade pip
24
+ pip install ruff>=0.11
25
+
26
+ - name: Lint with ruff
27
+ run: |
28
+ ruff format --check .
29
+ ruff check .
30
+
31
+ test:
32
+ runs-on: ubuntu-latest
33
+ steps:
34
+ - name: Checkout code
35
+ uses: actions/checkout@v4
36
+
37
+ - name: Set up Python 3.12
38
+ uses: actions/setup-python@v5
39
+ with:
40
+ python-version: "3.12"
41
+
42
+ - name: Install dependencies
43
+ run: |
44
+ python -m pip install --upgrade pip
45
+ pip install -e .[dev]
46
+
47
+ - name: Run pytest
48
+ run: |
49
+ python -m pytest tests --cov --cov-report json
50
+ coverage report
51
+
52
+ - name:
53
+ Update Coverage Badge
54
+ # GitHub actions: default branch variable
55
+ # https://stackoverflow.com/questions/64781462/github-actions-default-branch-variable
56
+ if: github.ref == format('refs/heads/{0}', github.event.repository.default_branch)
57
+ uses: we-cli/coverage-badge-action@main
@@ -0,0 +1,180 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+
6
+ # C extensions
7
+ *.so
8
+
9
+ # Distribution / packaging
10
+ .Python
11
+ build/
12
+ develop-eggs/
13
+ dist/
14
+ downloads/
15
+ eggs/
16
+ .eggs/
17
+ lib/
18
+ lib64/
19
+ parts/
20
+ sdist/
21
+ var/
22
+ wheels/
23
+ share/python-wheels/
24
+ *.egg-info/
25
+ .installed.cfg
26
+ *.egg
27
+ MANIFEST
28
+
29
+ # PyInstaller
30
+ # Usually these files are written by a python script from a template
31
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
32
+ *.manifest
33
+ *.spec
34
+
35
+ # Installer logs
36
+ pip-log.txt
37
+ pip-delete-this-directory.txt
38
+
39
+ # Unit test / coverage reports
40
+ htmlcov/
41
+ .tox/
42
+ .nox/
43
+ .coverage
44
+ .coverage.*
45
+ .cache
46
+ nosetests.xml
47
+ coverage.xml
48
+ *.cover
49
+ *.py,cover
50
+ .hypothesis/
51
+ .pytest_cache/
52
+ cover/
53
+
54
+ # Translations
55
+ *.mo
56
+ *.pot
57
+
58
+ # Django stuff:
59
+ *.log
60
+ local_settings.py
61
+ db.sqlite3
62
+ db.sqlite3-journal
63
+
64
+ # Flask stuff:
65
+ instance/
66
+ .webassets-cache
67
+
68
+ # Scrapy stuff:
69
+ .scrapy
70
+
71
+ # Sphinx documentation
72
+ docs/_build/
73
+
74
+ # PyBuilder
75
+ .pybuilder/
76
+ target/
77
+
78
+ # Jupyter Notebook
79
+ .ipynb_checkpoints
80
+
81
+ # IPython
82
+ profile_default/
83
+ ipython_config.py
84
+
85
+ # pyenv
86
+ # For a library or package, you might want to ignore these files since the code is
87
+ # intended to run in multiple environments; otherwise, check them in:
88
+ # .python-version
89
+
90
+ # pipenv
91
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
92
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
93
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
94
+ # install all needed dependencies.
95
+ #Pipfile.lock
96
+
97
+ # UV
98
+ # Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
99
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
100
+ # commonly ignored for libraries.
101
+ #uv.lock
102
+
103
+ # poetry
104
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
105
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
106
+ # commonly ignored for libraries.
107
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
108
+ #poetry.lock
109
+
110
+ # pdm
111
+ # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
112
+ #pdm.lock
113
+ # pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
114
+ # in version control.
115
+ # https://pdm.fming.dev/latest/usage/project/#working-with-version-control
116
+ .pdm.toml
117
+ .pdm-python
118
+ .pdm-build/
119
+
120
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
121
+ __pypackages__/
122
+
123
+ # Celery stuff
124
+ celerybeat-schedule
125
+ celerybeat.pid
126
+
127
+ # SageMath parsed files
128
+ *.sage.py
129
+
130
+ # Environments
131
+ .env
132
+ .venv
133
+ env/
134
+ venv/
135
+ ENV/
136
+ env.bak/
137
+ venv.bak/
138
+
139
+ # Spyder project settings
140
+ .spyderproject
141
+ .spyproject
142
+
143
+ # Rope project settings
144
+ .ropeproject
145
+
146
+ # mkdocs documentation
147
+ /site
148
+
149
+ # mypy
150
+ .mypy_cache/
151
+ .dmypy.json
152
+ dmypy.json
153
+
154
+ # Pyre type checker
155
+ .pyre/
156
+
157
+ # pytype static type analyzer
158
+ .pytype/
159
+
160
+ # Cython debug symbols
161
+ cython_debug/
162
+
163
+ # PyCharm
164
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
165
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
166
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
167
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
168
+ .idea/
169
+
170
+ # Ruff stuff:
171
+ .ruff_cache/
172
+
173
+ # PyPI configuration file
174
+ .pypirc
175
+
176
+ .vscode
177
+ test.json
178
+
179
+ app_state.json
180
+ .DS_Store
@@ -0,0 +1,18 @@
1
+ repos:
2
+ - repo: https://github.com/pre-commit/pre-commit-hooks
3
+ rev: v3.2.0
4
+ hooks:
5
+ - id: trailing-whitespace
6
+ - id: end-of-file-fixer
7
+ - id: check-yaml
8
+ - id: check-added-large-files
9
+
10
+ - repo: https://github.com/astral-sh/ruff-pre-commit
11
+ # Ruff version.
12
+ rev: v0.11.0
13
+ hooks:
14
+ # Run the linter.
15
+ - id: ruff
16
+ args: [ "--fix" ]
17
+ # Run the formatter.
18
+ - id: ruff-format
@@ -0,0 +1 @@
1
+ 3.13
pr_pro-1.0.0/PKG-INFO ADDED
@@ -0,0 +1,26 @@
1
+ Metadata-Version: 2.4
2
+ Name: pr-pro
3
+ Version: 1.0.0
4
+ Summary: PRogramming PROgrams is a Python library for defining training programs.
5
+ Project-URL: Homepage, https://github.com/rolandstolz/pr_pro
6
+ Author-email: Roland Stolz <roland.stolz9@gmail.com>
7
+ Classifier: License :: OSI Approved :: MIT License
8
+ Classifier: Operating System :: OS Independent
9
+ Classifier: Programming Language :: Python :: 3
10
+ Requires-Python: >=3.12
11
+ Requires-Dist: pydantic>=2.11.4
12
+ Provides-Extra: dev
13
+ Requires-Dist: pytest-cov>=6.1.1; extra == 'dev'
14
+ Requires-Dist: pytest>=8.4.0; extra == 'dev'
15
+ Provides-Extra: vis
16
+ Requires-Dist: matplotlib>=3.10.3; extra == 'vis'
17
+ Requires-Dist: streamlit>=1.45.1; extra == 'vis'
18
+ Requires-Dist: watchdog>=6.0.0; extra == 'vis'
19
+ Description-Content-Type: text/markdown
20
+
21
+ # PRogramming PROgrams
22
+
23
+ [![cov](https://RolandStolz.github.io/pr_pro/badges/coverage.svg)](https://github.com/RolandStolz/pr_pro/actions)
24
+
25
+ ### Notes
26
+ - When streamlit does not detect changes, run `export PYTHONPATH=$PYTHONPATH:./src` before
pr_pro-1.0.0/README.md ADDED
@@ -0,0 +1,6 @@
1
+ # PRogramming PROgrams
2
+
3
+ [![cov](https://RolandStolz.github.io/pr_pro/badges/coverage.svg)](https://github.com/RolandStolz/pr_pro/actions)
4
+
5
+ ### Notes
6
+ - When streamlit does not detect changes, run `export PYTHONPATH=$PYTHONPATH:./src` before
@@ -0,0 +1,140 @@
1
+ import datetime
2
+ from pr_pro.workout_session import WorkoutSession
3
+ from pr_pro.configs import ComputeConfig
4
+ from pr_pro.program import Program
5
+ from pr_pro.exercise import DurationExercise, RepsExercise
6
+ from pr_pro.exercises.common import backsquat, deadlift, bench_press, split_squat, pullup, pushup
7
+ from pr_pro.exercise import RepsAndWeightsExercise, RepsRPEExercise
8
+ from pr_pro.workout_component import ExerciseGroup, SingleExercise
9
+
10
+
11
+ def main():
12
+ box_jump = RepsExercise(name='Box jump')
13
+ pendlay_row = RepsAndWeightsExercise(name='Pendlay row')
14
+ dumbbell_shoulder_press = RepsRPEExercise(name='Dumbbell shoulder press')
15
+ hip_thrust = RepsAndWeightsExercise(name='Hip thrust')
16
+ side_plank_leg_raise = RepsExercise(name='Side plank leg raise')
17
+ cable_pulldown = RepsRPEExercise(name='Straight arm cable pulldown')
18
+ pallov_press = RepsRPEExercise(name='Pallov press')
19
+ squat_hold = DurationExercise(name='Squat hold')
20
+ hanging_knee_raise = RepsAndWeightsExercise(name='Hanging knee raise')
21
+ reverse_hyperextension = RepsExercise(name='Reverse hyperextension')
22
+
23
+ program = (
24
+ Program(name='Test program')
25
+ .add_best_exercise_value(backsquat, 55)
26
+ .add_best_exercise_value(deadlift, 90)
27
+ .add_best_exercise_value(bench_press, 50)
28
+ )
29
+ program.add_best_exercise_value(pendlay_row, program.best_exercise_values[deadlift] * 0.6)
30
+
31
+ w1d1 = (
32
+ WorkoutSession(id='W1D1', notes='Power day.')
33
+ .add_component(
34
+ SingleExercise(exercise=box_jump, notes='Good warmup please!').add_repeating_set(
35
+ 5, box_jump.create_set(4)
36
+ )
37
+ )
38
+ .add_component(
39
+ SingleExercise(exercise=backsquat).add_repeating_set(
40
+ 4, backsquat.create_set(5, percentage=0.55)
41
+ )
42
+ )
43
+ .add_component(
44
+ ExerciseGroup(
45
+ exercises=[pendlay_row, dumbbell_shoulder_press],
46
+ notes='Put down completely for pendlay row.',
47
+ ).add_repeating_group_sets(
48
+ 4,
49
+ {
50
+ pendlay_row: pendlay_row.create_set(6, percentage=0.6),
51
+ dumbbell_shoulder_press: dumbbell_shoulder_press.create_set(10, rpe=6),
52
+ },
53
+ )
54
+ )
55
+ .add_component(
56
+ ExerciseGroup(exercises=[hip_thrust, side_plank_leg_raise]).add_repeating_group_sets(
57
+ 4,
58
+ {
59
+ hip_thrust: hip_thrust.create_set(8, weight=60),
60
+ side_plank_leg_raise: side_plank_leg_raise.create_set(10),
61
+ },
62
+ )
63
+ )
64
+ )
65
+ program.add_workout_session(w1d1)
66
+
67
+ w1d2 = (
68
+ WorkoutSession(id='W1D2')
69
+ .add_component(
70
+ SingleExercise(exercise=deadlift, notes='Squeeze glutes!').add_repeating_set(
71
+ 3, deadlift.create_set(12, percentage=0.5)
72
+ )
73
+ )
74
+ .add_component(
75
+ SingleExercise(exercise=split_squat).add_repeating_set(
76
+ 4, backsquat.create_set(6, weight=0)
77
+ )
78
+ )
79
+ .add_component(
80
+ ExerciseGroup(
81
+ exercises=[pullup, pushup], notes='Pullup with reverse grip'
82
+ ).add_repeating_group_sets(
83
+ 5,
84
+ {pullup: pullup.create_set(1), pushup: pushup.create_set(6)},
85
+ )
86
+ )
87
+ .add_component(
88
+ ExerciseGroup(exercises=[cable_pulldown, pallov_press]).add_repeating_group_sets(
89
+ 4,
90
+ {
91
+ cable_pulldown: cable_pulldown.create_set(10, rpe=6),
92
+ pallov_press: pallov_press.create_set(10, rpe=6),
93
+ },
94
+ )
95
+ )
96
+ )
97
+ program.add_workout_session(w1d2)
98
+
99
+ w1d3 = (
100
+ WorkoutSession(id='W1D3')
101
+ .add_component(
102
+ SingleExercise(exercise=squat_hold).add_repeating_set(
103
+ 3, squat_hold.create_set(duration=datetime.timedelta(minutes=1))
104
+ )
105
+ )
106
+ .add_component(
107
+ SingleExercise(exercise=backsquat).add_repeating_set(
108
+ 4, backsquat.create_set(8, percentage=0.6)
109
+ )
110
+ )
111
+ .add_component(
112
+ SingleExercise(exercise=deadlift, notes='Every minute on the minute').add_repeating_set(
113
+ 10, deadlift.create_set(2, percentage=0.5)
114
+ )
115
+ )
116
+ .add_component(
117
+ SingleExercise(exercise=bench_press).add_repeating_set(
118
+ 4, bench_press.create_set(10, percentage=0.6)
119
+ )
120
+ )
121
+ .add_component(
122
+ ExerciseGroup(
123
+ exercises=[hanging_knee_raise, reverse_hyperextension]
124
+ ).add_repeating_group_sets(
125
+ 4,
126
+ {
127
+ hanging_knee_raise: hanging_knee_raise.create_set(6, weight=10),
128
+ reverse_hyperextension: reverse_hyperextension.create_set(6),
129
+ },
130
+ )
131
+ )
132
+ )
133
+ program.add_workout_session(w1d3)
134
+
135
+ program.compute_values(compute_config=ComputeConfig())
136
+ print(program)
137
+
138
+
139
+ if __name__ == '__main__':
140
+ main()
@@ -0,0 +1,124 @@
1
+ from datetime import time
2
+ from pr_pro.workout_session import WorkoutSession
3
+ from pr_pro.program import Program
4
+ from pr_pro.exercise import DurationExercise, RepsExercise
5
+ from pr_pro.exercises.common import backsquat, deadlift, bench_press, split_squat, pullup, pushup
6
+ from pr_pro.exercise import RepsAndWeightsExercise, RepsRPEExercise
7
+ from pr_pro.abbreviations import SE, EG
8
+
9
+
10
+ def main():
11
+ box_jump = RepsExercise(name='Box jump')
12
+ pendlay_row = RepsAndWeightsExercise(name='Pendlay row')
13
+ dumbbell_shoulder_press = RepsRPEExercise(name='Dumbbell shoulder press')
14
+ hip_thrust = RepsAndWeightsExercise(name='Hip thrust')
15
+ side_plank_leg_raise = RepsExercise(name='Side plank leg raise')
16
+ cable_pulldown = RepsRPEExercise(name='Straight arm cable pulldown')
17
+ pallov_press = RepsRPEExercise(name='Pallov press')
18
+ squat_hold = DurationExercise(name='Squat hold')
19
+ hanging_knee_raise = RepsAndWeightsExercise(name='Hanging knee raise')
20
+ reverse_hyperextension = RepsExercise(name='Reverse hyperextension')
21
+
22
+ program = (
23
+ Program(name='Test program')
24
+ .add_best_exercise_value(backsquat, 55)
25
+ .add_best_exercise_value(deadlift, 90)
26
+ .add_best_exercise_value(bench_press, 50)
27
+ )
28
+ program.add_best_exercise_value(pendlay_row, program.best_exercise_values[deadlift] * 0.6)
29
+
30
+ w1d1 = (
31
+ WorkoutSession(id='W1D1', notes='Power day.')
32
+ .add_co(
33
+ SE(exercise=box_jump, notes='Good warmup please!').add_rs(5, box_jump.create_set(4))
34
+ )
35
+ .add_co(
36
+ SE(exercise=backsquat).add_repeating_set(4, backsquat.create_set(5, percentage=0.55))
37
+ )
38
+ .add_co(
39
+ EG(
40
+ exercises=[pendlay_row, dumbbell_shoulder_press],
41
+ notes='Put down completely for pendlay row.',
42
+ ).add_rgs(
43
+ 4,
44
+ {
45
+ pendlay_row: pendlay_row.create_set(6, percentage=0.6),
46
+ dumbbell_shoulder_press: dumbbell_shoulder_press.create_set(10, rpe=6),
47
+ },
48
+ )
49
+ )
50
+ .add_co(
51
+ EG(exercises=[hip_thrust, side_plank_leg_raise]).add_rgs(
52
+ 4,
53
+ {
54
+ hip_thrust: hip_thrust.create_set(8, weight=60),
55
+ side_plank_leg_raise: side_plank_leg_raise.create_set(10),
56
+ },
57
+ )
58
+ )
59
+ )
60
+ program.add_workout_session(w1d1)
61
+
62
+ w1d2 = (
63
+ WorkoutSession(id='W1D2')
64
+ .add_co(
65
+ SE(exercise=deadlift, notes='Squeeze glutes!').add_repeating_set(
66
+ 3, deadlift.create_set(12, percentage=0.5)
67
+ )
68
+ )
69
+ .add_co(SE(exercise=split_squat).add_repeating_set(4, backsquat.create_set(6, weight=0)))
70
+ .add_co(
71
+ EG(exercises=[pullup, pushup], notes='Pullup with reverse grip').add_rgs(
72
+ 5,
73
+ {pullup: pullup.create_set(1), pushup: pushup.create_set(6)},
74
+ )
75
+ )
76
+ .add_co(
77
+ EG(exercises=[cable_pulldown, pallov_press]).add_rgs(
78
+ 4,
79
+ {
80
+ cable_pulldown: cable_pulldown.create_set(10, rpe=6),
81
+ pallov_press: pallov_press.create_set(10, rpe=6),
82
+ },
83
+ )
84
+ )
85
+ )
86
+ program.add_workout_session(w1d2)
87
+
88
+ w1d3 = (
89
+ WorkoutSession(id='W1D3')
90
+ .add_co(
91
+ SE(exercise=squat_hold).add_repeating_set(
92
+ 3, squat_hold.create_set(duration=time(minute=1))
93
+ )
94
+ )
95
+ .add_co(
96
+ SE(exercise=backsquat).add_repeating_set(4, backsquat.create_set(8, percentage=0.6))
97
+ )
98
+ .add_co(
99
+ SE(exercise=deadlift, notes='Every minute on the minute').add_repeating_set(
100
+ 10, deadlift.create_set(2, percentage=0.5)
101
+ )
102
+ )
103
+ .add_co(
104
+ SE(exercise=bench_press).add_repeating_set(
105
+ 4, bench_press.create_set(10, percentage=0.6)
106
+ )
107
+ )
108
+ .add_co(
109
+ EG(exercises=[hanging_knee_raise, reverse_hyperextension]).add_rgs(
110
+ 4,
111
+ {
112
+ hanging_knee_raise: hanging_knee_raise.create_set(6, weight=10),
113
+ reverse_hyperextension: reverse_hyperextension.create_set(6),
114
+ },
115
+ )
116
+ )
117
+ )
118
+ program.add_workout_session(w1d3)
119
+
120
+ print(program)
121
+
122
+
123
+ if __name__ == '__main__':
124
+ main()
@@ -0,0 +1,44 @@
1
+ import matplotlib.pyplot as plt
2
+ import numpy as np
3
+
4
+ from pr_pro.functions import (
5
+ Brzycki1RMCalculator,
6
+ Epley1RMCalculator,
7
+ Landers1RMCalculator,
8
+ Lombardi1RMCalculator,
9
+ Mayhew1RMCalculator,
10
+ OConner1RMCalculator,
11
+ OneRMCalculator,
12
+ Wathan1RMCalculator,
13
+ )
14
+
15
+
16
+ def main():
17
+ reps = np.arange(1, 21)
18
+ one_rm_weight = 100
19
+
20
+ calculators: dict[str, type[OneRMCalculator]] = {
21
+ 'Epley': Epley1RMCalculator,
22
+ 'Brzycki': Brzycki1RMCalculator,
23
+ 'Landers': Landers1RMCalculator,
24
+ 'Lombardi': Lombardi1RMCalculator,
25
+ "O'Conner": OConner1RMCalculator,
26
+ 'Wathan': Wathan1RMCalculator,
27
+ 'Mayhew': Mayhew1RMCalculator,
28
+ }
29
+
30
+ plt.figure()
31
+
32
+ for name, calculator in calculators.items():
33
+ weights = [calculator.one_rep_max(one_rm_weight, float(r)) for r in reps]
34
+ plt.plot(reps, weights, label=name)
35
+
36
+ plt.xlabel('Reps')
37
+ plt.ylabel('Estimated 1RM')
38
+ plt.legend()
39
+ plt.grid(True)
40
+ plt.show()
41
+
42
+
43
+ if __name__ == '__main__':
44
+ main()
@@ -0,0 +1,51 @@
1
+ from pathlib import Path
2
+ from pr_pro.workout_session import WorkoutSession
3
+ from pr_pro.configs import ComputeConfig
4
+ from pr_pro.program import Program
5
+ from pr_pro.exercise import RepsAndWeightsExercise
6
+ from pr_pro.exercises.common import backsquat, pushup
7
+ from pr_pro.workout_component import SingleExercise, ExerciseGroup
8
+
9
+
10
+ def main():
11
+ pendlay_row = RepsAndWeightsExercise(name='Pendlay row')
12
+
13
+ program = Program(name='Test program').add_best_exercise_value(backsquat, 100)
14
+ program.add_best_exercise_value(pendlay_row, program.best_exercise_values[backsquat] * 0.6)
15
+
16
+ w1d1 = (
17
+ WorkoutSession(id='W1D1', notes='Power day.')
18
+ .add_component(
19
+ SingleExercise(exercise=backsquat).add_repeating_set(
20
+ 4, backsquat.create_set(5, percentage=0.55)
21
+ )
22
+ )
23
+ .add_component(
24
+ ExerciseGroup(exercises=[pendlay_row, pushup]).add_repeating_group_sets(
25
+ 4,
26
+ {
27
+ pendlay_row: pendlay_row.create_set(6, percentage=0.6),
28
+ pushup: pushup.create_set(10),
29
+ },
30
+ )
31
+ )
32
+ .add_component(
33
+ SingleExercise(exercise=pendlay_row).add_repeating_set(
34
+ 4, pendlay_row.create_set(6, percentage=0.6)
35
+ )
36
+ )
37
+ )
38
+
39
+ program.add_workout_session(w1d1)
40
+ program.compute_values(ComputeConfig())
41
+
42
+ program.write_json_file(Path('test.json'))
43
+
44
+ loaded = Program.from_json_file(Path('test.json'))
45
+ print(loaded)
46
+ print(program.best_exercise_values.items())
47
+ print(loaded.best_exercise_values.items())
48
+
49
+
50
+ if __name__ == '__main__':
51
+ main()