Skip to content

MAINT: expire deprecations #28254

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

Merged
merged 6 commits into from
Feb 2, 2025
Merged

MAINT: expire deprecations #28254

merged 6 commits into from
Feb 2, 2025

Conversation

mattip
Copy link
Member

@mattip mattip commented Jan 30, 2025

This will be the release note once I have a PR number

  • Remove deprecated macros like NPY_OWNDATA from cython interfaces in favor of NPY_ARRAY_OWNDATA (deprecated since 1.7)
  • Remove numpy/npy_1_7_deprecated_api.h and C macros like NPY_OWNDATA in favor of NPY_ARRAY_OWNDATA (deprecated since 1.7)
  • Remove alias generate_divbyzero_error to npy_set_floatstatus_divbyzero and generate_overflow_error to npy_set_floatstatus_overflow (deprecated since 1.10)
  • Remove np.tostring (deprecated since 1.19)
  • Raise on np.conjugate of non-numeric types (deprecated since 1.13)
  • Raise when using np.bincount(...minlength=None), use 0 intead (deprecated since 1.14)
  • Passing shape=None to functions with a non-optional shape argument raises, use () instead (deprecated since 1.20)
  • Inexact matches for mode and searchside raise (deprecated since 1.20)
  • Setting __array_finalize__ = None raises (deprecated since 1.23)
  • np.fromfile and np.fromstring error on bad data, previously they would guess (deprecated since 1.18)
  • datetime64 and timedelta64 construction with a tuple no longer accepts an event value, either use a two-tuple of (unit, num) or a 4-tuple of (unit, num, den, 1) (deprecated since 1.14)
  • When constructing a dtype from a class with a dtype attribute, that attribute must be a dtype-instance rather than a thing that can be parsed as a dtype instance (deprecated in 1.19). At some point the whole construct of using a dtype attribute will be deprecated (see DEP: Deprecate constructing dtypes from any object having a .dtype attribute #25306)
  • Passing booleans as partition index errors (deprecated since 1.23)
  • Out-of-bounds indexes error even on empty arrays (deprecated since 1.20)
  • np.tostring has been removed, use `tobytes instead (deprecated since 1.19)
  • Disallow make a non-writeable array writeable for arrays with a base that do not own their data (deprecated since 1.17)
  • concatenate() with axis=None uses same-kind casting by default, not unsafe (deprecated since 1.20)
  • Unpickling a scalar with object dtype raises (deprecated since 1.20)
  • The binary mode of fromstring now raises, use frombuffer instead (deprecated since 1.14)
  • Converting np.inexact or np.floating to a dtype errors (deprecated since 1.19)
  • Converting np.complex, np.integer, np.signedinteger, np.unsignedinteger, np.genericto a dtype raises, it used to convert tocomplex128` (deprecated since 1.19)
  • The Python built-in round errors for complex scalars. Use np.round or scalar.round instead (deprecated since 1.19)
  • 'np.bool' scalars can no longer be interpreted as an index (deprecated since 1.19)
  • Parsing an integer via a float string is no longer supported. (deprecated since 1.23) To avoid this error you can
    • make sure the original data is stored as integers.
    • use the converters=float keyword argument.
    • Use np.loadtxt(...).astype(np.int64)
  • The use of a length 1 tuple for the ufunc signature errors. Use dtype or fill the tuple with None (deprecated since 1.19)
  • Special handling of matrix is in np.outer is removed. Convert to a ndarray via matrix.A (deprecated since 1.20)

@mattip
Copy link
Member Author

mattip commented Jan 31, 2025

The benchmarks were using deprecated np.tostring. Is there a way to make sure we raise on deprecation warnings in benchmark runs?

@seberg
Copy link
Member

seberg commented Jan 31, 2025

Very nice, thanks! Have to look through once more, but these all seem straight forward.

The C ones seem potentially higher noise. I think that is acceptable, but maybe we should duplicate a slightly longer release note in the c_api section.

The benchmarks were using deprecated np.tostring. Is there a way to make sure we raise on deprecation warnings in benchmark runs?

Hmmm, we go via the spin command now in .spin/cmds.py. So it is a bit wrapped up, and I think the easiest thing would be to add an export PYTHONWARNINGS=error to the CI run. At least I think that should work, of course there might be more warnings.)

@charris
Copy link
Member

charris commented Jan 31, 2025

There is still a reference to tostring in doc/source/reference/arrays.ndarray.rst:289.

@charris charris modified the milestones: 2.2.3 release, 2.3.0 release Feb 1, 2025
@charris charris changed the title expire deprecations MAINT: expire deprecations Feb 1, 2025
@mattip
Copy link
Member Author

mattip commented Feb 2, 2025

CI is passing

@jorenham
Copy link
Member

jorenham commented Feb 2, 2025

I'll address the remaining stub changes in a follow-up PR

@charris charris merged commit ac4c308 into numpy:main Feb 2, 2025
69 checks passed
@charris
Copy link
Member

charris commented Feb 2, 2025

Thanks Matti. Let's get this in and see how it shakes out.

tacaswell added a commit to tacaswell/pyopencl that referenced this pull request Feb 12, 2025
These were deprecated in np1.7 and will be removed in np2.3 (currently removed
on numpy main branch).

xref numpy/numpy#28254
inducer pushed a commit to inducer/pyopencl that referenced this pull request Feb 13, 2025
These were deprecated in np1.7 and will be removed in np2.3 (currently removed
on numpy main branch).

xref numpy/numpy#28254
@mattip mattip deleted the expire-deprecations branch May 5, 2025 11:22
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.

4 participants