Thanks to visit codestin.com
Credit goes to github.com

Skip to content

FIX: Remove some numpy function overrides from pylab#25384

Merged
timhoffm merged 1 commit intomatplotlib:mainfrom
greglucas:np-import-builtins
Mar 6, 2023
Merged

FIX: Remove some numpy function overrides from pylab#25384
timhoffm merged 1 commit intomatplotlib:mainfrom
greglucas:np-import-builtins

Conversation

@greglucas
Copy link
Copy Markdown
Contributor

PR Summary

Numpy added round, max, min to their exported names which we don't want when we import * from Numpy.

xref: numpy/numpy#23302

closes #25379

PR Checklist

Documentation and Tests

  • Has pytest style unit tests (and pytest passes)
  • Documentation is sphinx and numpydoc compliant (the docs should build without error).
  • New plotting related features are documented with examples.

Release Notes

  • New features are marked with a .. versionadded:: directive in the docstring and documented in doc/users/next_whats_new/
  • API changes are marked with a .. versionchanged:: directive in the docstring and documented in doc/api/next_api_changes/
  • Release notes conform with instructions in next_whats_new/README.rst or next_api_changes/README.rst

Numpy added round, max, min to their exported names which
we don't want when we import * from Numpy.
@greglucas greglucas added this to the v3.7.2 milestone Mar 4, 2023
@timhoffm timhoffm merged commit bdb4935 into matplotlib:main Mar 6, 2023
meeseeksmachine pushed a commit to meeseeksmachine/matplotlib that referenced this pull request Mar 6, 2023
@greglucas greglucas deleted the np-import-builtins branch March 6, 2023 14:59
oscargus added a commit that referenced this pull request Mar 6, 2023
…384-on-v3.7.x

Backport PR #25384 on branch v3.7.x (FIX: Remove some numpy function overrides from pylab)
@chrisjbillington
Copy link
Copy Markdown
Contributor

FYI, Numpy 1.25 is now out with the changes, and this fix hasn't yet made it into a matplotlib release. Currently, importing * from pylab currently shadows the builtin max and min functions with the latest release of both libraries.

@rcomer
Copy link
Copy Markdown
Member

rcomer commented Jun 24, 2023

Thank you @chrisjbillington. We are hoping to release Matplotlib v3.8 in July, so I suggest pinning numpy back to 1.24 until then.

Note that use of pylab is strongly discouraged, and I think this problem is a good illustration of why. So if you have code that is breaking because of this, it would be better to update to not use pylab. I appreciate it can be difficult to find time to update old legacy code though.

@chrisjbillington
Copy link
Copy Markdown
Contributor

Thanks for the timeframe.

Yes, understood, we're only using pylab because it seemed like a good idea about 13 years ago, and haven't yet made the backward incompatible (since users may access pylab names via our library) change of removing it, but it's on the wish list!

@rcomer
Copy link
Copy Markdown
Member

rcomer commented Jul 8, 2023

@chrisjbillington you may have already seen, but v3.7.2 was just released with this fix.

@chrisjbillington
Copy link
Copy Markdown
Contributor

@rcomer I hadn't, thanks for letting me know!

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.

[TST] Upcoming dependency test failures

4 participants