Skip to content

Compatiblity update for mpl 3.10 - #33

Merged
cvanelteren merged 9 commits into
Ultraplot:mainfrom
cvanelteren:add-compat-inset-indictor
Jan 27, 2025
Merged

cvanelteren merged 9 commits into
Ultraplot:mainfrom
cvanelteren:add-compat-inset-indictor

Conversation

@cvanelteren

@cvanelteren cvanelteren commented Jan 27, 2025 •

Copy link
Copy Markdown
Collaborator

Addresses #27

Reason

Updates indicate_inset_zoom to support matplotlib 3.10+ while maintaining backwards compatibility.

Changes

  • Adds version-specific implementation for matplotlib ≥3.10 using the new InsetIndicator class
  • Maintains existing implementation for matplotlib <3.10 using rectangle and patches
  • Both implementations share the same interface and return format

Technical Details

  • For mpl ≥3.10: Uses InsetIndicator class which manages both rectangle and connectors in a single object
  • For mpl <3.10: Continues to use separate rectangle patch and connector lines
  • Implements version checking to automatically select the appropriate implementation

@cvanelteren
cvanelteren requested a review from beckermr January 27, 2025 12:05

@beckermr beckermr left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I'm happy to merge this. We should develop a specific policy on MPL version support.

@beckermr
beckermr enabled auto-merge January 27, 2025 13:28
@cvanelteren

Copy link
Copy Markdown
Collaborator Author

I can also leave the warning out for now. It is more for the maintainers to remind to rid of some legacy code. We could also leave it out and naturally drop support when the return of this function will break. The return signature still uses the tuple format -- which is compatible with the Indicator class but may change in the future. The mpl docs list the indicator class as an experimental feature. Curious to hear what you think.

@beckermr

Copy link
Copy Markdown
Collaborator

I think we should drop support for python versions and MPL versions on the same schedule as MPL.

I also think we should move to calver or effver.

Semver is just too hard for this package due to how much churn we experience on the MPL side of things.

Using experimental features / apis is fine imho. We can read the MPL changelogs to find out when they change or are dropped.

@cvanelteren cvanelteren mentioned this pull request Jan 27, 2025
@cvanelteren

Copy link
Copy Markdown
Collaborator Author

Yeah let's do that. Effver seems to work fine -- usually not too fan of the date releases. The question now is do we mark the recent changes as a 1.1 or a 1.0.1?

@cvanelteren

Copy link
Copy Markdown
Collaborator Author

Regarding

I think we should drop support for python versions and MPL versions on the same schedule as MPL.

I fully agree too. However with regard to the feature itself do you suggest making the mpl compatibility more explicit in pyproject.toml? For example if you install mpl 3.10 you need ultraplot version x as well.

Looking at the codebase now I sometimes look at how cases are handled and am confused if the situation is still recent or we just delete the older supported mpl versions. Not sure what the best way about going it. For now we could leave it in with a comment and if it becomes a problem we just remove it.

@cvanelteren

Copy link
Copy Markdown
Collaborator Author

Actually now that I hear myself talk I think I am not looking at the bigger picture. Whenever it needs to change in the future we just adapt and remove the redundant code.

@cvanelteren
cvanelteren disabled auto-merge January 27, 2025 17:25
@cvanelteren
cvanelteren merged commit a447c3d into Ultraplot:main Jan 27, 2025
@cvanelteren
cvanelteren deleted the add-compat-inset-indictor branch January 27, 2025 17:26
@beckermr

Copy link
Copy Markdown
Collaborator

Yes we should ensure we have proper upper bounds on mpl in the pyproject.toml.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants