fit
Read and write Garmin FIT (Flexible and Interoperable Data Transfer) files from Python.
FIT is a binary format designed for sport, fitness, and health devices. It is compact, interoperable, and extensible — any FIT-compliant device can interpret a FIT file from any other FIT-compliant device.
Installation
python3 -m venv .venv
source .venv/bin/activate
pip install -e ".[dev]"
Or use the Makefile:
make install
Usage
Reading a FIT file
from fit import FitFile
with FitFile.open("path/to/activity.fit") as f:
for message in f:
print(message)
Copying a FIT file
from fit import FitFile
with FitFile.open("path/to/source.fit") as src:
with FitFile.open("path/to/copy.fit", mode="w") as dst:
dst.copy(src)
Creating a new FIT file
from fit.files.activity import ActivityFile
from fit.messages.common import FileCreator
fnew = ActivityFile.create("path/to/new.fit")
fnew.append(FileCreator(software_version=100))
fnew.write()
fnew.close()
Reading from a stream
from io import BytesIO
from fit import FitFile
data = open("path/to/activity.fit", "rb").read()
with FitFile.open(BytesIO(data)) as f:
for message in f:
print(message)
Development
make install # create .venv and install all dev dependencies
make format # run black
make lint # run ruff
make typecheck # run mypy
make test # run pytest with coverage
make tox # run tests across Python 3.9, 3.10, 3.12
make clean # remove build artefacts and the virtualenv
License
BSD 3-Clause — see LICENSE.
Metadata
Release files for fit 0.5.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| fit-0.5.1.tar.gz | 46.2 kB | Without provenance | Details for fit-0.5.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| fit-0.5.1-py3-none-any.whl | Python 3 | none | any | Details for fit-0.5.1-py3-none-any.whl |
Total release size: 99.3 kB
Release files / fit-0.5.1.tar.gz
| Download URL | fit-0.5.1.tar.gz |
|---|---|
| Size | 46.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
52fe23e53ebd973418099114068893e57626c1d23d232eaf38a252cbef73e61a
|
|
BLAKE2b-256 checksum How to use checksums |
061bb2cb459c54c2937723392be175fff5dd89d9fec0c2202a933c151ecce37b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Release files / fit-0.5.1-py3-none-any.whl
| Download URL | fit-0.5.1-py3-none-any.whl |
|---|---|
| Size | 53.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
fc45bd0455784ba6292b50386e71f46b840094b1d6286bb6df987eadeb06c556
|
|
BLAKE2b-256 checksum How to use checksums |
e77aeead630b0ec75a0fea676f18e597ee2ee0881f1e8e93c85be6e877bb569f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Security for fit 0.5.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.