[Addon Manager] Support for git LFS?

Here's the place for discussion related to coding in FreeCAD, C++ or Python. Design, interfaces and structures.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Post Reply
User avatar
alex_55
Posts: 62
Joined: Mon May 11, 2020 1:50 am

[Addon Manager] Support for git LFS?

Post by alex_55 »

Git large file storage in an ostensibly useful tool for working with large files (or files that are binary-encoded and change often) in git repos.

After finding almost no discussion about this tool on the forum, I've been testing it out as a potential helper for FreeCAD workbench development.

Currently, at least from my current understanding, the addon manager doesn't have any support for git LFS.
E.G.: Creating a dummy repository with some LFS-tracked files, adding the repo as a custom repository in FC user preferences, and installing it through the addon manager results in only the LFS pointer files being downloaded, not the binary blobs.

One workaround for this problem is for the repository owner to check "Include Git LFS objects in archives" in the repo settings. As long as the addon manager installs a module through a zip file, LFS tracked files will be downloaded in their full form.

Another would be to detect in module code (python) that some file that is expected to be binary-encoded is actually a 3-line text file that looks like:

Code: Select all

version https://git-lfs.github.com/spec/v1
oid sha256:4cac19622fc3ada9c0fdeadb33f88f367b541f38b89102a3f1261ac81fd5bcb5
size 84977953

and then use urllib to download the binary file with the github api

My actual question(s):
In the current addon manager implementation, is a module always downloaded from a git repository as a zip file?
Similarly, is it a good idea for module authors to track files using git LFS?
Any related thoughts/opinions are also appreciated. Thanks
User avatar
chennes
Veteran
Posts: 3868
Joined: Fri Dec 23, 2016 3:38 pm
Location: Norman, OK, USA
Contact:

Re: [Addon Manager] Support for git LFS?

Post by chennes »

alex_55 wrote: Sat Nov 05, 2022 4:57 am In the current addon manager implementation, is a module always downloaded from a git repository as a zip file?
No - if you have git available on your system, a clone is performed instead (unless you disable it in preferences).
Similarly, is it a good idea for module authors to track files using git LFS?
Well, considering that in the current implementation it doesn't work, I'd say no :D . Since those API calls don't require a token, it shouldn't be a problem to implement this, but since you're the first person who's asked for it, it's not exactly going to be a top priority. I'd welcome a PR that adds the functionality, though.
Chris Hennes
Pioneer Library System
GitHub profile, LinkedIn profile, chrishennes.com
Post Reply