Skip to content

MNT: move ArtistList into artist module - #31794

Merged
QuLogic merged 1 commit into
matplotlib:mainfrom
rcomer:standalone-artistlist
Jul 18, 2026
Merged

MNT: move ArtistList into artist module#31794
QuLogic merged 1 commit into
matplotlib:mainfrom
rcomer:standalone-artistlist

Conversation

@rcomer

@rcomer rcomer commented May 31, 2026

Copy link
Copy Markdown
Member

PR summary

Make ArtistList a standalone class in the artist module, and deprecate accessing as an attribute of the axes class. This is pulled out of #31746 to make the review easier. The only changes to the AxesList class are

  • White space
  • __init__ call sequence is now on one line
  • The isinstance call in __add__ now checks for ArtistList instead of Axes.ArtistList

I suspect this will need the second commit from #31746, but I'm curious to actually see the doc failure.

AI Disclosure

No AI used.

PR checklist

@github-actions github-actions Bot added topic: axes Documentation: tutorials files in galleries/tutorials labels May 31, 2026

@timhoffm timhoffm left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, much easier to review 😄.

As expected, the doc failure is the same strange inheritance-diagram related failure as in the other PR.

@rcomer
rcomer force-pushed the standalone-artistlist branch from a9d220f to 8e05633 Compare May 31, 2026 14:07
@rcomer

rcomer commented May 31, 2026

Copy link
Copy Markdown
Member Author

Force-pushed because I also needed to rename the changenote filename, and I wanted that in the first commit.

@rcomer

rcomer commented May 31, 2026

Copy link
Copy Markdown
Member Author

Notes on second commit for second reviewer:

For some reason, modifying the artist_api.rst triggered warnings and therefore a Circle-CI failure like this. I demonstrated that removing the inheritance diagram at the top of the file made the problem go away, so that seems to be the cause but I'm unclear why the inheritance diagram has not been a problem before now.

To fix it, I went ahead and added docs for the missing private artists.

For _ImageBase and _AnnotationBase I think these are reasonable to include as they have useful methods that do not show in the docs for the public arists. E.g. get_shape, get_size, set_data on _ImageBase and get/set_annotation_clip on _AnnotationBase.

For _AxesBase I made it as unobtrusive as possible.

@rcomer rcomer mentioned this pull request May 31, 2026
5 tasks
@rcomer rcomer changed the title MNT: move Artistlist into artist module MNT: move ArtistList into artist module May 31, 2026
@rcomer rcomer added this to the v3.12.0 milestone Jun 2, 2026

@QuLogic QuLogic left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will note that all the doc problems were already listed in doc/missing-references.json, but at a different line number. So if you've fixed them, then you should remove the entries from there.

@@ -0,0 +1,3 @@
The ``Axes.AxesList`` attribute

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is AxesList?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ooops; fixed.

Comment thread lib/matplotlib/artist.pyi Outdated
def pprint_getters(self) -> list[str]: ...


class ArtistList(Sequence[_T_Artist]):

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs updating for #31923.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@ayshih

ayshih commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

I will note that all the doc problems were already listed in doc/missing-references.json

Ah, I didn't know about that file! I had hit the same docs failures after I modified artist_api.rst in #31162, so it's great to now understand why that happened.

@rcomer

rcomer commented Jun 25, 2026

Copy link
Copy Markdown
Member Author

I had heard of that file but never made the effort to learn what it's about! Thanks @QuLogic it's good to have an explanation.

@rcomer

rcomer commented Jun 25, 2026

Copy link
Copy Markdown
Member Author

I am in two minds what to do about the _AxesBase reference. The stub file I created seems like documentation clutter, but the missing_references.json solution is brittle - it has confused at least three of us. Does anyone have an opinion which solution is the lesser evil?

Comment thread doc/missing-references.json
@rcomer
rcomer force-pushed the standalone-artistlist branch from b28308f to 74ea04e Compare June 27, 2026 07:15
@QuLogic
QuLogic merged commit c716285 into matplotlib:main Jul 18, 2026
39 of 41 checks passed
@rcomer
rcomer deleted the standalone-artistlist branch July 18, 2026 09:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Documentation: tutorials files in galleries/tutorials topic: axes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants