garmin-golf-analytics
Pull your Garmin Connect golf rounds and turn them into numbers you can act on: measured shot distances per club, split by lie, plus a round debrief that isn't fooled by Garmin's own defaults.
Garmin already stores every shot its sensors caught. This repo reads that data through the
garminconnect API instead of asking you to download a DI_CONNECT zip by hand, then applies
the parsing rules that make the numbers trustworthy.
Why this exists
The Garmin golf data looks clean and isn't. Things that silently corrupt a naive analysis:
- No putt detection without the sensors. The watch only counts putts with the Garmin club
sensors on the putter. Without them nothing is measured: any
puttsvalue is whatever was typed in by hand, and Garmin's own default fill isputts: 2on every hole. Averaging that gives a perfect two-putt game you don't have, andsensorOnPutteris your only way to know which is which. - No per-hole par on the hole itself.
holes[].paris alwaysnull, but the pars of the course are incourseSnapshots[].holePars, a digit string ordered 1..18, in the same response. Garmin's ownscorefield is a NET score and useshandicappedStrokes, not the course handicap. - Uneven sampling. One club can read 185 m off the tee and 108 m from the fairway, because most of its fairway shots are punch-outs. Pooling the two produces a number that describes no shot you ever hit.
- Short-game pollution. A gap wedge chips from 20 m all day long. Include those in its average and it looks 40 m shorter than it plays with a full swing.
- Club identity gaps.
clubId: 0marks swings the watch could not attribute to a club. They are not a club and must never appear as one. - Partial rounds. Abandoned rounds and range sessions land in the same feed as real ones.
Install
pipx install garmin-golf-analytics
Or from a clone, with the test suite:
git clone https://github.com/etroulland/garmin-golf-analytics
cd garmin-golf-analytics
python -m venv .venv && source .venv/bin/activate
pip install -e '.[dev]'
Log in once. garminconnect writes a token store, so no credentials ever live in this repo:
python -c "from garminconnect import Garmin; Garmin().login()"
# answer the prompts once; the session is cached in ~/.garminconnect
Fetch rounds
export GARMINTOKENS=~/.garminconnect
gga-fetch # latest round only
gga-fetch --days 30 # every round played in the window
gga-fetch --scid 383676990
The same commands are available as subcommands of a single gga dispatcher:
gga fetch, gga clubs, gga rounds.
Each round becomes rounds/round_<YYYY-MM-DD>_<scid>.json:
{
"scorecard": { "startTime": "...", "strokes": 46, "handicappedStrokes": 9, "holes": [...] },
"course": { "name": "Golf Club St. Meard", "roundPar": 32, "pars": { "1": 3, "2": 3, "...": 0 } },
"shots": { "1": [{"clubId": 788036363, "meters": 181.9, "startLoc": {"lie": "TeeBox"}}] },
"playedHoles": 9
}
course comes from courseSnapshots, a sibling of scorecardDetails in the same API response.
It carries the per-hole par that holes[].par never does. pars is keyed by hole number: a
BACK_9 round lists holes 10..18, so join on the number, never on the position in the array.
Club names need Golf-CLUB.json and Golf-CLUB_TYPES.json, which only ship inside a Garmin
data export. Point --zipref (or $GARMIN_ZIPREF) at a DI-GOLF directory to get them joined in.
Club names come from the API (get_golf_club_stats), which returns every club with its
clubTypeId but never the label. --zipref is still accepted and overrides it, because only a
data export carries the loft per club. Shots whose club cannot be named are excluded from the
distance report rather than shown as clubId:<n>, which no one can act on.
Club distances
gga-clubs rounds/
gga-clubs rounds/ --lie TeeBox # shots played from the tee box, whatever the club
gga-clubs rounds/ --min-meters 40 # raise the floor to drop chips
gga-clubs rounds/ --by-shot-type # one row per (club, shot kind)
gga-clubs rounds/ --matrix # clubs x lies table, TeeBox and Fairway
gga-clubs rounds/ --matrix TeeBox,Fairway,Rough,Bunker
gga-clubs rounds/ --matrix --matrix-axis kind # columns are tee/approach/chip
Median, p75, p90 and max per club per lie, because that is how the numbers are actually usable
on the course. Clubs under 5 tracked shots are flagged (low n).
Every distance is a total distance: Garmin stores one meters value per shot, from the start
point to the end point, roll included. Carry is not in the data and is not reported.
startLoc.lie == "TeeBox" means "first shot played on that hole", not "hit from the tee": a par 4
played 5-iron then wedge tags the 5-iron TeeBox and the wedge Fairway. --by-shot-type handles
that: a first shot on a par 4 or 5 with a club short of a wood is reported as Layup (tee), a
par 3 tee shot stays Tee.
Garmin leaves a good share of tracked shots with no shotType at all. Those are kept and
classified from the lie, the par and the distance; whatever is still unresolvable closes the table
as Unclassified, with its share of the sample printed above it. It is never silently dropped.
Garmin records only a fraction of the swings you take, so n is small for a long time. Treat anything under 5 shots as noise and never let one low-n club outrank a measured one.
Round debrief
gga-rounds rounds/
Strokes per hole distribution, blow-up rate, penalties per round, and three-putt rate. Rounds with fewer than 9 played holes, or under 35 strokes on 9 / 60 on 18, are dropped as practice or abandoned before anything is averaged.
Layout
src/garmin_golf_analytics/
garmin_golf_fetch.py fetch rounds from the Garmin API
club_report.py distance tables per club, split by lie
round_report.py score, penalties, blow-up holes, putting
rounds_common.py which rounds count, shared by both reports
scoring.py per-hole par and relative score
hole_sync.py tracked shots vs scorecard reconciliation
cli.py the `gga` dispatcher
tests/ 125 tests, 97% coverage
Development
pip install -e '.[dev]'
./run_tests.sh # pytest + coverage gate at 90%
CI runs the suite on Python 3.12 to 3.14 and checks that every console script
resolves (.github/workflows/tests.yml).
License
MIT
Changelog
See CHANGELOG.md.
Metadata
Release files for garmin-golf-analytics 0.0.11
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| garmin_golf_analytics-0.0.11.tar.gz | 38.1 kB | With provenance | Details for garmin_golf_analytics-0.0.11.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| garmin_golf_analytics-0.0.11-py3-none-any.whl | Python 3 | none | any | Details for garmin_golf_analytics-0.0.11-py3-none-any.whl |
Total release size: 63.9 kB
Release files / garmin_golf_analytics-0.0.11.tar.gz
| Download URL | garmin_golf_analytics-0.0.11.tar.gz |
|---|---|
| Size | 38.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1fb99c8b2755ec6a5f49d0e5c67c1bdd3c759f53abbc0c27a7e588f8f4908974
|
|
BLAKE2b-256 checksum How to use checksums |
d57f9398cc5d736bffb3c036590087d744c8f8fd75405426367ab6068087c7d5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 29, 2026.
Transparency logRelease files / garmin_golf_analytics-0.0.11-py3-none-any.whl
| Download URL | garmin_golf_analytics-0.0.11-py3-none-any.whl |
|---|---|
| Size | 25.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
cc288b4566a90408d9260a479f0feffeb5779c14f2b2823699efa8231e754868
|
|
BLAKE2b-256 checksum How to use checksums |
b5bad4eae044d340711806719739709a29f8d450ae7323b9d71e257f399c3377
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 29, 2026.
Transparency logSecurity for garmin-golf-analytics 0.0.11
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for garmin_golf_analytics-0.0.11.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 29, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.