Skip to main content

Fast FIT to GPX converter - replacement for fit2gpx

Project description

fit2gpx-lightning

Simple replacement for the fit2gpx Python library with 400x performance improvements thanks to Rust and parallel processing. I closely mirrored the original fit2gpx API for easy adoption (with a few adaptations and additions).

View Full API Reference →

PyPI PyPI - Python Version

My motivation here was to both expose the wonderful Rust fit2gpx in python to make it more accessible for those of us who are more comfortable scripting in python. The orignal python fit2gpx library is quite slow for bulk conversions and also doesn't have a simple way to process Garmin bulk exports, only Strava. Here, we fix both those issues

[!NOTE] AI Disclaimer: I did use Claude Code for significant portions of the coding and documentation, though I made quite a few manual changes to the final output. I would categorize this as "AI assisted coding" not "Vibecoded." Could I have done this all myself? Yes. Would it have taken too long for me to bother doing. Also yes.

Features

  • Convert .fit files to GPX format, one at a time or an entire folder at once
  • Extract all activity tracks as GPX from Strava bulk export ZIPs
    • Supports .fit, .fit.gz, .gpx.gz, and .gpx files in source ZIP
    • Inject activity names and types from activities.csv
  • Extract and convert FIT files to GPX from Garmin bulk export ZIPs
    • Matches FIT files to activity metadata from summarizedActivities.json (Activity title, distance)

Limitations

  • We don't support output to pandas Dataframes, which the original fit2gpx library does.

Installation

pip install fit2gpx-lightning

I have tried to include pre-built wheels for common platforms (Linux x86_64, Linux aarch64, macOS x86_64, macOS arm64, Windows x86_64). If you have trouble installing, please open an issue with your platform details and I will see if I can add support.

Quick Start

Simple Conversion

from fit2gpx_lightning import fit_to_gpx, fit_to_gpx_bulk

# Convert a single file
fit_to_gpx('activity.fit', 'activity.gpx')

# Convert an entire directory 
# (processes immediate children only)
stats = fit_to_gpx_bulk('./fit_files/', './gpx_files/')
print(f"✓ Converted {stats['converted']} out of {stats['total']} files")
print(f"✗ Failed: {stats['failed']}")

Strava Export Processing

The strava_fit_to_gpx function not only converts .fit files, but also unzips and converts .fit.gz files, extracts .gpx.gz files, and copies .gpx.

Designed to process the archive downloaded from Strava's "Download or Delete Your Data" page.

Complete example processing a Strava export:

from fit2gpx_lightning import StravaConverter

# Initialize converter with your Strava export ZIP path
converter = StravaConverter('strava_export.zip')

# Step 1: Convert FIT files to GPX
stats = converter.strava_fit_to_gpx('./gpx_output/')
print(f"✓ Converted: {stats['converted']}")
print(f"✗ Failed: {stats['failed']}")

# Step 2: Add metadata (activity names, types) from activities.csv. In place modification
converter.add_metadata_to_gpx('./gpx_output/')

Garmin Export Processing

Complete example processing a Garmin export. You can download your data from Garmin's Data Management page.

from fit2gpx_lightning import GarminConverter

# Initialize converter with your Garmin export ZIP
converter = GarminConverter('garmin_export.zip')

# Step 1: Convert to GPX with automatic metadata matching
# Matches FIT files to activities by timestamp (±10 second tolerance)
stats = converter.garmin_fit_to_gpx('./gpx_output/')
print(f"✓ Converted: {stats['converted']}")
print(f"✗ Failed: {stats['failed']}")

# Optional: Update metadata for already-converted files
converter.add_metadata_to_gpx('./gpx_output/')

Performance

Benchmark converting my Strava export of 1354 activities.

Library Time Throughput Speedup
fit2gpx (Python) 9 m 25.9s 2.7 files/s 1x (baseline)
fit2gpx-lightning 1.39s 971.8 files/s 406.1x

Development

Building from Source

# Install Rust (if not already installed)
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

# Clone repository
git clone https://github.com/bobby060/fit2gpx-lightning
cd fit2gpx-lightning/fit2gpx-lightning

# Install maturin (Python build tool for Rust extensions)
pip install maturin

# Build and install in development mode
maturin develop --release

Running Tests

Integration tests won't pass unless you download your data and move some .fit files to the test_data/ folder. Strava export zip should be named strava.zip and Garmin export zip should be named garmin.zip.

# Rust unit and integration tests
cargo test

# With output
cargo test -- --nocapture

# Specific test
cargo test test_strava

# Python tests (after maturin develop)
python -m pytest tests/

Contributing

Contributions are welcome!

For feature suggestions or errors, open an issue.

Changelog

v0.1.2 (2025-12-27)

  • Update documentation for clarity
  • Minor code refactoring for readability
  • Add support for aarch64 Linux wheels in CI/CD pipeline

v0.1.1 (2025-12-24)

  • Use abi3 feature of PyO3 to build wheels compatible with multiple Python 3.x versions
  • Updated CI/CD pipeline to build abi3 wheels for Python 3.8+

v0.1.0 (2025-12-24)

Initial Release

  • Core FIT to GPX conversion functions
  • Strava export support (.fit.gz, activities.csv)
  • Garmin export support (nested ZIPs, summarizedActivities.json)
  • Parallel processing for bulk operations
  • Metadata injection from CSV and JSON
  • Python bindings via PyO3
  • CI/CD pipeline for multi-platform wheels
  • Comprehensive documentation and examples
  • Unit testing in rust and integration testing in Python using full exports downloaded in December 2025.

Support

  • Documentation: This README + inline code documentation
  • Issues: GitHub Issues

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

fit2gpx_lightning-0.1.2-cp38-abi3-win_amd64.whl (929.8 kB view details)

Uploaded CPython 3.8+Windows x86-64

fit2gpx_lightning-0.1.2-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.2 MB view details)

Uploaded CPython 3.8+manylinux: glibc 2.17+ x86-64

fit2gpx_lightning-0.1.2-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (1.1 MB view details)

Uploaded CPython 3.8+manylinux: glibc 2.17+ ARM64

fit2gpx_lightning-0.1.2-cp38-abi3-macosx_11_0_arm64.whl (994.4 kB view details)

Uploaded CPython 3.8+macOS 11.0+ ARM64

fit2gpx_lightning-0.1.2-cp38-abi3-macosx_10_12_x86_64.whl (1.1 MB view details)

Uploaded CPython 3.8+macOS 10.12+ x86-64

File details

Details for the file fit2gpx_lightning-0.1.2-pp310-pypy310_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for fit2gpx_lightning-0.1.2-pp310-pypy310_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 f310918ce96ca25a0c6201f309f97cfc85860dbd454fbe3fb883edc446b5426e
MD5 4ede992f955388c690edf46cc12fb3d2
BLAKE2b-256 c372b1349deb296bf4087fd6de836199b9feb89cdf99fb18000a0b202899a564

See more details on using hashes here.

File details

Details for the file fit2gpx_lightning-0.1.2-pp39-pypy39_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for fit2gpx_lightning-0.1.2-pp39-pypy39_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 31de83e59c0286a97a0f04a1766c86cd5cb96c3b0606ba0d68f53f3154f833a1
MD5 c8dac42f4724989eed54ebf25ddfcf97
BLAKE2b-256 294ae2d6a61790b2d68dab10735601529f5cd47291e5a63e995df0498df9833a

See more details on using hashes here.

File details

Details for the file fit2gpx_lightning-0.1.2-pp38-pypy38_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for fit2gpx_lightning-0.1.2-pp38-pypy38_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 fb600656d86ba12ac25a1c730cec9171565d9aa8ad0f4b5b2612699dfe16afbc
MD5 b8a5cc7653141d263d885199469d6d2e
BLAKE2b-256 e4a9682cdc33792723f2b34ebac55a80aa4910d46a81c6ec13c3ba624d5c8c07

See more details on using hashes here.

File details

Details for the file fit2gpx_lightning-0.1.2-pp37-pypy37_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for fit2gpx_lightning-0.1.2-pp37-pypy37_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 ed78152a3be7534ee4e2f63503fcd0e6d11d82e3a64522d30f2ae6d5e14d3b55
MD5 e20be40012eac1258d07f29384ae035d
BLAKE2b-256 4b8324013a68c4989e8834d3011c3bc43acb7ea6a94247c7dfe20deefc4879de

See more details on using hashes here.

File details

Details for the file fit2gpx_lightning-0.1.2-cp38-abi3-win_amd64.whl.

File metadata

File hashes

Hashes for fit2gpx_lightning-0.1.2-cp38-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 7477741c372ba79338455d54ac07ff46dfbde2590fac70bc97c2124213792693
MD5 f6fc961d331d737d1220526da51df570
BLAKE2b-256 d00c0652033d7a72f5b566d1c2b923f506b0d5426d45bae0aefe6208e0f89ae2

See more details on using hashes here.

File details

Details for the file fit2gpx_lightning-0.1.2-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for fit2gpx_lightning-0.1.2-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 906aab00a2af27519c17b0c73d0111ade2fe538c086c9dfffe405c9f406d7e74
MD5 fbe5e71462318e3c825ff67e48f8a5c3
BLAKE2b-256 a4b6b9c3c0c2a31b392326836f4de39709dc8f3f17907fa2dadf4fa7bc198881

See more details on using hashes here.

File details

Details for the file fit2gpx_lightning-0.1.2-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for fit2gpx_lightning-0.1.2-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 e859a552363f6f89d174cb346d305352e259fe11e974f286f54cae50d2ff3e03
MD5 c69286cba24833fbb6bb8d0ac8779a82
BLAKE2b-256 4a884e1e0c51e9a4805de71e75de39fa20a9f14fcf075ba238f62c18fb8d40f7

See more details on using hashes here.

File details

Details for the file fit2gpx_lightning-0.1.2-cp38-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for fit2gpx_lightning-0.1.2-cp38-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 26efc2be1909fb3342dbcbaa9d359a4d222f751dba5c6dfc57fa7f10e9ba2fa6
MD5 5978ecc9771a2419e0b1209becd68362
BLAKE2b-256 3fbf41ab425b367518929aa8f3362f780943377e8e28717109f2023e5102f60f

See more details on using hashes here.

File details

Details for the file fit2gpx_lightning-0.1.2-cp38-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for fit2gpx_lightning-0.1.2-cp38-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 6ce3b59826112a494cbfcc3e49743f686b7d74a34264b57ed9a6a0ceffd99ad2
MD5 ba8e88009bfd3a185d1a0391c8446ee5
BLAKE2b-256 5bbc9fd556a72d8e813d04eb02fb8ba4a8818ec38b51c5b071c904c591981c9f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page