FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

MNT: Privatize Formatter attributes by timhoffm · Pull Request #31416 · matplotlib/matplotlib · GitHub

Repository navigation

MNT: Privatize Formatter attributes - #31416

Merged
QuLogic merged 1 commit into
matplotlib:mainfrom
timhoffm:mnt-deprecate-formatter-attrs
Apr 23, 2026
Merged

QuLogic merged 1 commit into
matplotlib:mainfrom
timhoffm:mnt-deprecate-formatter-attrs

Conversation

Copy link
Copy Markdown
Member

These attributes are internal state and users should not access them:

ScalarFormatter.orderOfMagnitude
ScalarFormatter.format
ConciseDateFormatter.offset_format
Formatter.locs

Making them private will allow rearchitecting the handling of tick context (i.e. information extracted from a group of ticks, that may influence their formatting) in the future.

This works towards #31396.

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.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Many internal uses are still not fixed and breaking tests/docs, so I'll mark this as draft.

Comment thread lib/matplotlib/dates.py
'%Y-%b-%d',
'%Y-%b-%d %H:%M']
self.offset_string = ''
self._offset_string = ''

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.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

There are still all the internal users of this that aren't converted and will raise a warning.

QuLogic marked this pull request as draft March 30, 2026 19:40

Copy link
Copy Markdown
Contributor

hey, I looked into why the tests were failing and it's because the internal usages in ticker.py still reference the old attribute names. I updated all of them locally: self.locs → self._locs across ScalarFormatter, LogitFormatter, EngFormatter and PercentFormatter, self.orderOfMagnitude → self._orderOfMagnitude, and self.format → self._format in ScalarFormatter. sankey.py doesn't need changes since that format attribute belongs to a completely different class. would it be okay if I pushed these fixes to your branch or would you prefer a follow up PR?

timhoffm commented Apr 8, 2026

Copy link
Copy Markdown
Member Author

@buddy0452004 Thanks for looking into this. Pushing the changes as an additional commit to this branch is welcome.

Copy link
Copy Markdown
Contributor

hey, pushed the ticker.py fixes to my fork, opened a PR into your branch here: timhoffm#39

timhoffm marked this pull request as ready for review April 11, 2026 01:57
timhoffm marked this pull request as draft April 11, 2026 07:10
Co-authored-by: buddy0452004 <rahulmonani2004@gmail.com>
timhoffm force-pushed the mnt-deprecate-formatter-attrs branch from 46ee6ca to 791aaf9 Compare April 11, 2026 22:07
timhoffm marked this pull request as ready for review April 11, 2026 22:40
tacaswell added this to the v3.11.0 milestone Apr 23, 2026
QuLogic merged commit 7e18ee2 into matplotlib:main Apr 23, 2026
52 of 53 checks passed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants


Back | FazBrowse Home | New Git URL