Add create FIT file capability to FIT Python SDK ?

From what I can see the existing Python module does not contain the functionality for writing a FIT file.

Are there any plans to extend the functionality offered by the "Garmin - FIT Python SDK" library?

Useful to have a Python routine to read a FIT file, make some changes, and save it again.

Within the modules for other languages (eg C++) that capability seems to be there. https://developer.garmin.com/fit/example-projects/cpp/

Thanks

  • At the moment there are no plans to add a file encoder to the Python SDK. Yes the other SDKs have this capability, but main use-case for the Python SDK is data analysis.  

    You can try using the FIT CSV Tool for quick edits to a file, or one of the other SDKs.
    https://developer.garmin.com/fit/fitcsvtool/editing-files/ 

  • I would say a pretty "main" use case would be so that regular folks can easily fix problems with their fit files (like corrupted times), even in batch operations, without needing to break out visual studio.   Unfortunately, the stages tool has issues.   Even if you're doing data analysis, why wouldn't you want to be able to store calculated fields, like estimated power, back into a modified data file so it could be viewed by other apps?  And why would you want to store that in a different format, where, if you want to read that, you would then need to write different code?

    I suspect the real reason is that python is maybe more targeted for "community" use, rather than industry use, and that this is simply all the support there is for it, from Garmin anyway.  I can't complain, but there are good reasons to want it.

  • Added to this, the python SDK is just way better than the C# one.  In python you can access all messages in one loop as simple dictionaries, which means you can find Timestamp for any message type (with a single try/catch to skip ones that don't have it) and print them all or perform some blanket correction.  In C# you must explicitly look at every message type one by one, because each is a different object type, each with its own Timestamp property (or not, so you have to choose which ones to look at for to even compile).  

  • I did figure out how to solve this particular issue in the C# implementation, but it seems quite a bit less transparent.

  • I would also like to be able to save FIT file from Python. Data analysis is one thing sure, but Python as a scripting language would allow everyone to edit any FIT file quite easily as well!

  • To hijack my point, I will say that C# is actually  a really really good language, for what it's worth, far better than python, and in fact easier and cleaner to program even simple things in.   Still, for simple things, the python FIT API itself is easier and the build environment simpler (non existent).  C# does work well in vscode now and even on linux.  Still python is more accessible, and the present API is more transparent.  The last part is just a design choice though, not a language thing. 

  • A further use case would be for creating test data (or in situ modifications/additions) to be used during development/testing of Python data analysis programs.