[SciPy-Dev] Deprecation of NumPy functions in SciPy root namespace

Ralf Gommers ralf.gommers at gmail.com
Tue Jun 11 02:49:15 EDT 2019


On Mon, Jun 10, 2019 at 10:35 PM Eric Larson <larson.eric.d at gmail.com>
wrote:

> We currently import a few NumPy functions into the root SciPy namespace,
> meaning you can currently do things like:
>
> import scipy
> scipy.diag(...)
>
> However, this seems like something we shouldn't support, as people should
> do the more standard `import numpy as np; np.diag(...)` instead. The
> functions we currently import in scipy/__init__.py are:
>
> from numpy import *
> from numpy.random import rand, randn
> from numpy.fft import fft, ifft
> from numpy.lib.scimath import *
>
> I opened a PR to deprecate these in the 1.4.0 release, marking them for
> removal in 1.6.0:
>
> https://github.com/scipy/scipy/pull/10290
>
> Feel free to chime in if there are any objections to this plan. Ralf for
> example on the PR mentioned that he was deliberating between 1.6.0 or 2.0.0
> being a better target. My vote is for 1.6.0 based on how infrequently
> (actually never) I have seen this pattern used in the wild, and that it
> appears to have also been undocumented behavior.
>

Based on Peter finding documentation for this, Warren digging up a number
of actual usages (comment on the PR), this not really being an issue except
for the scipy.fft workaround that needs to be applied, and people not
reading deprecation warnings anyway, I'm in favor of deprecating now and
then waiting with removal till a 2.0 release.

Cheers,
Ralf
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/scipy-dev/attachments/20190611/a52208d8/attachment-0001.html>


More information about the SciPy-Dev mailing list