Skip to content

DEP: remove deprecated 'full' and 'economic' modes from numpy.linalg.qr#31387

Merged
seberg merged 4 commits into
numpy:mainfrom
AshutoshDevpura:maint/remove-deprecated-qr-modes
Jun 3, 2026
Merged

DEP: remove deprecated 'full' and 'economic' modes from numpy.linalg.qr#31387
seberg merged 4 commits into
numpy:mainfrom
AshutoshDevpura:maint/remove-deprecated-qr-modes

Conversation

@AshutoshDevpura
Copy link
Copy Markdown
Contributor

@AshutoshDevpura AshutoshDevpura commented May 5, 2026

PR summary

Closes gh-11521 (partial)

The 'full', 'f', 'economic', and 'e' modes of numpy.linalg.qr
were deprecated in NumPy 1.8.0 (2013-04-01). This PR removes them now
that we are at v2.5.0.dev0.

Changes:

  • Remove DeprecationWarning branches for 'full'/'f' and 'economic'/'e'
  • Raise ValueError for these modes instead
  • Remove the mode == 'economic' return branch
  • Remove unused import warnings
  • Update docstring to remove references to deprecated modes
  • Update test_deprecations.py to expect ValueError instead of DeprecationWarning
  • Add release note in doc/release/upcoming_changes/

First time committer introduction

Hi! I'm Ashutosh, a Data Scientist working on ML systems (XGBoost, LSTM)
for credit risk modeling. I contribute to open source ML libraries in my
spare time.

AI Disclosure

I used Claude (AI assistant) to help navigate the codebase and understand
where the deprecated code lived. The actual changes, removing the warning
branches, updating the docstring, fixing the tests, and adding the release
note were performed/reviewed and understood by me before submitting.

@jorenham jorenham changed the title MAINT: remove deprecated 'full' and 'economic' modes from numpy.linalg.qr DEP: remove deprecated 'full' and 'economic' modes from numpy.linalg.qr May 5, 2026
@jorenham
Copy link
Copy Markdown
Member

jorenham commented May 5, 2026

Please fill in the AI disclosure from the PR template that you ignored

@AshutoshDevpura
Copy link
Copy Markdown
Contributor Author

Updated the PR description with the AI disclosure. Thanks for the heads up!

Copy link
Copy Markdown
Member

@seberg seberg left a comment

Choose a reason for hiding this comment

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

Thanks! Please try to avoid those style changes and the linter is failing right now (long line).
I also think we should just not mention the old path, since it is deprecated for many many years.

If this was still used a lot, the path would be a VisibleDeprecationWarning, but hopefully we can get away with this since Python got better at showing DeprecationWarning's.

Comment thread numpy/linalg/tests/test_deprecations.py
Comment thread numpy/linalg/tests/test_deprecations.py
Comment thread numpy/linalg/tests/test_deprecations.py Outdated

"""
def test_qr_mode_full_removed():
"""Check mode='full' and mode='economic' raise ValueError after removal in NumPy 2.5."""
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Long line fails the linter.

Comment thread numpy/linalg/_linalg.py Outdated
backward compatibility can be maintained by letting `mode` default.
NumPy 1.8.0 and the old option 'full' was made an alias of 'reduced'.
The deprecated 'full' and 'economic' modes were removed in NumPy 2.5.
Use 'reduced' instead of 'full', and 'raw' instead of 'economic'.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think we should just remove the whole note about any changes. 1.8 is too long ago to bother about things being "new" and the error is already plenty as an assistance for anyone who didn't act on the deprecation warning.

@AshutoshDevpura
Copy link
Copy Markdown
Contributor Author

Addressed the review, removed the historical note from the docstring, fixed the long line, and restored the original test file formatting. Thanks for the feedback!

Copy link
Copy Markdown
Member

@seberg seberg left a comment

Choose a reason for hiding this comment

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

Thanks, let's give this a shot.

If anyone runs into this in real-world code or things the old modes are still used a lot, please let us know and we could go back to a VisibleDeprecationWarning.

@seberg seberg merged commit da62208 into numpy:main Jun 3, 2026
85 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

DEP: remove code with expired deprecations (tracking issue)

3 participants