Skip to content

Consider moving away from docker based figure test builds #10483

Description

@Cadair

I recently spent a day (yes really) looking into the figure test builds for sunpy, specifically surrounding how we pin the version of freetype to minimize differences with the reference images (for sunpy they are hashes of the figures so have no tolerance unlike the currently astropy test setup). This is documented in sunpy/sunpy#4271.

What I learned is that matplotlib actually does a very good job of managing its own freetype versions under normal (pip) operations. When you install matplotlib from wheels a version of freetype is included, which is determined by matplotlib. More interestingly though is that is is also true when compiling matplotlib from a git checkout, and optionally true when compiling matplotlib from a release tarball (controlled by an environment variable).

Therefore, what I think is a good compromise between reliability and simplicity is to rely on these versions of freetype as provided by matplotlib, and not use docker etc on the CI, but to have tox install a known version of matplotlib, which will have an enclosed known version of freetype. To support this approach in sunpy we also check the version of freetype at runtime, and then stop the test run before the figure comparison fails.

The upshot of this is that, as long as you run the figure tests with tox, you should always get the right version of matplotlib and freetype to be able to accurately reproduce the reference figures.

@larrybradley @astrofrog as visualization maintainers.

Activity

  1. pllim commented on Jun 11, 2020

    @pllim
    Member

    Why is this not a PR? 😄

  2. astrofrog commented on Oct 14, 2020

    @astrofrog
    Member

    Sounds good to me! What @pllim said 😜

  3. astrofrog commented on Oct 14, 2020

    @astrofrog
    Member

    I would love to be able to get rid of the astropy-docker repo, one thing less to maintain

  4. Cadair commented on Oct 14, 2020

    @Cadair
    MemberAuthor

    Why is this not a PR? smile

    Because normally when I suggest 🔥 on some of the infra it ends up in a long discussion 🤣

  5. larrybradley commented on Oct 14, 2020

    @larrybradley
    Member

    Sounds good to me, too!

  6. bsipocz commented on Aug 26, 2021

    @bsipocz
    Member

    Can we close this now? We could still set up the hash-based system suggested above (maybe that should be a new issue instead), but at least we're not building our own dockers anymore.

  7. astrofrog commented on Aug 26, 2021

    @astrofrog
    Member

    Before we close this, is this statement now true?

    The upshot of this is that, as long as you run the figure tests with tox, you should always get the right version of matplotlib and freetype to be able to accurately reproduce the reference figures.

    Can we now run the image tests locally in tox? If so, I think we can indeed close it - if not I think it would be good to understand why.

  8. bsipocz commented on Aug 27, 2021

    @bsipocz
    Member

    I haven't run them myself, but I believe @pllim might have done it locally. My understanding is that mpl now handles the freetype version properly, so it shouldn't come up as an issue by design.

  9. pllim commented on Aug 27, 2021

    @pllim
    Member

    I do not run tox locally. I am not one of the cool kids.

    tox does not safeguard architecture dependent changes, right? We still rely on Docker but we use the base image provided by CircleCI. There is some dev docs on CircleCI on how to use their images but it involves accounts and their CLI software, yadda yadda.

  10. astrofrog commented on Aug 27, 2021

    @astrofrog
    Member

    I think it should work on any Linux machine though with tox. I'm doubtful it would work on Mac and Windows but @Cadair can correct me.

  11. Cadair commented on Aug 27, 2021

    @Cadair
    MemberAuthor

    Yeah, it doesn't work cross-platform, but any linux system should do it.

  12. pllim commented on Jan 17, 2023

    @pllim
    Member

    I think this has been resolved by #13596

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions