The baseline images in pygmt/tests/baseline/*.png have been tracked using DVC since PR #1036 (five years ago; the original idea came from #963 (comment)). This setup has worked well, but it also has several drawbacks. I think it's time to consider whether we have a better solution.
Drawbacks of DVC
Git LFS
Git LFS is likely a better option for our use case. For files tracked by Git LFS, only small text pointer files are stored in the Git repository (similar to the current *.dvc files), while the actual file contents are stored separately. So updating baseline images won't increase the Git repository size.
Currently, PyGMT has ~240 baseline images with a total size of ~10 MB, which is well within GitHub LFS's free quota of 10 GB of storage and 10 GB of monthly bandwidth (xref: https://docs.github.com/en/billing/concepts/product-billing/git-lfs#free-use-of-git-lfs).
The setup is straightforward and only requires a few commands (see https://git-lfs.com/). Once configured, baseline images can be managed just like regular Git-tracked files using git add, git pull, and git push. This makes the workflow much more transparent and familiar for both maintainers and contributors.
Git LFS also integrates well with GitHub and pull requests. In my own fork, I have already migrated the baseline images to Git LFS on the main branch (https://github.com/seisman/pygmt). For example, if you visit https://github.com/seisman/pygmt/blob/main/pygmt/tests/baseline/test_basemap.png, GitHub displays the image directly, with a "Stored with Git LFS" note in the upper-left corner. When a baseline image is updated in a pull request, GitHub can also display image diffs directly (see https://github.com/seisman/pygmt/pull/4/changes for an example).
Overall, I think Git LFS satisfies our requirements while providing a simpler and more contributor-friendly workflow than DVC.
TODO
I have to admit that I’ve never used Git LFS before, so I’d especially like to hear from @weiji14, who implemented the DVC mechanism in PR #1036 and may have more experience with both DVC and Git LFS. I’m also pinging @GenericMappingTools/pygmt-maintainers for comments and feedback.
The baseline images in
pygmt/tests/baseline/*.pnghave been tracked using DVC since PR #1036 (five years ago; the original idea came from #963 (comment)). This setup has worked well, but it also has several drawbacks. I think it's time to consider whether we have a better solution.Drawbacks of DVC
dvc, which is unfamiliar to most contributorsdvc add,dvc push,git add, andgit push(xref: https://www.pygmt.org/v0.19.0/contributing.html#using-data-version-control-dvc-to-manage-test-images)Git LFS
Git LFS is likely a better option for our use case. For files tracked by Git LFS, only small text pointer files are stored in the Git repository (similar to the current
*.dvcfiles), while the actual file contents are stored separately. So updating baseline images won't increase the Git repository size.Currently, PyGMT has ~240 baseline images with a total size of ~10 MB, which is well within GitHub LFS's free quota of 10 GB of storage and 10 GB of monthly bandwidth (xref: https://docs.github.com/en/billing/concepts/product-billing/git-lfs#free-use-of-git-lfs).
The setup is straightforward and only requires a few commands (see https://git-lfs.com/). Once configured, baseline images can be managed just like regular Git-tracked files using
git add,git pull, andgit push. This makes the workflow much more transparent and familiar for both maintainers and contributors.Git LFS also integrates well with GitHub and pull requests. In my own fork, I have already migrated the baseline images to Git LFS on the main branch (https://github.com/seisman/pygmt). For example, if you visit https://github.com/seisman/pygmt/blob/main/pygmt/tests/baseline/test_basemap.png, GitHub displays the image directly, with a "Stored with Git LFS" note in the upper-left corner. When a baseline image is updated in a pull request, GitHub can also display image diffs directly (see https://github.com/seisman/pygmt/pull/4/changes for an example).
Overall, I think Git LFS satisfies our requirements while providing a simpler and more contributor-friendly workflow than DVC.
TODO
pygmt/tests/baseline/*.pngfrom DVC to Git LFSdvcfromenvironment.yml.dvc/and.dvcignoreMANIFEST.indvc-diff.ymlworkflow, because GitHub can display diffs for LFS-tracked images directly in the web UIcache_dvc.yamlworkflow, which was added as a workaround for Running "dvc pull" now requires authentication #4147style_checks.yamlworkflowci_tests.yamlworkflowci_tests_dev.yamlworkflowrelease-baseline-image.ymlworkflowI have to admit that I’ve never used Git LFS before, so I’d especially like to hear from @weiji14, who implemented the DVC mechanism in PR #1036 and may have more experience with both DVC and Git LFS. I’m also pinging @GenericMappingTools/pygmt-maintainers for comments and feedback.