python-fitparse 2.0.5__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,64 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[cod]
4
+
5
+ # C extensions
6
+ *.so
7
+
8
+ # Distribution / packaging
9
+ .Python
10
+ env/
11
+ build/
12
+ develop-eggs/
13
+ dist/
14
+ downloads/
15
+ eggs/
16
+ lib/
17
+ lib64/
18
+ parts/
19
+ sdist/
20
+ var/
21
+ *.egg-info/
22
+ .installed.cfg
23
+ *.egg
24
+ Pipfile.lock
25
+ Pipfile*
26
+
27
+ # PyInstaller
28
+ # Usually these files are written by a python script from a template
29
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
30
+ *.manifest
31
+ *.spec
32
+
33
+ # Installer logs
34
+ pip-log.txt
35
+ pip-delete-this-directory.txt
36
+
37
+ # Unit test / coverage reports
38
+ htmlcov/
39
+ .tox/
40
+ .coverage
41
+ .cache
42
+ nosetests.xml
43
+ coverage.xml
44
+
45
+ # Translations
46
+ *.mo
47
+ *.pot
48
+
49
+ # Django stuff:
50
+ *.log
51
+
52
+ # Sphinx documentation
53
+ docs/_build/
54
+
55
+ # PyBuilder
56
+ target/
57
+
58
+ # Various IDEs
59
+ /.idea
60
+
61
+ # python-fitparse specific
62
+ FitSDK*
63
+
64
+ .DS_Store
@@ -0,0 +1,22 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2011-2025, David Cooper <david@dtcooper.com>
4
+ Copyright (c) 2017-2025, Carey Metcalfe <carey@cmetcalfe.ca>
5
+
6
+ Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ of this software and associated documentation files (the "Software"), to deal
8
+ in the Software without restriction, including without limitation the rights
9
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ copies of the Software, and to permit persons to whom the Software is
11
+ furnished to do so, subject to the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be included in all
14
+ copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ SOFTWARE.
@@ -0,0 +1,191 @@
1
+ Metadata-Version: 2.4
2
+ Name: python-fitparse
3
+ Version: 2.0.5
4
+ Summary: Python library to parse ANT/Garmin .FIT files
5
+ Project-URL: Homepage, https://www.github.com/nbr23/python-fitparse
6
+ Project-URL: Repository, https://www.github.com/nbr23/python-fitparse
7
+ Project-URL: Issues, https://github.com/nbr23/python-fitparse/issues
8
+ Author-email: David Cooper <dave@kupesoft.com>, nbr23 <max@23.tf>
9
+ License: MIT License
10
+
11
+ Copyright (c) 2011-2025, David Cooper <david@dtcooper.com>
12
+ Copyright (c) 2017-2025, Carey Metcalfe <carey@cmetcalfe.ca>
13
+
14
+ Permission is hereby granted, free of charge, to any person obtaining a copy
15
+ of this software and associated documentation files (the "Software"), to deal
16
+ in the Software without restriction, including without limitation the rights
17
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
18
+ copies of the Software, and to permit persons to whom the Software is
19
+ furnished to do so, subject to the following conditions:
20
+
21
+ The above copyright notice and this permission notice shall be included in all
22
+ copies or substantial portions of the Software.
23
+
24
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
25
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
26
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
27
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
28
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
29
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
30
+ SOFTWARE.
31
+ License-File: LICENSE
32
+ Keywords: ant,files,fit,garmin,parse
33
+ Classifier: Development Status :: 5 - Production/Stable
34
+ Classifier: Intended Audience :: Developers
35
+ Classifier: License :: OSI Approved :: MIT License
36
+ Classifier: Programming Language :: Python :: 3
37
+ Classifier: Programming Language :: Python :: 3.8
38
+ Classifier: Programming Language :: Python :: 3.9
39
+ Classifier: Programming Language :: Python :: 3.10
40
+ Classifier: Programming Language :: Python :: 3.11
41
+ Classifier: Programming Language :: Python :: 3.12
42
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
43
+ Requires-Python: >=3.8
44
+ Provides-Extra: generate
45
+ Requires-Dist: openpyxl==3.1.5; extra == 'generate'
46
+ Requires-Dist: requests; extra == 'generate'
47
+ Description-Content-Type: text/markdown
48
+
49
+ python-fitparse
50
+ ===============
51
+
52
+ > :warning: **NOTE:** *I have **limited to no time** to work on this package
53
+ > these days!*
54
+ >
55
+ > I am looking for a maintainer to help with issues and updating/releasing the package.
56
+ > Please reach out via email at <david@dtcooper.com> if you have interest in helping.
57
+ >
58
+ > If you're having trouble using this package for whatever reason, might we suggest using
59
+ > an alternative library: [fitdecode](https://github.com/polyvertex/fitdecode) by
60
+ > [polyvertex](https://github.com/polyvertex).
61
+ >
62
+ > Cheers,
63
+ >
64
+ > David
65
+
66
+ Here's a Python library to parse ANT/Garmin `.FIT` files.
67
+ [![Build Status](https://github.com/dtcooper/python-fitparse/workflows/test/badge.svg)](https://github.com/dtcooper/python-fitparse/actions?query=workflow%3Atest)
68
+
69
+
70
+ Install from [![PyPI](https://img.shields.io/pypi/v/fitparse.svg)](https://pypi.python.org/pypi/fitparse/):
71
+ ```
72
+ pip install fitparse
73
+ ```
74
+
75
+ FIT files
76
+ ------------
77
+ - FIT files contain data stored in a binary file format.
78
+ - The FIT (Flexible and Interoperable Data Transfer) file protocol is specified
79
+ by [ANT](http://www.thisisant.com/).
80
+ - The SDK, code examples, and detailed documentation can be found in the
81
+ [ANT FIT SDK](http://www.thisisant.com/resources/fit).
82
+
83
+
84
+ Usage
85
+ -----
86
+ A simple example of printing records from a fit file:
87
+
88
+ ```python
89
+ import fitparse
90
+
91
+ # Load the FIT file
92
+ fitfile = fitparse.FitFile("my_activity.fit")
93
+
94
+ # Iterate over all messages of type "record"
95
+ # (other types include "device_info", "file_creator", "event", etc)
96
+ for record in fitfile.get_messages("record"):
97
+
98
+ # Records can contain multiple pieces of data (ex: timestamp, latitude, longitude, etc)
99
+ for data in record:
100
+
101
+ # Print the name and value of the data (and the units if it has any)
102
+ if data.units:
103
+ print(" * {}: {} ({})".format(data.name, data.value, data.units))
104
+ else:
105
+ print(" * {}: {}".format(data.name, data.value))
106
+
107
+ print("---")
108
+ ```
109
+
110
+ The library also provides a `fitdump` script for command line usage:
111
+ ```
112
+ $ fitdump --help
113
+ usage: fitdump [-h] [-v] [-o OUTPUT] [-t {readable,json}] [-n NAME] [--ignore-crc] FITFILE
114
+
115
+ Dump .FIT files to various formats
116
+
117
+ positional arguments:
118
+ FITFILE Input .FIT file (Use - for stdin)
119
+
120
+ optional arguments:
121
+ -h, --help show this help message and exit
122
+ -v, --verbose
123
+ -o OUTPUT, --output OUTPUT
124
+ File to output data into (defaults to stdout)
125
+ -t {readable,json}, --type {readable,json}
126
+ File type to output. (DEFAULT: readable)
127
+ -n NAME, --name NAME Message name (or number) to filter
128
+ --ignore-crc Some devices can write invalid crc's, ignore these.
129
+ ```
130
+
131
+ See the documentation for more: http://dtcooper.github.io/python-fitparse
132
+
133
+
134
+ Major Changes From Original Version
135
+ -----------------------------------
136
+
137
+ After a few years of laying dormant we are back to active development!
138
+ The old version is archived as
139
+ [`v1-archive`](https://github.com/dtcooper/python-fitparse/releases/tag/v1-archive).
140
+
141
+ * New, hopefully cleaner public API with a clear division between accessible
142
+ and internal parts. (Still unstable and partially complete.)
143
+
144
+ * Proper documentation!
145
+ [Available here](https://dtcooper.github.io/python-fitparse/).
146
+
147
+ * Unit tests and example programs.
148
+
149
+ * **(WIP)** Command line tools (eg a `.FIT` to `.CSV` converter).
150
+
151
+ * Component fields and compressed timestamp headers now supported and not
152
+ just an afterthought. Closes issues #6 and #7.
153
+
154
+ * FIT file parsing is generic enough to support all types. Going to have
155
+ specific `FitFile` subclasses for more popular file types like activities.
156
+
157
+ * **(WIP)** Converting field types to normalized values (for example,
158
+ `bool`, `date_time`, etc) done in a consistent way, that's easy to
159
+ customize by subclassing the converter class. I'm going to use something
160
+ like the Django form-style `convert_<field name>` idiom on this class.
161
+
162
+ * The FIT profile is its own complete python module, rather than using
163
+ `profile.def`.
164
+
165
+ * Bonus! The profile generation script is _less_ ugly (but still an
166
+ atrocity) and supports every
167
+ [ANT FIT SDK](http://www.thisisant.com/resources/fit) from version 1.00
168
+ up to 5.10.
169
+
170
+ * A working `setup.py` module. Closes issue #2, finally! I'll upload the
171
+ package to [PyPI](http://pypi.python.org/) when it's done.
172
+
173
+ * Support for parsing one record at a time. This can be done using
174
+ `<FitFile>.parse_one()` for now, but I'm not sure of the exact
175
+ implementation yet.
176
+
177
+
178
+ Updating to new FIT SDK versions
179
+ --------------------------------
180
+ - Download the latest [ANT FIT SDK](http://www.thisisant.com/resources/fit).
181
+ - Update the profile:
182
+ ```
183
+ python3 scripts/generate_profile.py /path/to/fit_sdk.zip fitparse/profile.py
184
+ ```
185
+
186
+
187
+ License
188
+ -------
189
+
190
+ This project is licensed under the MIT License - see the [`LICENSE`](LICENSE)
191
+ file for details.
@@ -0,0 +1,143 @@
1
+ python-fitparse
2
+ ===============
3
+
4
+ > :warning: **NOTE:** *I have **limited to no time** to work on this package
5
+ > these days!*
6
+ >
7
+ > I am looking for a maintainer to help with issues and updating/releasing the package.
8
+ > Please reach out via email at <david@dtcooper.com> if you have interest in helping.
9
+ >
10
+ > If you're having trouble using this package for whatever reason, might we suggest using
11
+ > an alternative library: [fitdecode](https://github.com/polyvertex/fitdecode) by
12
+ > [polyvertex](https://github.com/polyvertex).
13
+ >
14
+ > Cheers,
15
+ >
16
+ > David
17
+
18
+ Here's a Python library to parse ANT/Garmin `.FIT` files.
19
+ [![Build Status](https://github.com/dtcooper/python-fitparse/workflows/test/badge.svg)](https://github.com/dtcooper/python-fitparse/actions?query=workflow%3Atest)
20
+
21
+
22
+ Install from [![PyPI](https://img.shields.io/pypi/v/fitparse.svg)](https://pypi.python.org/pypi/fitparse/):
23
+ ```
24
+ pip install fitparse
25
+ ```
26
+
27
+ FIT files
28
+ ------------
29
+ - FIT files contain data stored in a binary file format.
30
+ - The FIT (Flexible and Interoperable Data Transfer) file protocol is specified
31
+ by [ANT](http://www.thisisant.com/).
32
+ - The SDK, code examples, and detailed documentation can be found in the
33
+ [ANT FIT SDK](http://www.thisisant.com/resources/fit).
34
+
35
+
36
+ Usage
37
+ -----
38
+ A simple example of printing records from a fit file:
39
+
40
+ ```python
41
+ import fitparse
42
+
43
+ # Load the FIT file
44
+ fitfile = fitparse.FitFile("my_activity.fit")
45
+
46
+ # Iterate over all messages of type "record"
47
+ # (other types include "device_info", "file_creator", "event", etc)
48
+ for record in fitfile.get_messages("record"):
49
+
50
+ # Records can contain multiple pieces of data (ex: timestamp, latitude, longitude, etc)
51
+ for data in record:
52
+
53
+ # Print the name and value of the data (and the units if it has any)
54
+ if data.units:
55
+ print(" * {}: {} ({})".format(data.name, data.value, data.units))
56
+ else:
57
+ print(" * {}: {}".format(data.name, data.value))
58
+
59
+ print("---")
60
+ ```
61
+
62
+ The library also provides a `fitdump` script for command line usage:
63
+ ```
64
+ $ fitdump --help
65
+ usage: fitdump [-h] [-v] [-o OUTPUT] [-t {readable,json}] [-n NAME] [--ignore-crc] FITFILE
66
+
67
+ Dump .FIT files to various formats
68
+
69
+ positional arguments:
70
+ FITFILE Input .FIT file (Use - for stdin)
71
+
72
+ optional arguments:
73
+ -h, --help show this help message and exit
74
+ -v, --verbose
75
+ -o OUTPUT, --output OUTPUT
76
+ File to output data into (defaults to stdout)
77
+ -t {readable,json}, --type {readable,json}
78
+ File type to output. (DEFAULT: readable)
79
+ -n NAME, --name NAME Message name (or number) to filter
80
+ --ignore-crc Some devices can write invalid crc's, ignore these.
81
+ ```
82
+
83
+ See the documentation for more: http://dtcooper.github.io/python-fitparse
84
+
85
+
86
+ Major Changes From Original Version
87
+ -----------------------------------
88
+
89
+ After a few years of laying dormant we are back to active development!
90
+ The old version is archived as
91
+ [`v1-archive`](https://github.com/dtcooper/python-fitparse/releases/tag/v1-archive).
92
+
93
+ * New, hopefully cleaner public API with a clear division between accessible
94
+ and internal parts. (Still unstable and partially complete.)
95
+
96
+ * Proper documentation!
97
+ [Available here](https://dtcooper.github.io/python-fitparse/).
98
+
99
+ * Unit tests and example programs.
100
+
101
+ * **(WIP)** Command line tools (eg a `.FIT` to `.CSV` converter).
102
+
103
+ * Component fields and compressed timestamp headers now supported and not
104
+ just an afterthought. Closes issues #6 and #7.
105
+
106
+ * FIT file parsing is generic enough to support all types. Going to have
107
+ specific `FitFile` subclasses for more popular file types like activities.
108
+
109
+ * **(WIP)** Converting field types to normalized values (for example,
110
+ `bool`, `date_time`, etc) done in a consistent way, that's easy to
111
+ customize by subclassing the converter class. I'm going to use something
112
+ like the Django form-style `convert_<field name>` idiom on this class.
113
+
114
+ * The FIT profile is its own complete python module, rather than using
115
+ `profile.def`.
116
+
117
+ * Bonus! The profile generation script is _less_ ugly (but still an
118
+ atrocity) and supports every
119
+ [ANT FIT SDK](http://www.thisisant.com/resources/fit) from version 1.00
120
+ up to 5.10.
121
+
122
+ * A working `setup.py` module. Closes issue #2, finally! I'll upload the
123
+ package to [PyPI](http://pypi.python.org/) when it's done.
124
+
125
+ * Support for parsing one record at a time. This can be done using
126
+ `<FitFile>.parse_one()` for now, but I'm not sure of the exact
127
+ implementation yet.
128
+
129
+
130
+ Updating to new FIT SDK versions
131
+ --------------------------------
132
+ - Download the latest [ANT FIT SDK](http://www.thisisant.com/resources/fit).
133
+ - Update the profile:
134
+ ```
135
+ python3 scripts/generate_profile.py /path/to/fit_sdk.zip fitparse/profile.py
136
+ ```
137
+
138
+
139
+ License
140
+ -------
141
+
142
+ This project is licensed under the MIT License - see the [`LICENSE`](LICENSE)
143
+ file for details.
@@ -0,0 +1,10 @@
1
+ #!/usr/bin/env python
2
+
3
+ # Make classes available
4
+ from fitparse.base import FitFile, FitFileDecoder, UncachedFitFile, \
5
+ FitParseError, CacheMixin, DataProcessorMixin
6
+ from fitparse.records import DataMessage
7
+ from fitparse.processors import FitFileDataProcessor, StandardUnitsDataProcessor
8
+
9
+
10
+ __version__ = '1.2.0'