Skip to main content

Simple parser for Garmin TCX files

Project description

Requirement Updates

python-tcxparser is a minimal parser for Garmin’s TCX file format. It is not in any way exhaustive. It extracts just enough data to allow me to post data from my Garmin ForeRunner 410 watch to DailyMile’s API.

Data extracted:
  • latitude & longitude of start point of workout

  • type of workout (running, walking, etc)

  • time of completion of workout (in ISO UTC)

  • distance of workout (in meters)

  • duration of workout (in seconds)

  • calories burned during workout (as estimated by device)

  • average, max and min heart rate during workout

  • average pace during workout

  • average altitude during workout

  • ascent and descent of workout

  • max and min altitude

  • time stamp of each data point (in ISO UTC)

  • average and max cadence (cycling activities)

Installation

Install it from PyPI:

pip install python-tcxparser

Usage

Basic usage example:

>>> import tcxparser
>>> tcx = tcxparser.TCXParser('/home/vinod/Downloads/20121226-212953.tcx')
>>> # Duration of workout in seconds
... tcx.duration
1992.78
>>> # latitude/longitude at start of workout
... tcx.latitude
35.951880198
>>> tcx.longitude
-79.0931872185
>>> tcx.activity_type
'running'
>>> # ISO UTC timestamp when workout completed
... tcx.completed_at
'2012-12-26T22:03:05Z'
>>> # distance of workout in meters
... tcx.distance
4686.31103516
>>> tcx.distance_units
'meters'
>>> # calories burned (as reported by device)
... tcx.calories
379

Compatibility

License

  • BSD

Maintainer Information

We use Github Actions to lint (using pre-commit, black, isort, and flake8), test (using tox and tox-gh-actions), and calculate coverage (using coverage).

We have a local script to do these actions locally, named maintain.sh:

$ ./maintain.sh

A Github Action workflow also builds and pushes a new package to PyPI whenever a new Release is created in Github. This uses a project-specific PyPI token, as described in the PyPI documentation here. That token has been saved in the PYPI_PASSWORD settings for this repo, but has not been saved anywhere else so if it is needed for any reason, the current one should be deleted and a new one generated.

As always, be sure to bump the version in setup.py before creating a Release, so that the proper version gets pushed to PyPI.

Contact

Please contact me with any questions: Vinod Kurup (vinod@kurup.com)

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

python-tcxparser-2.0.0.tar.gz (412.9 kB view details)

Uploaded Source

Built Distribution

python_tcxparser-2.0.0-py2.py3-none-any.whl (6.3 kB view details)

Uploaded Python 2Python 3

File details

Details for the file python-tcxparser-2.0.0.tar.gz.

File metadata

  • Download URL: python-tcxparser-2.0.0.tar.gz
  • Upload date:
  • Size: 412.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.9.0

File hashes

Hashes for python-tcxparser-2.0.0.tar.gz
Algorithm Hash digest
SHA256 fcfbb0a2b8f1d846be8afb59be544e370060cc9258a8a329ef4a806d5460a1b7
MD5 99476f99f6a0fe5e28d804a6ba6d4c8a
BLAKE2b-256 cf42570bb4177f4c8953af758a34a95a4163b374068601513bd670dcc9da03d9

See more details on using hashes here.

File details

Details for the file python_tcxparser-2.0.0-py2.py3-none-any.whl.

File metadata

  • Download URL: python_tcxparser-2.0.0-py2.py3-none-any.whl
  • Upload date:
  • Size: 6.3 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.9.0

File hashes

Hashes for python_tcxparser-2.0.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 1790cd63bac22c2345ad64cc597fbc9d31677e8c2c0104e03dcb6a76e5451804
MD5 17c823cee8102b1072ab659f70a15dec
BLAKE2b-256 cba68f2292746680d7ebb5d0b2ed27b21e67c52381be49dc5b91c3ef39573f54

See more details on using hashes here.

Supported by

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