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: scipy.stats.morestats: clarify deprecation warnings #18649
Conversation
Test passed locally before, then CI merged main and they fail. Looks like this is because |
@h-vetinari @j-bowhay thought this might be up your alley. If not of interest, no problem; I'll go ahead and close. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @mdhaber will give this proper look soon
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the ping @mdhaber!
The plan sounds sensible to me. I haven't gone over it with a fine-toothed comb, but it looks good to me.
Sorry, didn't notice this aspect before. I'd say add it back for now, but no strong preference. |
Thanks @j-bowhay @h-vetinari. I added |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @mdhaber this looks like a good improvement to me. Happy to add the follow-up to my to-do list unless you already have it in the works
I don't. It would be great if you'd like to follow up with the generic version. |
* DEP: scipy.stats.morestats: improve deprecation warnings * DEP: scipy.stats.morestats: refactor deprecation warnings * Apply suggestions from code review * MAINT: stats.morestats: import atleast1D
Reference issue
Toward gh-17572
Toward gh-17771
Toward gh-18279
What does this implement/fix?
scipy.stats.morestats
is:The problem is that the deprecation warning logic does not distinguish between:
(e.g.
scipy.stats.morestats.wilcoxon
should only be imported asscipy.stats.wilcoxon
)(e.g.
scipy.stats.morestats.WilcoxonResult
was never public, and should no longer be imported at all)A solution is to distinguish between the two. With this PR:
With this timeline established, we can remove private attributes like
WilcoxonResult
from the__all__
of these modules in 1.13.0.The logic for public attributes is unchanged, but the deprecation message is more specific about when the module will be removed.
It sounds like there was a decision to remove these namespaces in SciPy 2.0.0, so
import scipy.stats.morestats
will work until 2.0.0, but was there a decision that thatfrom scipy.stats.morestats import wilcoxon
has to work until then? We could adjust the message to state thatscipy.stats.morestats.wilcoxon
will be removed in 1.13.0 and the whole namespace will be removed in 2.0.0.getattr
ing something from one of these modules that does not exist, we get an erroneous error message.Strings that result in this message are never present in the subpackage namespace, as far as I can tell, so there is no reason to suggest looking there. Now:
Additional information
The logic here is easily abstracted to work for any module/subpackage by specifying the appropriate strings. The implementation could live in
_lib
so we can avoid copy-paste and have a consistent message format throughout SciPy. That is work for a follow-up.