Skip to main content

Fast FIT file parser using Rust, exposed to Python via PyO3

Project description

pyfitparsernative

Fast FIT file parser using Rust, exposed to Python via PyO3.

Parses Garmin FIT activity files using the fitparser Rust crate. Approximately 8x faster than garmin-fit-sdk (Python).

Parser Time (81km / 11,555 records) Speedup
garmin-fit-sdk (Python) ~2.0s 1x
pyfitparsernative (Rust) ~0.25s ~8x

Installation

pip install pyfitparsernative

No Rust toolchain required — pre-built wheels are provided for Linux (glibc and musl), macOS (Intel and Apple Silicon), and Windows (x64). The macOS Intel (x86_64) wheel is cross-compiled and not tested in CI since GitHub no longer offers Intel macOS runners.

Usage

from pyfitparsernative import parse_fit_file, parse_fit_bytes

# Parse from a file path
messages = parse_fit_file("activity.fit")

# Parse from bytes
with open("activity.fit", "rb") as f:
    messages = parse_fit_bytes(f.read())

Return type: list[dict[str, Any]]

Returns a flat list of message dicts in original FIT file order. Each dict includes a "message_type" key (e.g. "record", "session", "lap") alongside the field data. Timestamps are returned as naive ISO 8601 strings (YYYY-MM-DDTHH:MM:SS).

# Example: get average power from session message
session = [m for m in messages if m["message_type"] == "session"][0]
print(session["avg_power"])    # 160
print(session["max_power"])    # 489

# Example: iterate record (data) messages
for msg in messages:
    if msg["message_type"] == "record":
        print(msg["timestamp"], msg.get("power"), msg.get("heart_rate"))

Differences from garmin-fit-sdk

pyfitparsernative returns the same field names and numeric values as garmin-fit-sdk, with the following differences:

  • Timestamps — returned as naive ISO 8601 strings instead of timezone-aware datetime objects.
  • Enum fields — returned as raw integers instead of string labels.
  • Message types — no _mesgs suffix (e.g. "session" not "session_mesgs").
  • Developer fields — garmin-fit-sdk uses integer dict keys for developer fields (e.g. {61: 2554}); pyfitparsernative uses string keys ({"unknown_field_61": 2554}).
  • Component field expansion — garmin-fit-sdk derives speed and altitude from the more precise enhanced_speed/enhanced_altitude fields when the base fields are absent from the message definition. pyfitparsernative applies the same expansion, so "speed" and "altitude" are always present in record messages alongside their enhanced_ counterparts.
  • Unknown message types — fitparser may not recognise every global message number in its profile. Unknown types that are known to the FIT SDK are remapped to their standard names (e.g. message number 13 → "training_settings").

Building from source

The docker/ directory contains scripts to build and test inside containers, avoiding the need for a local Rust toolchain. These are for local development only; CI/CD uses its own pipeline.

Build — compiles the wheel inside rust:1.93.1-trixie and writes it to dist/:

bash docker/docker-build.sh

Test — runs the test suite inside python:3.14.3-trixie against the wheel in dist/:

bash docker/docker-test.sh

On Windows, run these from Git Bash or WSL. Docker Desktop must be running with Linux containers enabled.

Releasing

Push a tag to trigger the CI/CD pipeline, which builds wheels for all platforms and publishes to PyPI:

git tag v0.1.0 && git push --tags

See .github/workflows/CI.yml for the full build matrix.

Project details


Download files

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

Source Distribution

pyfitparsernative-0.1.0.tar.gz (377.6 kB view details)

Uploaded Source

Built Distributions

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

pyfitparsernative-0.1.0-pp310-pypy310_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (584.2 kB view details)

Uploaded PyPymanylinux: glibc 2.17+ ARM64

pyfitparsernative-0.1.0-pp39-pypy39_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (585.9 kB view details)

Uploaded PyPymanylinux: glibc 2.17+ ARM64

pyfitparsernative-0.1.0-cp39-abi3-win_amd64.whl (599.3 kB view details)

Uploaded CPython 3.9+Windows x86-64

pyfitparsernative-0.1.0-cp39-abi3-musllinux_1_2_x86_64.whl (861.6 kB view details)

Uploaded CPython 3.9+musllinux: musl 1.2+ x86-64

pyfitparsernative-0.1.0-cp39-abi3-musllinux_1_2_aarch64.whl (762.6 kB view details)

Uploaded CPython 3.9+musllinux: musl 1.2+ ARM64

pyfitparsernative-0.1.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (652.1 kB view details)

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

pyfitparsernative-0.1.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (585.3 kB view details)

Uploaded CPython 3.9+manylinux: glibc 2.17+ ARM64

pyfitparsernative-0.1.0-cp39-abi3-macosx_11_0_arm64.whl (571.4 kB view details)

Uploaded CPython 3.9+macOS 11.0+ ARM64

pyfitparsernative-0.1.0-cp39-abi3-macosx_10_12_x86_64.whl (570.7 kB view details)

Uploaded CPython 3.9+macOS 10.12+ x86-64

File details

Details for the file pyfitparsernative-0.1.0.tar.gz.

File metadata

  • Download URL: pyfitparsernative-0.1.0.tar.gz
  • Upload date:
  • Size: 377.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pyfitparsernative-0.1.0.tar.gz
