Skip to content

[MNT]: black version #30611

Closed
Closed

Description

@rcomer

Summary

I just created a new mpl-dev environment from the conda yml file. I think this was the first time I had python 3.13 for this. The black version installed was 19.3b0, which is pretty old and caused a failure in boilerplate.py (due to psf/black#2964).

I think the problem is that we currently have black pinned to <24 to keep the formatting stable. However black versions 20-23 are only available for python<3.13.

Proposed fix

Bump the black version pin.

Activity

  1. jklymak commented on Sep 27, 2025

    @jklymak
    Member

    In what context do we even use black?

  2. rcomer commented on Sep 27, 2025

    @rcomer
    MemberAuthor

    We use it to format pyplot.py

    Edit: so running boilerplate.py or pytest lib/matplotlib/tests/test_pyplot.py::test_pyplot_up_to_date with the wrong black version will cause a failure.

  3. rcomer commented on Sep 27, 2025

    @rcomer
    MemberAuthor

    Possibly we should consider using the ruff formatter instead of black, now that we use ruff elsewhere. However, #30612 is the quick fix.

  4. tacaswell commented on Sep 29, 2025

    @tacaswell
    Member

    When we added type annotations we decided to put them inline in the auto-generated code rather than write a second auto-generator for a pyplot.pyi. Once we had done that we decided to use an auto-formatter on the generated code rather than writing our own formatter to get the line wrapping correct on the now much longer signatures.

  5. added this to the v3.10.7 milestone on Sep 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions