This is a simple script that allows you to login to Garmin Connect and track your current run streak.
First, you should install nix. Not strictly necessary, but it makes things easier. Otherwise, you will need to install the dependencies manually.
- python3
- poetry
If you want to have a simple development experience, you can install nix.
Then, you can use the nix develop command to drop into a shell with all the dependencies installed.
- nix
- direnv
direnvis a shell extension that will automatically load the nix environment when you enter the directory.
- devenv
devenvis a convenient nix-powered development environment manager.
- just
justis a command runner. It is similar tomake, but it is written in rust and has a nicer syntax.- run
just -lto see what tasks are supported
This one liner will install the dependencies and drop you into a shell with them available.
nix develop --impureFrom there, you can run just -l to see what tasks are supported.
In order to use this script, you need to login to Garmin Connect and save the session tokens. This project uses cyberjunky/python-garminconnect (which uses matin/garth for auth). You will be prompted for your email and password.
Assuming you are already in the nix development environment, you can run the following command to login.
just loginOnce you have the login tokens, you can save them in .env.local. The .envrc file will automatically load this file, if it exists. See .env for the required variables.
If you are not in the devenv shell, you can run this one-liner to login. This is how the GitHub Action works (although that doesn't use the login command; see below).
nix develop --impure --command just loginIf you have done a run today, you can run the following command to update your streak.
just ranAnd if you aren't in the devenv shell:
nix develop --impure --command just ran