Algorithm Hash digest
SHA256 1f08bb1f084f5126425200bc152acc8e0040d19e0e49615a8e5551847f689fdc
MD5 dd0a28e929479ea7df6cf700caa599ac
BLAKE2b-256 76f2aec534d5d0d38dd2f7585522152fc66d606ad4901b432311339dcf3a0e1f

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyfitparsernative-0.1.0.tar.gz:

Publisher: CI.yml on GedRap/pyfitparsernative

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pyfitparsernative-0.1.0-pp310-pypy310_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyfitparsernative-0.1.0-pp310-pypy310_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 81003e0e0af613685bb2855488d0893be33aa422473725f6a9d7b91aa1595e66
MD5 edb128be33821466102f2f956573e9fe
BLAKE2b-256 7060aa6c454ac2025a4ddbcbfe05d9a3297fe1fb2f5c1376d81583ff7fbc42ab

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyfitparsernative-0.1.0-pp310-pypy310_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:

Publisher: CI.yml on GedRap/pyfitparsernative

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pyfitparsernative-0.1.0-pp39-pypy39_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyfitparsernative-0.1.0-pp39-pypy39_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 c9c454b66919b534a9183d270d2489d69349f981af511a67b759b52fa98adce7
MD5 cae63a031d68c8f75890abe4f8d2667a
BLAKE2b-256 bcb0fc7e7e050da6d88752a08f6978e86ec31d3563a2ce9ed3fe74f7f6f0599c

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyfitparsernative-0.1.0-pp39-pypy39_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:

Publisher: CI.yml on GedRap/pyfitparsernative

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pyfitparsernative-0.1.0-cp39-abi3-win_amd64.whl.

File metadata

File hashes

Hashes for pyfitparsernative-0.1.0-cp39-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 25f1ea963918345af5e1cdc727340c8c312d6514c36a9a34f5abfabaebc82d77
MD5 9f972ef1896aef3e3bc8c8d2264149af
BLAKE2b-256 ec05d8c92de5729a763e1ef8cb6b37fb2c0b900e3f9a4ca50d6f5988d8e5d4e8

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyfitparsernative-0.1.0-cp39-abi3-win_amd64.whl:

Publisher: CI.yml on GedRap/pyfitparsernative

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pyfitparsernative-0.1.0-cp39-abi3-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for pyfitparsernative-0.1.0-cp39-abi3-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 b369f06c1fabceb3b4f78388352e524d3daf7fa17c103f4ddd5af0a2fa9c87b1
MD5 3b9a22edd222b9e18bedafe261e79ba3
BLAKE2b-256 14dbe2a8d671ae90abc843de3767cc47c8ec769361129b1b362fdefe5a1a0236

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyfitparsernative-0.1.0-cp39-abi3-musllinux_1_2_x86_64.whl:

Publisher: CI.yml on GedRap/pyfitparsernative

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pyfitparsernative-0.1.0-cp39-abi3-musllinux_1_2_aarch64.whl.

File metadata

File hashes

Hashes for pyfitparsernative-0.1.0-cp39-abi3-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 26a1081dadc189151ff9df371e403b123a90d3a87790f1f561d23b4ca63f03ec
MD5 a6d3c27f9b09c1a9327c407517e312ec
BLAKE2b-256 3270abcfea12992b84f6e43522815616887f739daffd0df84d59bffdd1064ee4

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyfitparsernative-0.1.0-cp39-abi3-musllinux_1_2_aarch64.whl:

Publisher: CI.yml on GedRap/pyfitparsernative

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pyfitparsernative-0.1.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyfitparsernative-0.1.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 3ec567918b4e471f20c48ae4cbd8038d3a783c507ac2e70b5d2afc2e4e0e0170
MD5 d7054e64a12ad91a7ce9318259150c51
BLAKE2b-256 db3ce234066a640f2d516e2116c409a07efbe017a9b1d453402b27726b1b4fef

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyfitparsernative-0.1.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: CI.yml on GedRap/pyfitparsernative

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pyfitparsernative-0.1.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyfitparsernative-0.1.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 911084de7e03a74ebe35139753f03eb044963f4325a00be26a5f710bebc1ad1c
MD5 f6ed319c4de6a22d789b4201df533146
BLAKE2b-256 1d2732f721b90720e0111afa6d61b6fccb25cdcb33bdd0f9701fcda659a813c4

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyfitparsernative-0.1.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:

Publisher: CI.yml on GedRap/pyfitparsernative

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pyfitparsernative-0.1.0-cp39-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyfitparsernative-0.1.0-cp39-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 3c5fb4c145802bba2bab8ec5f8a57aa2a9c95bef49686f64442dccd2e6fccb88
MD5 f6f913801adaa9296609851201b4294a
BLAKE2b-256 edb758d536ee116b82657ca8e9e656941ce7f55def91ff387ea127e5e2a18335

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyfitparsernative-0.1.0-cp39-abi3-macosx_11_0_arm64.whl:

Publisher: CI.yml on GedRap/pyfitparsernative

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pyfitparsernative-0.1.0-cp39-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for pyfitparsernative-0.1.0-cp39-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 7b8506f67b748ed6cf859405a871d003fe540b8d9bc122a27e206c508475b15a
MD5 dbcf17f75e4a070f33d3b65f4e784702
BLAKE2b-256 c75dcb421bcd4970abfaccac7e79a8d8a72f61947d8a88f47fcdaab0ae608e57

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyfitparsernative-0.1.0-cp39-abi3-macosx_10_12_x86_64.whl:

Publisher: CI.yml on GedRap/pyfitparsernative

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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