python-fitparse Documention

Introduction

The fitparse module is a Python library for parsing ANT/Garmin .FIT files.

The FIT (Flexible and Interoperable Data Transfer) file protocol is specified by ANT in its FIT SDK. It’s a common file format used internally on embedded fitness computers, for example on the Edge and Forerunner series of Garmin products.

Quickstart Guide

TODO

Installation

Using pip

The easiest way to grab fitparse is using pip,

$ pip install fitparse

From github

Navigate to dtcooper/python-fitparse on github and clone the latest version:

$ git clone git@github.com:dtcooper/python-fitparse.git
$ cd python-fitparse
$ python setup.py install

Requirements

The following are required to install fitparse,

  • Python 2.5 and above (Python 3 is currently not supported)

  • The argparse is required for the fitdump command, but it is included in the Python standard library as of version 2.7. Using pip to install the package will install this if needed.

API Documentation

If you are looking for information on a specific function, class or method, this part of the documentation is for you.

Usage Examples

Here’s a simple program to print all the record fields in an activity file:

from fitparse import FitFile


fitfile = FitFile('/home/dave/garmin-activities/2012-12-19-16-14-54.fit')

# Get all data messages that are of type record
for record in fitfile.get_messages('record'):

    # Go through all the data entries in this record
    for record_data in record:

        # Print the records name and value (and units if it has any)
        if record_data.units:
            print(" * %s: %s %s" % (
                record_data.name, record_data.value, record_data.units,
            ))
        else:
            print(" * %s: %s" % (record_data.name, record_data.value))
    print()

License

MIT License

Copyright (c) 2011-2020, David Cooper <david@dtcooper.com>
Copyright (c) 2017-2020, Carey Metcalfe <carey@cmetcalfe.ca>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.