Skip to content

Migrate baseline images from DVC to Git LFS #4738

Description

@seisman

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

  • Discuss whether to migrate from DVC to Git LFS
  • Migrate pygmt/tests/baseline/*.png from DVC to Git LFS
  • Remove dvc from environment.yml
  • Remove .dvc/ and .dvcignore
  • Update MANIFEST.in
  • Update the Maintainers' Guide
  • Update the Contributors' Guide
  • Remove the dvc-diff.yml workflow, because GitHub can display diffs for LFS-tracked images directly in the web UI
  • Remove the cache_dvc.yaml workflow, which was added as a workaround for Running "dvc pull" now requires authentication #4147
  • Update the style_checks.yaml workflow
  • Update the ci_tests.yaml workflow
  • Update the ci_tests_dev.yaml workflow
  • Update the release-baseline-image.yml workflow
  • Ensure that source and binary distributions do not include the baseline images
  • Remove DAGsHUB secrets from GitHub settings
  • Decide if we want to delete the DagsHub repo https://dagshub.com/GenericMappingTools/pygmt, which is needed for old versions
  • Explore if a similar migration make sense to the GMT repository

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    maintenanceBoring but important stuff for the core devs

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions