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

MAINT: remove incidental imports from private modules #19904

Merged
merged 9 commits into from
May 18, 2024

Conversation

h-vetinari
Copy link
Member

@h-vetinari h-vetinari commented Jan 18, 2024

This has now grown into a full-blown fix for #19905; while we're targetting 1.14 with this, I wanted to check if we're actually warning in all cases (after discovering some potential discrepancies).


Previously:

Some more follow-ups from the work for #18279, same as #19893.

I've tried & failed to import these on 1.11 resp 1.12; the imports are fully ignored AFAICT due to the presence of __all__ in those private modules.

Not sure what the intention there was @j-bowhay, but in any case, this should be good to remove IMO.

@mdhaber
Copy link
Contributor

mdhaber commented Jan 18, 2024

These imports were intentional; they were part of the plan to remove these unnecessary imports (and other pseudo-public attributes) in a backward compatible way. The current behavior is, e.g.:

from scipy.optimize.slsqp import exp

which produces the desired warning message.

DeprecationWarning: `scipy.optimize.slsqp.exp` is deprecated along with the `scipy.optimize.slsqp` namespace. `scipy.optimize.slsqp.exp` will be removed in SciPy 1.13.0, and the `scipy.optimize.slsqp` namespace will be removed in SciPy 2.0.0.

The tests checking this behavior are failing. But I guess they can be removed now too since we said they'd be removed in SciPy 1.13.0.

@h-vetinari
Copy link
Member Author

The current behavior is, e.g.:

In one of these discussions the reason given for keeping these imports was that they once were part of __all__. As it happens, that wasn't the case anymore for the import I removed in #19893, but still affects some of the functions here.

These imports were intentional and part of the plan to fix gh-18279.

In any case, we've scheduled them for removal in 1.13, so the timing is still OK. 🙃

@mdhaber
Copy link
Contributor

mdhaber commented Jan 18, 2024

So yeah, go ahead and remove the tests. It's fine with me to take all these out now, even if 1.13 is coming earlier than usual.

@h-vetinari
Copy link
Member Author

In any case, we've scheduled them for removal in 1.13, so the timing is still OK. 🙃

Actually, we've delayed this to 1.14 in #19892. So I'll wait until 1.13 is out.

@h-vetinari h-vetinari marked this pull request as draft January 18, 2024 07:28
@h-vetinari h-vetinari changed the title MAINT: remove some redundant imports MAINT: remove incidental imports from private modules Jan 18, 2024
@h-vetinari h-vetinari force-pushed the imports branch 2 times, most recently from 34972e4 to a916e13 Compare January 18, 2024 07:42
scipy/integrate/vode.py Outdated Show resolved Hide resolved
@h-vetinari
Copy link
Member Author

@j-bowhay this is mainly a follow-up to your efforts around removing those incidental imports - I think it's ready and would appreciate your review (I think we were close already a month ago; I suggest to finish this now).

@j-bowhay
Copy link
Member

Both this and #19673 are very much still on my radar I just need to finish a few exams and assignments before I can spend more than 10 minutes looking at something! I will get to this in May which I assume is fine with the 1.14 timeline.

@tupui tupui added this to the 1.14.0 milestone Apr 22, 2024
@j-bowhay
Copy link
Member

Friendly ping @h-vetinari as I am keen to get this in before branching for the next release. Can you resolve the merge conflicts?

@j-bowhay
Copy link
Member

It looks like you've accidentally picked up a submodule change

@h-vetinari
Copy link
Member Author

While I generally ask not to, this PR can (or even: should) be squash-merged.

@h-vetinari
Copy link
Member Author

The failure here is unrelated:

 =========================== short test summary info ===========================
FAILED scipy\optimize\tests\test_constraint_conversion.py::TestNewToOld::test_individual_constraint_objects
= 1 failed, 63629 passed, 3042 skipped, 246 xfailed, 14 xpassed in 648.81s (0:10:48) =

@h-vetinari
Copy link
Member Author

Any further comments here @j-bowhay et al.? 🙃

Copy link
Member

@j-bowhay j-bowhay left a comment

Choose a reason for hiding this comment

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

LGTM and thanks for tackling @h-vetinari

@j-bowhay j-bowhay merged commit c3cb9af into scipy:main May 18, 2024
30 of 31 checks passed
@h-vetinari h-vetinari deleted the imports branch May 18, 2024 12:25
@h-vetinari
Copy link
Member Author

Thanks for reviews & merging!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
maintenance Items related to regular maintenance tasks
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants