Added serialize and deserialize methods to exercises, days and program.
Added to_dict to Program.
from streprogen import Program
# Create an 8-week program, rounding every exercise to nearest unit og 5kg
program = Program("My first program!", duration=2, units="kg", round_to=5)
with program.Day("Day A"):
program.DynamicExercise("Bench press", start_weight=80, min_reps=3, max_reps=8)
program.DynamicExercise("Squats", start_weight=100, min_reps=3, max_reps=8)
with program.Day("Day B"):
program.DynamicExercise("Deadlifts", start_weight=100, min_reps=2, max_reps=7)
program.StaticExercise("Curls", "3 x 10 @ 18kg")
# Render the program, then print it
program.render()
import json
print(json.dumps(program.to_dict(), indent=2, sort_keys=True))
@glemvik
to_dict
to Program.JSON output
Create program from JSON
Creating a program (how an API endpoint might look)