Skip to main content

python-tcxparser

Requirement Updates

python-tcxparser is a minimal parser for Garmin’s TCX file format. It is not in any way exhaustive.

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)

  • percentage and time spent in heart rate zone

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
>>> # percentage of workout spent in each user-defined heart rate zone
... tcx.hr_percent_in_zones({"Z0": (0, 99), "Z1": (100, 129), "Z2": (130, 200)})
{"Z0": 14, "Z1": 36, "Z2": 50}

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)

Release files for python-tcxparser 2.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for python-tcxparser 2.1.0
File Size Uploaded
python-tcxparser-2.1.0.tar.gz 6.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for python-tcxparser 2.1.0
File Interpreter ABI Platform
python_tcxparser-2.1.0-py2.py3-none-any.whl Python 3, Python 2 none any Details

Total release size: 13.7 kB

Release files / python-tcxparser-2.1.0.tar.gz

Download URL python-tcxparser-2.1.0.tar.gz
Size 6.9 kB
Tags Source
SHA-256 checksum
How to use checksums
87ab84e498522e42f4def731be3ece49d440d5f872e59949d4b4e4b3cdbb95cd
BLAKE2b-256 checksum
How to use checksums
95e67650dcb0eb0c1c3013a274ff2a58b7f7c64d26597668118eef176a094d7b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.1

Release files / python_tcxparser-2.1.0-py2.py3-none-any.whl

Download URL python_tcxparser-2.1.0-py2.py3-none-any.whl
Size 6.8 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
9f2e8c47ae7cddc87e8f514d6c45de4dc254b5b123feffb7b1ecd7d16455bd05
BLAKE2b-256 checksum
How to use checksums
68b0d0599e7f4865c23db6b0977250a54d901aae5ce883b4b2d3f5b02460d1e6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.1

Release history Release notifications | RSS feed

2.4.0

2 release files

2.3.0

2 release files

2.2.0

2 release files

This release

2.1.0 This release

2 release files

2.0.0

2 release files

1.1.0

2 release files

1.0.0

2 release files

0.8.0

2 release files

0.7.2

1 release file

0.7.1

1 release file

0.7.0

1 release file

0.6.0

1 release file

0.5.0

1 release file

0.4.0

1 release file

0.2.0

1 release file

0.1.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page