python-fitparse


Namepython-fitparse JSON
Version 2.0.4 PyPI version JSON
download
home_pageNone
SummaryPython library to parse ANT/Garmin .FIT files
upload_time2025-07-21 02:56:54
maintainerNone
docs_urlNone
authorNone
requires_python>=3.8
licenseMIT License Copyright (c) 2011-2025, David Cooper <david@dtcooper.com> Copyright (c) 2017-2025, 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.
keywords ant files fit garmin parse
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            python-fitparse
===============

> :warning: **NOTE:** *I have **limited to no time** to work on this package
> these days!*
> 
> I am looking for a maintainer to help with issues and updating/releasing the package.
> Please reach out via email at <david@dtcooper.com> if you have interest in helping.
>
> If you're having trouble using this package for whatever reason, might we suggest using
> an alternative library: [fitdecode](https://github.com/polyvertex/fitdecode) by
> [polyvertex](https://github.com/polyvertex).
>
> Cheers,
>
> David

Here's a Python library to parse ANT/Garmin `.FIT` files.
[![Build Status](https://github.com/dtcooper/python-fitparse/workflows/test/badge.svg)](https://github.com/dtcooper/python-fitparse/actions?query=workflow%3Atest)


Install from [![PyPI](https://img.shields.io/pypi/v/fitparse.svg)](https://pypi.python.org/pypi/fitparse/):
```
pip install fitparse
```

FIT files
------------
- FIT files contain data stored in a binary file format.
- The FIT (Flexible and Interoperable Data Transfer) file protocol is specified
  by [ANT](http://www.thisisant.com/).
- The SDK, code examples, and detailed documentation can be found in the
  [ANT FIT SDK](http://www.thisisant.com/resources/fit).


Usage
-----
A simple example of printing records from a fit file:

```python
import fitparse

# Load the FIT file
fitfile = fitparse.FitFile("my_activity.fit")

# Iterate over all messages of type "record"
# (other types include "device_info", "file_creator", "event", etc)
for record in fitfile.get_messages("record"):

    # Records can contain multiple pieces of data (ex: timestamp, latitude, longitude, etc)
    for data in record:

        # Print the name and value of the data (and the units if it has any)
        if data.units:
            print(" * {}: {} ({})".format(data.name, data.value, data.units))
        else:
            print(" * {}: {}".format(data.name, data.value))

    print("---")
```

The library also provides a `fitdump` script for command line usage:
```
$ fitdump --help
usage: fitdump [-h] [-v] [-o OUTPUT] [-t {readable,json}] [-n NAME] [--ignore-crc] FITFILE

Dump .FIT files to various formats

positional arguments:
  FITFILE               Input .FIT file (Use - for stdin)

optional arguments:
  -h, --help            show this help message and exit
  -v, --verbose
  -o OUTPUT, --output OUTPUT
                        File to output data into (defaults to stdout)
  -t {readable,json}, --type {readable,json}
                        File type to output. (DEFAULT: readable)
  -n NAME, --name NAME  Message name (or number) to filter
  --ignore-crc          Some devices can write invalid crc's, ignore these.
```

See the documentation for more: http://dtcooper.github.io/python-fitparse


Major Changes From Original Version
-----------------------------------

After a few years of laying dormant we are back to active development!
The old version is archived as
[`v1-archive`](https://github.com/dtcooper/python-fitparse/releases/tag/v1-archive).

  * New, hopefully cleaner public API with a clear division between accessible
    and internal parts. (Still unstable and partially complete.)

  * Proper documentation!
    [Available here](https://dtcooper.github.io/python-fitparse/).

  * Unit tests and example programs.

  * **(WIP)** Command line tools (eg a `.FIT` to `.CSV` converter).

  * Component fields and compressed timestamp headers now supported and not
    just an afterthought. Closes issues #6 and #7.

  * FIT file parsing is generic enough to support all types. Going to have
    specific `FitFile` subclasses for more popular file types like activities.

  * **(WIP)** Converting field types to normalized values (for example,
    `bool`, `date_time`, etc) done in a consistent way, that's easy to
    customize by subclassing the converter class. I'm going to use something
    like the Django form-style `convert_<field name>` idiom on this class.

  * The FIT profile is its own complete python module, rather than using
    `profile.def`.

    * Bonus! The profile generation script is _less_ ugly (but still an
      atrocity) and supports every
      [ANT FIT SDK](http://www.thisisant.com/resources/fit) from version 1.00
      up to 5.10.

  * A working `setup.py` module. Closes issue #2, finally! I'll upload the
    package to [PyPI](http://pypi.python.org/) when it's done.

  * Support for parsing one record at a time. This can be done using
    `<FitFile>.parse_one()` for now, but I'm not sure of the exact
    implementation yet.


Updating to new FIT SDK versions
--------------------------------
- Download the latest [ANT FIT SDK](http://www.thisisant.com/resources/fit).
- Update the profile:
```
python3 scripts/generate_profile.py /path/to/fit_sdk.zip fitparse/profile.py
```


License
-------

This project is licensed under the MIT License - see the [`LICENSE`](LICENSE)
file for details.

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "python-fitparse",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": "ant, files, fit, garmin, parse",
    "author": null,
    "author_email": "David Cooper <dave@kupesoft.com>, nbr23 <max@23.tf>",
    "download_url": "https://files.pythonhosted.org/packages/6e/9b/eaa485b827856228a8342767dce36c61a8e30172e9a1991df8839d33ebbe/python_fitparse-2.0.4.tar.gz",
    "platform": null,
    "description": "python-fitparse\n===============\n\n> :warning: **NOTE:** *I have **limited to no time** to work on this package\n> these days!*\n> \n> I am looking for a maintainer to help with issues and updating/releasing the package.\n> Please reach out via email at <david@dtcooper.com> if you have interest in helping.\n>\n> If you're having trouble using this package for whatever reason, might we suggest using\n> an alternative library: [fitdecode](https://github.com/polyvertex/fitdecode) by\n> [polyvertex](https://github.com/polyvertex).\n>\n> Cheers,\n>\n> David\n\nHere's a Python library to parse ANT/Garmin `.FIT` files.\n[![Build Status](https://github.com/dtcooper/python-fitparse/workflows/test/badge.svg)](https://github.com/dtcooper/python-fitparse/actions?query=workflow%3Atest)\n\n\nInstall from [![PyPI](https://img.shields.io/pypi/v/fitparse.svg)](https://pypi.python.org/pypi/fitparse/):\n```\npip install fitparse\n```\n\nFIT files\n------------\n- FIT files contain data stored in a binary file format.\n- The FIT (Flexible and Interoperable Data Transfer) file protocol is specified\n  by [ANT](http://www.thisisant.com/).\n- The SDK, code examples, and detailed documentation can be found in the\n  [ANT FIT SDK](http://www.thisisant.com/resources/fit).\n\n\nUsage\n-----\nA simple example of printing records from a fit file:\n\n```python\nimport fitparse\n\n# Load the FIT file\nfitfile = fitparse.FitFile(\"my_activity.fit\")\n\n# Iterate over all messages of type \"record\"\n# (other types include \"device_info\", \"file_creator\", \"event\", etc)\nfor record in fitfile.get_messages(\"record\"):\n\n    # Records can contain multiple pieces of data (ex: timestamp, latitude, longitude, etc)\n    for data in record:\n\n        # Print the name and value of the data (and the units if it has any)\n        if data.units:\n            print(\" * {}: {} ({})\".format(data.name, data.value, data.units))\n        else:\n            print(\" * {}: {}\".format(data.name, data.value))\n\n    print(\"---\")\n```\n\nThe library also provides a `fitdump` script for command line usage:\n```\n$ fitdump --help\nusage: fitdump [-h] [-v] [-o OUTPUT] [-t {readable,json}] [-n NAME] [--ignore-crc] FITFILE\n\nDump .FIT files to various formats\n\npositional arguments:\n  FITFILE               Input .FIT file (Use - for stdin)\n\noptional arguments:\n  -h, --help            show this help message and exit\n  -v, --verbose\n  -o OUTPUT, --output OUTPUT\n                        File to output data into (defaults to stdout)\n  -t {readable,json}, --type {readable,json}\n                        File type to output. (DEFAULT: readable)\n  -n NAME, --name NAME  Message name (or number) to filter\n  --ignore-crc          Some devices can write invalid crc's, ignore these.\n```\n\nSee the documentation for more: http://dtcooper.github.io/python-fitparse\n\n\nMajor Changes From Original Version\n-----------------------------------\n\nAfter a few years of laying dormant we are back to active development!\nThe old version is archived as\n[`v1-archive`](https://github.com/dtcooper/python-fitparse/releases/tag/v1-archive).\n\n  * New, hopefully cleaner public API with a clear division between accessible\n    and internal parts. (Still unstable and partially complete.)\n\n  * Proper documentation!\n    [Available here](https://dtcooper.github.io/python-fitparse/).\n\n  * Unit tests and example programs.\n\n  * **(WIP)** Command line tools (eg a `.FIT` to `.CSV` converter).\n\n  * Component fields and compressed timestamp headers now supported and not\n    just an afterthought. Closes issues #6 and #7.\n\n  * FIT file parsing is generic enough to support all types. Going to have\n    specific `FitFile` subclasses for more popular file types like activities.\n\n  * **(WIP)** Converting field types to normalized values (for example,\n    `bool`, `date_time`, etc) done in a consistent way, that's easy to\n    customize by subclassing the converter class. I'm going to use something\n    like the Django form-style `convert_<field name>` idiom on this class.\n\n  * The FIT profile is its own complete python module, rather than using\n    `profile.def`.\n\n    * Bonus! The profile generation script is _less_ ugly (but still an\n      atrocity) and supports every\n      [ANT FIT SDK](http://www.thisisant.com/resources/fit) from version 1.00\n      up to 5.10.\n\n  * A working `setup.py` module. Closes issue #2, finally! I'll upload the\n    package to [PyPI](http://pypi.python.org/) when it's done.\n\n  * Support for parsing one record at a time. This can be done using\n    `<FitFile>.parse_one()` for now, but I'm not sure of the exact\n    implementation yet.\n\n\nUpdating to new FIT SDK versions\n--------------------------------\n- Download the latest [ANT FIT SDK](http://www.thisisant.com/resources/fit).\n- Update the profile:\n```\npython3 scripts/generate_profile.py /path/to/fit_sdk.zip fitparse/profile.py\n```\n\n\nLicense\n-------\n\nThis project is licensed under the MIT License - see the [`LICENSE`](LICENSE)\nfile for details.\n",
    "bugtrack_url": null,
    "license": "MIT License\n        \n        Copyright (c) 2011-2025, David Cooper <david@dtcooper.com>\n        Copyright (c) 2017-2025, Carey Metcalfe <carey@cmetcalfe.ca>\n        \n        Permission is hereby granted, free of charge, to any person obtaining a copy\n        of this software and associated documentation files (the \"Software\"), to deal\n        in the Software without restriction, including without limitation the rights\n        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n        copies of the Software, and to permit persons to whom the Software is\n        furnished to do so, subject to the following conditions:\n        \n        The above copyright notice and this permission notice shall be included in all\n        copies or substantial portions of the Software.\n        \n        THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n        SOFTWARE.",
    "summary": "Python library to parse ANT/Garmin .FIT files",
    "version": "2.0.4",
    "project_urls": {
        "Homepage": "https://www.github.com/nbr23/python-fitparse",
        "Issues": "https://github.com/nbr23/python-fitparse/issues",
        "Repository": "https://www.github.com/nbr23/python-fitparse"
    },
    "split_keywords": [
        "ant",
        " files",
        " fit",
        " garmin",
        " parse"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "4fe61bcf040c56db3a49299be8a7e3708283d7d0118995485ec2b0f3f780fec4",
                "md5": "4e93f04ca2abbdad6ec8e105a952fbf1",
                "sha256": "b7b76664642e2d96c1eb64da33fe47f3699d3d96237ba8f51b103d188aa55852"
            },
            "downloads": -1,
            "filename": "python_fitparse-2.0.4-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "4e93f04ca2abbdad6ec8e105a952fbf1",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 93394,
            "upload_time": "2025-07-21T02:56:52",
            "upload_time_iso_8601": "2025-07-21T02:56:52.756880Z",
            "url": "https://files.pythonhosted.org/packages/4f/e6/1bcf040c56db3a49299be8a7e3708283d7d0118995485ec2b0f3f780fec4/python_fitparse-2.0.4-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "6e9beaa485b827856228a8342767dce36c61a8e30172e9a1991df8839d33ebbe",
                "md5": "8de854a0cff47ed1fd31062fda9123f2",
                "sha256": "4894cb0e374657b14e1967efd906b92ddff150840ee3d3b35450acdc68fb3806"
            },
            "downloads": -1,
            "filename": "python_fitparse-2.0.4.tar.gz",
            "has_sig": false,
            "md5_digest": "8de854a0cff47ed1fd31062fda9123f2",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 97773,
            "upload_time": "2025-07-21T02:56:54",
            "upload_time_iso_8601": "2025-07-21T02:56:54.219955Z",
            "url": "https://files.pythonhosted.org/packages/6e/9b/eaa485b827856228a8342767dce36c61a8e30172e9a1991df8839d33ebbe/python_fitparse-2.0.4.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-07-21 02:56:54",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "nbr23",
    "github_project": "python-fitparse",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "python-fitparse"
}
        
Elapsed time: 2.57805s