Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DEP: integrate: improve deprecation of private modules named without underscore prefix #18970

Merged
merged 5 commits into from Jul 30, 2023

Conversation

j-bowhay
Copy link
Member

Reference issue

closes #17771
towards #18279

What does this implement/fix?

Currently some of the deprecation warnings for private modules named without underscore prefix are misleading. For example:
Before this pr:

In [1]: from scipy.integrate.odepack import ODEintWarning
<ipython-input-1-0b0b6117d43a>:1: DeprecationWarning: Please use `ODEintWarning` from the `scipy.integrate` namespace, the `scipy.integrate.odepack` namespace is deprecated.
  from scipy.integrate.odepack import ODEintWarning

In [2]: from scipy.integrate import ODEintWarning
   ...:
---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
Cell In[2], line 1
----> 1 from scipy.integrate import ODEintWarning

ImportError: cannot import name 'ODEintWarning' from 'scipy.integrate' (/home/jakeb/development/scipy/build-install/lib/python3.10/site-packages/scipy/integrate/__init__.py)

In [3]:

After this pr:

In [1]: from scipy.integrate.odepack import ODEintWarning
<ipython-input-1-0b0b6117d43a>:1: DeprecationWarning: `scipy.integrate.odepack.ODEintWarning` is deprecated along with the `scipy.integrate.odepack` namespace. `scipy.integrate.odepack.ODEintWarning` will be removed in SciPy 1.13.0, and the `scipy.integrate.odepack` namespace will be removed in SciPy 2.0.0.
  from scipy.integrate.odepack import ODEintWarning

This also reduces code duplication and strengthens testing.

Additional information

@j-bowhay j-bowhay added scipy.integrate deprecated Items related to behavior that has been deprecated labels Jul 27, 2023
@j-bowhay j-bowhay requested a review from h-vetinari July 27, 2023 04:38
@j-bowhay j-bowhay requested a review from steppi as a code owner July 27, 2023 04:38
@tupui tupui added this to the 1.12.0 milestone Jul 28, 2023
Copy link
Member

@h-vetinari h-vetinari left a comment

Choose a reason for hiding this comment

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

LGTM! (modulo a nit)

scipy/_lib/tests/test_public_api.py Outdated Show resolved Hide resolved
@h-vetinari h-vetinari merged commit 604e7a2 into scipy:main Jul 30, 2023
20 of 25 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
deprecated Items related to behavior that has been deprecated scipy.integrate
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BUG: cannot import ODEintWarning from scipy.integrate
4 participants