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: special: improve deprecation of private modules named without underscore prefix #19469

Merged
merged 2 commits into from Nov 8, 2023

Conversation

j-bowhay
Copy link
Member

@j-bowhay j-bowhay commented Nov 3, 2023

Reference issue

towards #18279

What does this implement/fix?

Currently, some deprecation warnings for private modules named without underscore prefixes are misleading. For example:
Before this pr:

In [1]: from scipy.special.orthogonal import arange
<ipython-input-1-18b058905c34>:1: DeprecationWarning: Please use `arange` from the `scipy.special` namespace, the `scipy.special.orthogonal` namespace is deprecated.
  from scipy.special.orthogonal import arange

After:

In [4]: from scipy.special.orthogonal import arange
<ipython-input-4-18b058905c34>:1: DeprecationWarning: `scipy.special.orthogonal.arange` is deprecated along with the `scipy.special.orthogonal` namespace. `scipy.special.orthogonal.arange` will be removed in SciPy 1.13.0, and the `scipy.special.orthogonal` namespace will be removed in SciPy 2.0.0.
  from scipy.special.orthogonal import arange

Additional information

@j-bowhay j-bowhay added scipy.special deprecated Items related to behavior that has been deprecated labels Nov 3, 2023
return getattr(_orthogonal, name)
return _sub_module_deprecation(sub_package="special", module="orthogonal",
private_modules=["_orthogonal"], all=__all__,
attribute=name)
Copy link
Member

Choose a reason for hiding this comment

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

mind the no-new-line here

return getattr(_sf_error, name)
return _sub_module_deprecation(sub_package="special", module="sf_error",
private_modules=["_sf_error"], all=__all__,
attribute=name)
Copy link
Member

Choose a reason for hiding this comment

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

no new line here either

scipy/special/basic.py Outdated Show resolved Hide resolved
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.

Approved module the style nits that were pointed out (i.e. once those are fixed, consider it good to go). Thanks!

scipy/special/orthogonal.py Outdated Show resolved Hide resolved
scipy/special/sf_error.py Outdated Show resolved Hide resolved
[skip ci]

Co-authored-by: Lucas Colley <lucas.colley8@gmail.com>
Copy link
Member

@lucascolley lucascolley left a comment

Choose a reason for hiding this comment

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

The indentation change can be applied to all of the files, not just the one fixed above. Otherwise LGTM

@j-bowhay j-bowhay added this to the 1.12.0 milestone Nov 8, 2023
@j-bowhay j-bowhay merged commit d769eef into scipy:main Nov 8, 2023
perimosocordiae pushed a commit to perimosocordiae/scipy that referenced this pull request Nov 8, 2023
…derscore prefix (scipy#19469)

* DEP: special: improve deprecation of private modules named without underscore prefix

* STY: fix style issues

[skip ci]

Co-authored-by: Lucas Colley <lucas.colley8@gmail.com>

---------

Co-authored-by: Lucas Colley <lucas.colley8@gmail.com>
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.special
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants