Create your own terminal-based workouts!
'Script My Workout' is a framework that lets you define and run your own workout exercise programs, which run right in the terminal.
Each workout
is comprised of different sections
, which contain a list of exercises
and a routine
, which is a function that runs through them in a user-defined sequence.
When running each section
, the program prints information to the terminal and narrates the process out loud for you to follow along with.
Note that this package (and the installation instructions) work with python 3 (and pip 3). Depending on how your system is set up, you might need to replace python
with python3
and pip
with pip3
in the following to make this explicit.
Run the following commands
git clone https://github.com/twhughes/Script_My_Workout.git
cd Script_My_Workout
pip install -e .
You can test if it worked by running one of the example workouts
python -m workout examples/easy.yaml
There are two ways to define workouts:
The simplest way is to define a workout in a YAML file.
For example, the following yaml file examples/easy.yaml
defines a simple workout:
name: easy workout
sections:
section1:
name: warmup
routine: one_min_each
exercises:
- toe touch
- run in place
section2:
name: HIT
routine: abab_25
exercises:
- jumping jacks
- burpees
- push ups
- high knees
section3:
name: cooldown
routine: one_min_each
exercises:
- hamstring stretch
- cobra stretch
And one can run this file with
python -m workout examples/easy.yaml
There are a few other example files in the examples/
directory.
For a bit more customization, one can also write a workout script in python.
Here's an example script that defines and runs a simple workout.
# import basic things you need from the package + routines and exercises
from workout import workout, section
from workout.exercises import warmup_exercises, hit_exercises, cooldown_exercises
from workout.routines import one_min_each, abab_25
# define the different `sections` of your workout with a list of exercises and a routine for running them
warmup = section(name='warmup', exercises=warmup_exercises, routine=one_min_each)
hit = section(name='HIT', exercises=hit_exercises, routine=abab_25)
cooldown = section(name='cooldown', exercises=cooldown_exercises, routine=one_min_each)
# create a workout defined by a list of sections
hard_workout = workout(name='easy', sections=[warmup, hit, cooldown])
# run the workout
hard_workout.run()
For an example, run the script simple_script.py
.
python examples/simple_script.py
Workouts are fully customizable by editing the files in the workout/
directory.
-
Define lists of exercises in
workout/exercises.py
, which define the categories of exercise you want to perform. -
Make routines in
workout/routines.py
, which define how to run through your excercises. -
Group your exercises and routines into 'sections' using
workout/sections.py
. -
Combine sections together to form daily workouts in
workout/workouts.py
.
- Workout definition through YAML file.
- Progress bar display.
- Trainers with different personalities.
- Customizable command line interface (define workout via command line arguments)
- More sophisticated definition of exercises (difficulty, categories, etc.)
- Randomization of workouts (choose amount of time and difficulty -> generate exercise list)
- ASCII art for each exercise.
I fully welcome contributions or ideas for new features or improvements! Please leave an issue or pull request if you want to make any contributions.
Copyright (2020) Tyler Hughes Logo by Nadine Gilmer @nagilmer