chore(deps): update dependency numpy to v1.26.4 #16
Loading…
x
Reference in New Issue
Block a user
No description provided.
Delete Branch "renovate/numpy-1.x"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
This PR contains the following updates:
1.22.3
->1.26.4
Release Notes
numpy/numpy
v1.26.4
Compare Source
NumPy 1.26.4 Release Notes
NumPy 1.26.4 is a maintenance release that fixes bugs and regressions
discovered after the 1.26.3 release. The Python versions supported by
this release are 3.9-3.12. This is the last planned release in the
1.26.x series.
Contributors
A total of 13 people contributed to this release. People with a "+" by
their names contributed a patch for the first time.
Pull requests merged
A total of 19 pull requests were merged for this release.
numpy.array_api
: fixlinalg.cholesky
upper decomp...newaxis
to__all__
innumpy.array_api
__config__.py
Checksums
MD5
SHA256
v1.26.3
Compare Source
NumPy 1.26.3 Release Notes
NumPy 1.26.3 is a maintenance release that fixes bugs and regressions
discovered after the 1.26.2 release. The most notable changes are the
f2py bug fixes. The Python versions supported by this release are
3.9-3.12.
Compatibility
f2py
will no longer accept ambiguous-m
and.pyf
CLI combinations.When more than one
.pyf
file is passed, an error is raised. When both-m
and a.pyf
is passed, a warning is emitted and the-m
providedname is ignored.
Improvements
f2py
now handlescommon
blocks which havekind
specifications frommodules. This further expands the usability of intrinsics like
iso_fortran_env
andiso_c_binding
.Contributors
A total of 18 people contributed to this release. People with a "+" by
their names contributed a patch for the first time.
Pull requests merged
A total of 42 pull requests were merged for this release.
__getitem__
innumpy.array_api
newaxis
andlinalg.solve
innumpy.array_api
long
typebase
in cpu_avx512_knf2py
wrappers when modules and subroutines...iso_c_type
mappings more consistentlyf2py
rewrite withmeson
detailsnumpy/f2py/_backends
from main.f2py/*.py
from main.Checksums
MD5
SHA256
v1.26.2
Compare Source
NumPy 1.26.2 Release Notes
NumPy 1.26.2 is a maintenance release that fixes bugs and regressions
discovered after the 1.26.1 release. The 1.26.release series is the last
planned minor release series before NumPy 2.0. The Python versions
supported by this release are 3.9-3.12.
Contributors
A total of 13 people contributed to this release. People with a "+" by
their names contributed a patch for the first time.
Pull requests merged
A total of 25 pull requests were merged for this release.
import_array()
noexcept
to shuffle helpersallow-noblas
option to true.np.dtype
to itself doesn't crashChecksums
MD5
SHA256
v1.26.1
Compare Source
NumPy 1.26.1 Release Notes
NumPy 1.26.1 is a maintenance release that fixes bugs and regressions
discovered after the 1.26.0 release. In addition, it adds new
functionality for detecting BLAS and LAPACK when building from source.
Highlights are:
The 1.26.release series is the last planned minor release series before
NumPy 2.0. The Python versions supported by this release are 3.9-3.12.
Build system changes
Improved BLAS/LAPACK detection and control
Auto-detection for a number of BLAS and LAPACK is now implemented for
Meson. By default, the build system will try to detect MKL, Accelerate
(on macOS >=13.3), OpenBLAS, FlexiBLAS, BLIS and reference BLAS/LAPACK.
Support for MKL was significantly improved, and support for FlexiBLAS
was added.
New command-line flags are available to further control the selection of
the BLAS and LAPACK libraries to build against.
To select a specific library, use the config-settings interface via
pip
orpypa/build
. E.g., to selectlibblas
/liblapack
, use:This works not only for the libraries named above, but for any library
that Meson is able to detect with the given name through
pkg-config
orCMake.
Besides
-Dblas
and-Dlapack
, a number of other new flags areavailable to control BLAS/LAPACK selection and behavior:
-Dblas-order
and-Dlapack-order
: a list of library names tosearch for in order, overriding the default search order.
-Duse-ilp64
: if set totrue
, use ILP64 (64-bit integer) BLAS andLAPACK. Note that with this release, ILP64 support has been extended
to include MKL and FlexiBLAS. OpenBLAS and Accelerate were supported
in previous releases.
-Dallow-noblas
: if set totrue
, allow NumPy to build with itsinternal (very slow) fallback routines instead of linking against an
external BLAS/LAPACK library. The default for this flag may be
changed to ``true`` in a future 1.26.x release, however for
1.26.1 we'd prefer to keep it as ``false`` because if failures
to detect an installed library are happening, we'd like a bug
report for that, so we can quickly assess whether the new
auto-detection machinery needs further improvements.
-Dmkl-threading
: to select the threading layer for MKL. There arefour options:
seq
,iomp
,gomp
andtbb
. The default isauto
, which selects from those four as appropriate given theversion of MKL selected.
-Dblas-symbol-suffix
: manually select the symbol suffix to use forthe library - should only be needed for linking against libraries
built in a non-standard way.
New features
numpy._core
submodule stubsnumpy._core
submodule stubs were added to provide compatibility withpickled arrays created using NumPy 2.0 when running Numpy 1.26.
Contributors
A total of 13 people contributed to this release. People with a "+" by
their names contributed a patch for the first time.
Pull requests merged
A total of 20 pull requests were merged for this release.
-march=native
...use-compute-credits
for Cirrus.NumpyUnpickler
for backportingnumpy._core
stubs. RemoveNumpyUnpickler
Checksums
MD5
SHA256
v1.26.0
Compare Source
NumPy 1.26.0 Release Notes
The NumPy 1.26.0 release is a continuation of the 1.25.x release cycle
with the addition of Python 3.12.0 support. Python 3.12 dropped
distutils, consequently supporting it required finding a replacement for
the setup.py/distutils based build system NumPy was using. We have
chosen to use the Meson build system instead, and this is the first
NumPy release supporting it. This is also the first release that
supports Cython 3.0 in addition to retaining 0.29.X compatibility.
Supporting those two upgrades was a large project, over 100 files have
been touched in this release. The changelog doesn't capture the full
extent of the work, special thanks to Ralf Gommers, Sayed Adel, Stéfan
van der Walt, and Matti Picus who did much of the work in the main
development branch.
The highlights of this release are:
The Python versions supported in this release are 3.9-3.12.
New Features
Array API v2022.12 support in
numpy.array_api
numpy.array_api
now full supports thev2022.12 version of the array API standard. Note that this does not
yet include the optional
fft
extension in the standard.(gh-23789)
Support for the updated Accelerate BLAS/LAPACK library
Support for the updated Accelerate BLAS/LAPACK library, including ILP64
(64-bit integer) support, in macOS 13.3 has been added. This brings
arm64 support, and significant performance improvements of up to 10x for
commonly used linear algebra operations. When Accelerate is selected at
build time, the 13.3+ version will automatically be used if available.
(gh-24053)
meson
backend forf2py
f2py
in compile mode (i.e.f2py -c
) now accepts the--backend meson
option. This is the default option for Python3.12
on-wards. Older versions will still default to
--backend distutils
.To support this in realistic use-cases, in compile mode
f2py
takes a--dep
flag one or many times which maps todependency()
calls in themeson
backend, and does nothing in thedistutils
backend.There are no changes for users of
f2py
only as a code generator, i.e.without
-c
.(gh-24532)
bind(c)
support forf2py
Both functions and subroutines can be annotated with
bind(c)
.f2py
will handle both the correct type mapping, and preserve the unique label
for other
C
interfaces.Note:
bind(c, name = 'routine_name_other_than_fortran_routine')
isnot honored by the
f2py
bindings by design, sincebind(c)
with thename
is meant to guarantee only the same name inC
andFortran
,not in
Python
andFortran
.(gh-24555)
Improvements
iso_c_binding
support forf2py
Previously, users would have to define their own custom
f2cmap
file touse type mappings defined by the Fortran2003
iso_c_binding
intrinsicmodule. These type maps are now natively supported by
f2py
(gh-24555)
Build system changes
In this release, NumPy has switched to Meson as the build system and
meson-python as the build backend. Installing NumPy or building a wheel
can be done with standard tools like
pip
andpypa/build
. Thefollowing are supported:
pip install numpy
or (in a cloned repo)pip install .
python -m build
(preferred), orpip wheel .
pip install -e . --no-build-isolation
spin:
spin build
.All the regular
pip
andpypa/build
flags (e.g.,--no-build-isolation
) should work as expected.NumPy-specific build customization
Many of the NumPy-specific ways of customizing builds have changed. The
NPY_*
environment variables which control BLAS/LAPACK, SIMD,threading, and other such options are no longer supported, nor is a
site.cfg
file to select BLAS and LAPACK. Instead, there arecommand-line flags that can be passed to the build via
pip
/build
'sconfig-settings interface. These flags are all listed in the
meson_options.txt
file in the root of the repo. Detailed documentedwill be available before the final 1.26.0 release; for now please see
the SciPy "building from source" docs
since most build customization works in an almost identical way in SciPy as it
does in NumPy.
Build dependencies
While the runtime dependencies of NumPy have not changed, the build
dependencies have. Because we temporarily vendor Meson and meson-python,
there are several new dependencies - please see the
[build-system]
section of
pyproject.toml
for details.Troubleshooting
This build system change is quite large. In case of unexpected issues,
it is still possible to use a
setup.py
-based build as a temporaryworkaround (on Python 3.9-3.11, not 3.12), by copying
pyproject.toml.setuppy
topyproject.toml
. However, please open anissue with details on the NumPy issue tracker. We aim to phase out
setup.py
builds as soon as possible, and therefore would like to seeall potential blockers surfaced early on in the 1.26.0 release cycle.
Contributors
A total of 20 people contributed to this release. People with a "+" by
their names contributed a patch for the first time.
Pull requests merged
A total of 59 pull requests were merged for this release.
_NestedSequence.__getitem__
signatureextbuild.py
from main.asv dev
has been removed, useasv run
._umath_linalg
dependenciesbinding
directive to "False".casting
keyword tonp.clip
fromnumeric.pyi
iso_c_binding
type maps and fixbind(c)
...binary_repr
to accept any object implementing...dtype
andgeneric
hashabletyping.assert_type
meson
backend forf2py
spin docs
...Checksums
MD5
SHA256
v1.25.2
Compare Source
NumPy 1.25.2 Release Notes
NumPy 1.25.2 is a maintenance release that fixes bugs and regressions
discovered after the 1.25.1 release. This is the last planned release in
the 1.25.x series, the next release will be 1.26.0, which will use the
meson build system and support Python 3.12. The Python versions
supported by this release are 3.9-3.11.
Contributors
A total of 13 people contributed to this release. People with a "+" by
their names contributed a patch for the first time.
Pull requests merged
A total of 19 pull requests were merged for this release.
-ftrapping-math
with Clang on macOSnp.__all__
getenv
call used for memory policy warningChecksums
MD5
SHA256
v1.25.1
Compare Source
NumPy 1.25.1 Release Notes
NumPy 1.25.1 is a maintenance release that fixes bugs and regressions
discovered after the 1.25.0 release. The Python versions supported by
this release are 3.9-3.11.
Contributors
A total of 10 people contributed to this release. People with a "+" by
their names contributed a patch for the first time.
Pull requests merged
A total of 14 pull requests were merged for this release.
return NULL
to begoto fail
__array_ufunc__
works without any kwargs passedChecksums
MD5
SHA256
v1.25.0
Compare Source
NumPy 1.25.0 Release Notes
The NumPy 1.25.0 release continues the ongoing work to improve the
handling and promotion of dtypes, increase the execution speed, and
clarify the documentation. There has also been work to prepare for the
future NumPy 2.0.0 release, resulting in a large number of new and
expired deprecation. Highlights are:
@=
).We will be releasing a NumPy 1.26 when Python 3.12 comes out. That is
needed because distutils has been dropped by Python 3.12 and we will be
switching to using meson for future builds. The next mainline release
will be NumPy 2.0.0. We plan that the 2.0 series will still support
downstream projects built against earlier versions of NumPy.
The Python versions supported in this release are 3.9-3.11.
Deprecations
np.core.MachAr
is deprecated. It is private API. In names definedin
np.core
should generally be considered private.(gh-22638)
np.finfo(None)
is deprecated.(gh-23011)
np.round_
is deprecated. Usenp.round
instead.(gh-23302)
np.product
is deprecated. Usenp.prod
instead.(gh-23314)
np.cumproduct
is deprecated. Usenp.cumprod
instead.(gh-23314)
np.sometrue
is deprecated. Usenp.any
instead.(gh-23314)
np.alltrue
is deprecated. Usenp.all
instead.(gh-23314)
Only ndim-0 arrays are treated as scalars. NumPy used to treat all
arrays of size 1 (e.g.,
np.array([3.14])
) as scalars. In thefuture, this will be limited to arrays of ndim 0 (e.g.,
np.array(3.14)
). The following expressions will report adeprecation warning:
(gh-10615)
numpy.find_common_type
is now deprecated and its useshould be replaced with either
numpy.result_type
ornumpy.promote_types
. Most users leave the secondscalar_types
argument tofind_common_type
as[]
in which casenp.result_type
andnp.promote_types
are both faster and morerobust. When not using
scalar_types
the main difference is thatthe replacement intentionally converts non-native byte-order to
native byte order. Further,
find_common_type
returnsobject
dtype rather than failing promotion. This leads to differences when
the inputs are not all numeric. Importantly, this also happens for
e.g. timedelta/datetime for which NumPy promotion rules are
currently sometimes surprising.
When the
scalar_types
argument is not[]
things are morecomplicated. In most cases, using
np.result_type
and passing thePython values
0
,0.0
, or0j
has the same result as usingint
,float
, orcomplex
inscalar_types
.When
scalar_types
is constructed,np.result_type
is the correctreplacement and it may be passed scalar values like
np.float32(0.0)
. Passing values other than 0, may lead tovalue-inspecting behavior (which
np.find_common_type
never usedand NEP 50 may change in the future). The main possible change in
behavior in this case, is when the array types are signed integers
and scalar types are unsigned.
If you are unsure about how to replace a use of
scalar_types
orwhen non-numeric dtypes are likely, please do not hesitate to open a
NumPy issue to ask for help.
(gh-22539)
Expired deprecations
np.core.machar
andnp.finfo.machar
have been removed.(gh-22638)
+arr
will now raise an error when the dtype is not numeric (andpositive is undefined).
(gh-22998)
A sequence must now be passed into the stacking family of functions
(
stack
,vstack
,hstack
,dstack
andcolumn_stack
).(gh-23019)
np.clip
now defaults to same-kind casting. Falling back to unsafecasting was deprecated in NumPy 1.17.
(gh-23403)
np.clip
will now propagatenp.nan
values passed asmin
ormax
. Previously, a scalar NaN was usually ignored. This wasdeprecated in NumPy 1.17.
(gh-23403)
The
np.dual
submodule has been removed.(gh-23480)
NumPy now always ignores sequence behavior for an array-like
(defining one of the array protocols). (Deprecation started NumPy
1.20)
(gh-23660)
The niche
FutureWarning
when casting to a subarray dtype inastype
or the array creation functions such asasarray
is nowfinalized. The behavior is now always the same as if the subarray
dtype was wrapped into a single field (which was the workaround,
previously). (FutureWarning since NumPy 1.20)
(gh-23666)
==
and!=
warnings have been finalized. The==
and!=
operators on arrays now always:
raise errors that occur during comparisons such as when the
arrays have incompatible shapes
(
np.array([1, 2]) == np.array([1, 2, 3])
).return an array of all
True
or allFalse
when values arefundamentally not comparable (e.g. have different dtypes). An
example is
np.array(["a"]) == np.array([1])
.This mimics the Python behavior of returning
False
andTrue
when comparing incompatible types like
"a" == 1
and"a" != 1
. For a long time these gaveDeprecationWarning
orFutureWarning
.(gh-22707)
Nose support has been removed. NumPy switched to using pytest in
2018 and nose has been unmaintained for many years. We have kept
NumPy's nose support to avoid breaking downstream projects who
might have been using it and not yet switched to pytest or some
other testing framework. With the arrival of Python 3.12, unpatched
nose will raise an error. It is time to move on.
Decorators removed:
These are not to be confused with pytest versions with similar
names, e.g., pytest.mark.slow, pytest.mark.skipif,
pytest.mark.parametrize.
Functions removed:
(gh-23041)
The
numpy.testing.utils
shim has been removed. Importing from thenumpy.testing.utils
shim has been deprecated since 2019, the shimhas now been removed. All imports should be made directly from
numpy.testing
.(gh-23060)
The environment variable to disable dispatching has been removed.
Support for the
NUMPY_EXPERIMENTAL_ARRAY_FUNCTION
environmentvariable has been removed. This variable disabled dispatching with
__array_function__
.(gh-23376)
Support for
y=
as an alias ofout=
has been removed. Thefix
,isposinf
andisneginf
functions allowed usingy=
as a(deprecated) alias for
out=
. This is no longer supported.(gh-23376)
Compatibility notes
The
busday_count
method now correctly handles cases where thebegindates
is later in time than theenddates
. Previously, theenddates
was included, even though the documentation states it isalways excluded.
(gh-23229)
When comparing datetimes and timedelta using
np.equal
ornp.not_equal
numpy previously allowed the comparison withcasting="unsafe"
. This operation now fails. Forcing the outputdtype using the
dtype
kwarg can make the operation succeed, but wedo not recommend it.
(gh-22707)
When loading data from a file handle using
np.load
, if the handleis at the end of file, as can happen when reading multiple arrays by
calling
np.load
repeatedly, numpy previously raisedValueError
if
allow_pickle=False
, andOSError
ifallow_pickle=True
. Nowit raises
EOFError
instead, in both cases.(gh-23105)
np.pad
withmode=wrap
pads with strict multiples of original dataCode based on earlier version of
pad
that usesmode="wrap"
willreturn different results when the padding size is larger than initial
array.
np.pad
withmode=wrap
now always fills the space with strictmultiples of original data even if the padding size is larger than the
initial array.
(gh-22575)
Cython
long_t
andulong_t
removedlong_t
andulong_t
were aliases forlonglong_t
andulonglong_t
and confusing (a remainder from of Python 2). This change may lead to
the errors:
We recommend use of bit-sized types such as
cnp.int64_t
or the use ofcnp.intp_t
which is 32 bits on 32 bit systems and 64 bits on 64 bitsystems (this is most compatible with indexing). If C
long
is desired,use plain
long
ornpy_long
.cnp.int_t
is alsolong
(NumPy'sdefault integer). However,
long
is 32 bit on 64 bit windows and we maywish to adjust this even in NumPy. (Please do not hesitate to contact
NumPy developers if you are curious about this.)
(gh-22637)
Changed error message and type for bad
axes
argument toufunc
The error message and type when a wrong
axes
value is passed toufunc(..., axes=[...])
has changed. The message is now moreindicative of the problem, and if the value is mismatched an
AxisError
will be raised. ATypeError
will still be raised forinvalidinput types.
(gh-22675)
Array-likes that define
__array_ufunc__
can now override ufuncs if used aswhere
If the
where
keyword argument of anumpy.ufunc
{.interpreted-textrole="class"} is a subclass of
numpy.ndarray
{.interpreted-textrole="class"} or is a duck type that defines
numpy.class.__array_ufunc__
{.interpreted-text role="func"} it canoverride the behavior of the ufunc using the same mechanism as the input
and output arguments. Note that for this to work properly, the
where.__array_ufunc__
implementation will have to unwrap thewhere
argument to pass it into the default implementation of the
ufunc
or,for
numpy.ndarray
{.interpreted-text role="class"} subclasses beforeusing
super().__array_ufunc__
.(gh-23240)
Compiling against the NumPy C API is now backwards compatible by default
NumPy now defaults to exposing a backwards compatible subset of the
C-API. This makes the use of
oldest-supported-numpy
unnecessary.Libraries can override the default minimal version to be compatible with
using:
before including NumPy or by passing the equivalent
-D
option to thecompiler. The NumPy 1.25 default is
NPY_1_19_API_VERSION
. Because theNumPy 1.19 C API was identical to the NumPy 1.16 one resulting programs
will be compatible with NumPy 1.16 (from a C-API perspective). This
default will be increased in future non-bugfix releases. You can still
compile against an older NumPy version and run on a newer one.
For more details please see
for-downstream-package-authors
{.interpreted-text role="ref"}.(gh-23528)
New Features
np.einsum
now accepts arrays withobject
dtypeThe code path will call python operators on object dtype arrays, much
like
np.dot
andnp.matmul
.(gh-18053)
Add support for inplace matrix multiplication
It is now possible to perform inplace matrix multiplication via the
@=
operator.
(gh-21120)
Added
NPY_ENABLE_CPU_FEATURES
environment variableUsers may now choose to enable only a subset of the built CPU features
at runtime by specifying the
NPY_ENABLE_CPU_FEATURES
environment variable. Note that these specified features must be outside
the baseline, since those are always assumed. Errors will be raised if
attempting to enable a feature that is either not supported by your CPU,
or that NumPy was not built with.
(gh-22137)
NumPy now has an
np.exceptions
namespaceNumPy now has a dedicated namespace making most exceptions and warnings
available. All of these remain available in the main namespace, although
some may be moved slowly in the future. The main reason for this is to
increase discoverability and add future exceptions.
(gh-22644)
np.linalg
functions return NamedTuplesnp.linalg
functions that return tuples now return namedtuples. Thesefunctions are
eig()
,eigh()
,qr()
,slogdet()
, andsvd()
. Thereturn type is unchanged in instances where these functions return
non-tuples with certain keyword arguments (like
svd(compute_uv=False)
).(gh-22786)
String functions in
np.char
are compatible with NEP 42 custom dtypesCustom dtypes that represent unicode strings or byte strings can now be
passed to the string functions in
np.char
.(gh-22863)
String dtype instances can be created from the string abstract dtype classes
It is now possible to create a string dtype instance with a size without
using the string name of the dtype. For example,
type(np.dtype('U'))(8)
will create a dtype that is equivalent tonp.dtype('U8')
. This feature is most useful when writing generic codedealing with string dtype classes.
(gh-22963)
Fujitsu C/C++ compiler is now supported
Support for Fujitsu compiler has been added. To build with Fujitsu
compiler, run:
SSL2 is now supported
Support for SSL2 has been added. SSL2 is a library that provides
OpenBLAS compatible GEMM functions. To enable SSL2, it need to edit
site.cfg and build with Fujitsu compiler. See site.cfg.example.
(gh-22982)
Improvements
NDArrayOperatorsMixin
specifies that it has no__slots__
The
NDArrayOperatorsMixin
class now specifies that it contains no__slots__
, ensuring that subclasses can now make use of this featurein Python.
(gh-23113)
Fix power of complex zero
np.power
now returns a different result for0^{non-zero}
for complexnumbers. Note that the value is only defined when the real part of the
exponent is larger than zero. Previously, NaN was returned unless the
imaginary part was strictly zero. The return value is either
0+0j
or0-0j
.(gh-18535)
New
DTypePromotionError
NumPy now has a new
DTypePromotionError
which is used when two dtypescannot be promoted to a common one, for example:
raises this new exception.
(gh-22707)
np.show_config
uses information from MesonBuild and system information now contains information from Meson.
np.show_config
now has a new optional parametermode
tohelp customize the output.
(gh-22769)
Fix
np.ma.diff
not preserving the mask when called with arguments prepend/append.Calling
np.ma.diff
with arguments prepend and/or append now returns aMaskedArray
with the input mask preserved.Previously, a
MaskedArray
without the mask was returned.(gh-22776)
Corrected error handling for NumPy C-API in Cython
Many NumPy C functions defined for use in Cython were lacking the
correct error indicator like
except -1
orexcept *
. These have nowbeen added.
(gh-22997)
Ability to directly spawn random number generators
numpy.random.Generator.spawn
now allows to directly spawn new independentchild generators via the
numpy.random.SeedSequence.spawn
mechanism.numpy.random.BitGenerator.spawn
does the same for the underlying bitgenerator.
Additionally,
numpy.random.BitGenerator.seed_seq
now givesdirect access to the seed sequence used for initializing the bit
generator. This allows for example:
safely use rng, child_rng1, and child_rng2
Previously, this was hard to do without passing the
SeedSequence
explicitly. Please see
numpy.random.SeedSequence
for moreinformation.
(gh-23195)
numpy.logspace
now supports a non-scalarbase
argumentThe
base
argument ofnumpy.logspace
can now be array-like if it isbroadcastable against the
start
andstop
arguments.(gh-23275)
np.ma.dot()
now supports for non-2d arraysPreviously
np.ma.dot()
only worked ifa
andb
were both 2d. Now itworks for non-2d arrays as well as
np.dot()
.(gh-23322)
Explicitly show keys of .npz file in repr
NpzFile
shows keys of loaded .npz file when printed.(gh-23357)
NumPy now exposes DType classes in
np.dtypes
The new
numpy.dtypes
module now exposes DType classes and will containfuture dtype related functionality. Most users should have no need to
use these classes directly.
(gh-23358)
Drop dtype metadata before saving in .npy or .npz files
Currently, a
*.npy
file containing a table with a dtype with metadata cannotbe read back. Now,
np.save
andnp.savez
drop metadata before saving.(gh-23371)
numpy.lib.recfunctions.structured_to_unstructured
returns views in more casesstructured_to_unstructured
now returns a view, if the stride betweenthe fields is constant. Prior, padding between the fields or a reversed
field would lead to a copy. This change only applies to
ndarray
,memmap
andrecarray
. For all other array subclasses, the behaviorremains unchanged.
(gh-23652)
Signed and unsigned integers always compare correctly
When
uint64
andint64
are mixed in NumPy, NumPy typically promotesboth to
float64
. This behavior may be argued about but is confusingfor comparisons
==
,<=
, since the results returned can be incorrectbut the conversion is hidden since the result is a boolean. NumPy will
now return the correct results for these by avoiding the cast to float.
(gh-23713)
Performance improvements and changes
Faster
np.argsort
on AVX-512 enabled processors32-bit and 64-bit quicksort algorithm for np.argsort gain up to 6x speed
up on processors that support AVX-512 instruction set.
Thanks to Intel corporation for sponsoring
this work.
(gh-23707)
Faster
np.sort
on AVX-512 enabled processorsQuicksort for 16-bit and 64-bit dtypes gain up to 15x and 9x speed up on
processors that support AVX-512 instruction set.
Thanks to Intel corporation for sponsoring
this work.
(gh-22315)
__array_function__
machinery is now much fasterThe overhead of the majority of functions in NumPy is now smaller
especially when keyword arguments are used. This change significantly
speeds up many simple function calls.
(gh-23020)
ufunc.at
can be much fasterGeneric
ufunc.at
can be up to 9x faster. The conditions for thisspeedup:
If ufuncs with appropriate indexed loops on 1d arguments with the above
conditions,
ufunc.at
can be up to 60x faster (an additional 7xspeedup). Appropriate indexed loops have been added to
add
,subtract
,multiply
,floor_divide
,maximum
,minimum
,fmax
,and
fmin
.The internal logic is similar to the logic used for regular ufuncs,
which also have fast paths.
Thanks to the D. E. Shaw group for sponsoring
this work.
(gh-23136)
Faster membership test on
NpzFile
Membership test on
NpzFile
will no longer decompress the archive if itis successful.
(gh-23661)
Changes
np.r_[]
andnp.c_[]
with certain scalar valuesIn rare cases, using mainly
np.r_
with scalars can lead to differentresults. The main potential changes are highlighted by the following:
Where the second example returned:
The first one is due to a signed integer scalar with an unsigned integer
array, while the second is due to
255
not fitting intoint8
andNumPy currently inspecting values to make this work. (Note that the
second example is expected to change in the future due to
NEP 50 <NEP50>
{.interpreted-text role="ref"}; it will then raise anerror.)
(gh-22539)
Most NumPy functions are wrapped into a C-callable
To speed up the
__array_function__
dispatching, most NumPy functionsare now wrapped into C-callables and are not proper Python functions or
C methods. They still look and feel the same as before (like a Python
function), and this should only improve performance and user experience
(cleaner tracebacks). However, please inform the NumPy developers if
this change confuses your program for some reason.
(gh-23020)
C++ standard library usage
NumPy builds now depend on the C++ standard library, because the
numpy.core._multiarray_umath
extension is linked with the C++ linker.(gh-23601)
Checksums
MD5
SHA256
v1.24.4
Compare Source
NumPy 1.24.4 Release Notes
NumPy 1.24.4 is a maintenance release that fixes a few bugs
discovered after the 1.24.3 release. It is the last planned
release in the 1.24.x cycle. The Python versions supported by
this release are 3.8-3.11.
Contributors
A total of 4 people contributed to this release. People with a "+" by
their names contributed a patch for the first time.
Pull requests merged
A total of 6 pull requests were merged for this release.
metadata
parameter of...Checksums
MD5
SHA256
v1.24.3
Compare Source
NumPy 1.24.3 Release Notes
NumPy 1.24.3 is a maintenance release that fixes bugs and regressions
discovered after the 1.24.2 release. The Python versions supported by
this release are 3.8-3.11.
Contributors
A total of 12 people contributed to this release. People with a "+" by
their names contributed a patch for the first time.
Pull requests merged
A total of 17 pull requests were merged for this release.
__init__.pyi
.d
argument to fftfreq and rfftfreq as optional...msort
like=
dispatched functionsorder="A"
ororder="K"
Checksums
MD5
SHA256
v1.24.2
Compare Source
NumPy 1.24.2 Release Notes
NumPy 1.24.2 is a maintenance release that fixes bugs and regressions
discovered after the 1.24.1 release. The Python versions supported by
this release are 3.8-3.11.
Contributors
A total of 14 people contributed to this release. People with a "+" by
their names contributed a patch for the first time.
Pull requests merged
A total of 17 pull requests were merged for this release.
_Alignof
rather thanoffsetof()
on most compilersAny
parameter to thenpt.ArrayLike
...Checksums
MD5
SHA256
v1.24.1
Compare Source
NumPy 1.24.1 Release Notes
NumPy 1.24.1 is a maintenance release that fixes bugs and regressions
discovered after the 1.24.0 release. The Python versions supported by
this release are 3.8-3.11.
Contributors
A total of 12 people contributed to this release. People with a "+" by
their names contributed a patch for the first time.
Pull requests merged
A total of 18 pull requests were merged for this release.
charset_normalizer
.Checksums
MD5
SHA256
v1.24.0
Compare Source
NumPy 1.24 Release Notes
The NumPy 1.24.0 release continues the ongoing work to improve the
handling and promotion of dtypes, increase the execution speed, and
clarify the documentation. There are also a large number of new and
expired deprecations due to changes in promotion and cleanups. This
might be called a deprecation release. Highlights are
See below for the details,
This release supports Python versions 3.8-3.11.
Deprecations
Deprecate fastCopyAndTranspose and PyArray_CopyAndTranspose
The
numpy.fastCopyAndTranspose
function has been deprecated. Use thecorresponding copy and transpose methods directly:
The underlying C function
PyArray_CopyAndTranspose
has also beendeprecated from the NumPy C-API.
(gh-22313)
Conversion of out-of-bound Python integers
Attempting a conversion from a Python integer to a NumPy value will now
always check whether the result can be represented by NumPy. This means
the following examples will fail in the future and give a
DeprecationWarning
now:Many of these did succeed before. Such code was mainly useful for
unsigned integers with negative values such as
np.uint8(-1)
givingnp.iinfo(np.uint8).max
.Note that conversion between NumPy integers is unaffected, so that
np.array(-1).astype(np.uint8)
continues to work and use C integeroverflow logic. For negative values, it will also work to view the
array:
np.array(-1, dtype=np.int8).view(np.uint8)
. In some cases,using
np.iinfo(np.uint8).max
orval % 2**8
may also work well.In rare cases input data may mix both negative values and very large
unsigned values (i.e.
-1
and2**63
). There it is unfortunatelynecessary to use
%
on the Python value or use signed or unsignedconversion depending on whether negative values are expected.
(gh-22385)
Deprecate
msort
The
numpy.msort
function is deprecated. Usenp.sort(a, axis=0)
instead.
(gh-22456)
np.str0
and similar are now deprecatedThe scalar type aliases ending in a 0 bit size:
np.object0
,np.str0
,np.bytes0
,np.void0
,np.int0
,np.uint0
as well asnp.bool8
arenow deprecated and will eventually be removed.
(gh-22607)
Expired deprecations
The
normed
keyword argument has been removed from[np.histogram]{.title-ref}, [np.histogram2d]{.title-ref}, and
[np.histogramdd]{.title-ref}. Use
density
instead. Ifnormed
waspassed by position,
density
is now used.(gh-21645)
Ragged array creation will now always raise a
ValueError
unlessdtype=object
is passed. This includes very deeply nestedsequences.
(gh-22004)
Support for Visual Studio 2015 and earlier has been removed.
Support for the Windows Interix POSIX interop layer has been
removed.
(gh-22139)
Support for Cygwin < 3.3 has been removed.
(gh-22159)
The mini() method of
np.ma.MaskedArray
has been removed. Useeither
np.ma.MaskedArray.min()
ornp.ma.minimum.reduce()
.The single-argument form of
np.ma.minimum
andnp.ma.maximum
hasbeen removed. Use
np.ma.minimum.reduce()
ornp.ma.maximum.reduce()
instead.(gh-22228)
Passing dtype instances other than the canonical (mainly native
byte-order) ones to
dtype=
orsignature=
in ufuncs will nowraise a
TypeError
. We recommend passing the strings"int8"
orscalar types
np.int8
since the byte-order, datetime/timedeltaunit, etc. are never enforced. (Initially deprecated in NumPy 1.21.)
(gh-22540)
The
dtype=
argument to comparison ufuncs is now applied correctly.That means that only
bool
andobject
are valid values anddtype=object
is enforced.(gh-22541)
The deprecation for the aliases
np.object
,np.bool
,np.float
,np.complex
,np.str
, andnp.int
is expired (introduces NumPy1.20). Some of these will now give a FutureWarning in addition to
raising an error since they will be mapped to the NumPy scalars in
the future.
(gh-22607)
Compatibility notes
array.fill(scalar)
may behave slightly differentnumpy.ndarray.fill
may in some cases behave slightly different now dueto the fact that the logic is aligned with item assignment:
is now identical to:
Previously casting may have produced slightly different answers when
using values that could not be represented in the target
dtype
or whenthe target had
object
dtype.(gh-20924)
Subarray to object cast now copies
Casting a dtype that includes a subarray to an object will now ensure a
copy of the subarray. Previously an unsafe view was returned:
Is now always false. While previously it was true for the specific cast.
(gh-21925)
Returned arrays respect uniqueness of dtype kwarg objects
When the
dtype
keyword argument is used with:py
np.array()
{.interpreted-text role="func"} or:py
asarray()
{.interpreted-text role="func"}, the dtype of the returnedarray now always exactly matches the dtype provided by the caller.
In some cases this change means that a view rather than the input
array is returned. The following is an example for this on 64bit Linux
where
long
andlonglong
are the same precision but differentdtypes
:Before the change, the
dtype
did not match becausenew is arr
wasTrue
.(gh-21995)
DLPack export raises
BufferError
When an array buffer cannot be exported via DLPack a
BufferError
isnow always raised where previously
TypeError
orRuntimeError
wasraised. This allows falling back to the buffer protocol or
__array_interface__
when DLPack was tried first.(gh-22542)
NumPy builds are no longer tested on GCC-6
Ubuntu 18.04 is deprecated for GitHub actions and GCC-6 is not available
on Ubuntu 20.04, so builds using that compiler are no longer tested. We
still test builds using GCC-7 and GCC-8.
(gh-22598)
New Features
New attribute
symbol
added to polynomial classesThe polynomial classes in the
numpy.polynomial
package have a newsymbol
attribute which is used to represent the indeterminate of thepolynomial. This can be used to change the value of the variable when
printing:
Note that the polynomial classes only support 1D polynomials, so
operations that involve polynomials with different symbols are
disallowed when the result would be multivariate:
The symbol can be any valid Python identifier. The default is
symbol=x
, consistent with existing behavior.(gh-16154)
F2PY support for Fortran
character
stringsF2PY now supports wrapping Fortran functions with:
character x
)character, dimension(n) :: x
)character(len=10) x
)character(len=10), dimension(n, m) :: x
)arguments, including passing Python unicode strings as Fortran character
string arguments.
(gh-19388)
New function
np.show_runtime
A new function
numpy.show_runtime
has been added to display theruntime information of the machine in addition to
numpy.show_config
which displays the build-related information.
(gh-21468)
strict
option fortesting.assert_array_equal
The
strict
option is now available fortesting.assert_array_equal
.Setting
strict=True
will disable the broadcasting behaviour forscalars and ensure that input arrays have the same data type.
(gh-21595)
New parameter
equal_nan
added tonp.unique
np.unique
was changed in 1.21 to treat allNaN
values as equal andreturn a single
NaN
. Settingequal_nan=False
will restore pre-1.21behavior to treat
NaNs
as unique. Defaults toTrue
.(gh-21623)
casting
anddtype
keyword arguments fornumpy.stack
The
casting
anddtype
keyword arguments are now available fornumpy.stack
. To use them, writenp.stack(..., dtype=None, casting='same_kind')
.casting
anddtype
keyword arguments fornumpy.vstack
The
casting
anddtype
keyword arguments are now available fornumpy.vstack
. To use them, writenp.vstack(..., dtype=None, casting='same_kind')
.casting
anddtype
keyword arguments fornumpy.hstack
The
casting
anddtype
keyword arguments are now available fornumpy.hstack
. To use them, writenp.hstack(..., dtype=None, casting='same_kind')
.(gh-21627)
The bit generator underlying the singleton RandomState can be changed
The singleton
RandomState
instance exposed in thenumpy.random
module is initialized at startup with the
MT19937
bit generator. Thenew function
set_bit_generator
allows the default bit generator to bereplaced with a user-provided bit generator. This function has been
introduced to provide a method allowing seamless integration of a
high-quality, modern bit generator in new code with existing code that
makes use of the singleton-provided random variate generating functions.
The companion function
get_bit_generator
returns the current bitgenerator being used by the singleton
RandomState
. This is provided tosimplify restoring the original source of randomness if required.
The preferred method to generate reproducible random numbers is to use a
modern bit generator in an instance of
Generator
. The functiondefault_rng
simplifies instantiation:The same bit generator can then be shared with the singleton instance so
that calling functions in the
random
module will use the same bitgenerator:
The swap is permanent (until reversed) and so any call to functions in
the
random
module will use the new bit generator. The original can berestored if required for code to run correctly:
(gh-21976)
np.void
now has adtype
argumentNumPy now allows constructing structured void scalars directly by
passing the
dtype
argument tonp.void
.(gh-22316)
Improvements
F2PY Improvements
API anymore
f2py
generated exception messagesflake8
warning fixessignature files are prefixed with
f2py_
. For example, one shoulduse
f2py_len(x)
instead oflen(x)
character(f2py_len=...)
is introduced to supportreturning assumed length character strings (e.g.
character(len=*)
)from wrapper functions
A hook to support rewriting
f2py
internal data structures afterreading all its input files is introduced. This is required, for
instance, for BC of SciPy support where character arguments are treated
as character strings arguments in
C
expressions.(gh-19388)
IBM zSystems Vector Extension Facility (SIMD)
Added support for SIMD extensions of zSystem (z13, z14, z15), through
the universal intrinsics interface. This support leads to performance
improvements for all SIMD kernels implemented using the universal
intrinsics, including the following operations: rint, floor, trunc,
ceil, sqrt, absolute, square, reciprocal, tanh, sin, cos, equal,
not_equal, greater, greater_equal, less, less_equal, maximum, minimum,
fmax, fmin, argmax, argmin, add, subtract, multiply, divide.
(gh-20913)
NumPy now gives floating point errors in casts
In most cases, NumPy previously did not give floating point warnings or
errors when these happened during casts. For examples, casts like:
Should now generally give floating point warnings. These warnings should
warn that floating point overflow occurred. For errors when converting
floating point values to integers users should expect invalid value
warnings.
Users can modify the behavior of these warnings using
np.errstate
.Note that for float to int casts, the exact warnings that are given may
be platform dependent. For example:
May give a result equivalent to (the intermediate cast means no warning
is given):
May return an undefined result, with a warning set:
The precise behavior is subject to the C99 standard and its
implementation in both software and hardware.
(gh-21437)
F2PY supports the value attribute
The Fortran standard requires that variables declared with the
value
attribute must be passed by value instead of reference. F2PY now
supports this use pattern correctly. So
integer, intent(in), value :: x
in Fortran codes will have correctwrappers generated.
(gh-21807)
Added pickle support for third-party BitGenerators
The pickle format for bit generators was extended to allow each bit
generator to supply its own constructor when during pickling. Previous
versions of NumPy only supported unpickling
Generator
instancescreated with one of the core set of bit generators supplied with NumPy.
Attempting to unpickle a
Generator
that used a third-party bitgenerators would fail since the constructor used during the unpickling
was only aware of the bit generators included in NumPy.
(gh-22014)
arange() now explicitly fails with dtype=str
Previously, the
np.arange(n, dtype=str)
function worked forn=1
andn=2
, but would raise a non-specific exception message for other valuesof
n
. Now, it raises a [TypeError]{.title-ref} informing thatarange
does not support string dtypes:
(gh-22055)
numpy.typing
protocols are now runtime checkableThe protocols used in
numpy.typing.ArrayLike
andnumpy.typing.DTypeLike
are now properly marked as runtime checkable,making them easier to use for runtime type checkers.
(gh-22357)
Performance improvements and changes
Faster version of
np.isin
andnp.in1d
for integer arraysnp.in1d
(used bynp.isin
) can now switch to a faster algorithm (upto >10x faster) when it is passed two integer arrays. This is often
automatically used, but you can use
kind="sort"
orkind="table"
toforce the old or new method, respectively.
(gh-12065)
Faster comparison operators
The comparison functions (
numpy.equal
,numpy.not_equal
,numpy.less
,numpy.less_equal
,numpy.greater
andnumpy.greater_equal
) are now much faster as they are now vectorizedwith universal intrinsics. For a CPU with SIMD extension AVX512BW, the
performance gain is up to 2.57x, 1.65x and 19.15x for integer, float and
boolean data types, respectively (with N=50000).
(gh-21483)
Changes
Better reporting of integer division overflow
Integer division overflow of scalars and arrays used to provide a
RuntimeWarning
and the return value was undefined leading to crashesat rare occasions:
Integer division overflow now returns the input dtype's minimum value
and raise the following
RuntimeWarning
:(gh-21506)
masked_invalid
now modifies the mask in-placeWhen used with
copy=False
,numpy.ma.masked_invalid
now modifies theinput masked array in-place. This makes it behave identically to
masked_where
and better matches the documentation.(gh-22046)
nditer
/NpyIter
allows all allocating all operandsThe NumPy iterator available through
np.nditer
in Python and asNpyIter
in C now supports allocating all arrays. The iterator shapedefaults to
()
in this case. The operands dtype must be provided,since a "common dtype" cannot be inferred from the other inputs.
(gh-22457)
Checksums
MD5
SHA256
v1.23.5
Compare Source
NumPy 1.23.5 Release Notes
NumPy 1.23.5 is a maintenance release that fixes bugs discovered after
the 1.23.4 release and keeps the build infrastructure current. The
Python versions supported for this release are 3.8-3.11.
Contributors
A total of 7 people contributed to this release. People with a "+" by
their names contributed a patch for the first time.
Pull requests merged
A total of 10 pull requests were merged for this release.
random.logseries
Checksums
MD5
SHA256
v1.23.4
Compare Source
NumPy 1.23.4 Release Notes
NumPy 1.23.4 is a maintenance release that fixes bugs discovered after
the 1.23.3 release and keeps the build infrastructure current. The main
improvements are fixes for some annotation corner cases, a fix for a
long time
nested_iters
memory leak, and a fix of complex vector dotfor very large arrays. The Python versions supported for this release
are 3.8-3.11.
Note that the mypy version needs to be 0.981+ if you test using Python
3.10.7, otherwise the typing tests will fail.
Contributors
A total of 8 people contributed to this release. People with a "+" by
their names contributed a patch for the first time.
Pull requests merged
A total of 13 pull requests were merged for this release.
__array_api_version__
tonumpy.array_api
namespaceget_info
from "extending with Cython"...lookfor
's import try/except againnumpy.typing
protocols as runtime checkableChecksums
MD5
SHA256
v1.23.3
Compare Source
NumPy 1.23.3 Release Notes
NumPy 1.23.3 is a maintenance release that fixes bugs discovered after
the 1.23.2 release. There is no major theme for this release, the main
improvements are for some downstream builds and some annotation corner
cases. The Python versions supported for this release are 3.8-3.11.
Note that we will move to MacOS 11 for the NumPy 1.23.4 release, the
10.15 version currently used will no longer be supported by our build
infrastructure at that point.
Contributors
A total of 16 people contributed to this release. People with a "+" by
their names contributed a patch for the first time.
Pull requests merged
A total of 14 pull requests were merged for this release.
__class_getitem__
np.equal.reduce
raises aTypeError
Checksums
MD5
SHA256
v1.23.2
Compare Source
NumPy 1.23.2 Release Notes
NumPy 1.23.2 is a maintenance release that fixes bugs discovered after
the 1.23.1 release. Notable features are:
The Python versions supported for this release are 3.8-3.11.
Contributors
A total of 9 people contributed to this release. People with a "+" by
their names contributed a patch for the first time.
Pull requests merged
A total of 15 pull requests were merged for this release.
__array_ufunc__
typing support to thenin=1
ufuncsnp.angle
dtype-overloads_GenericAlias
wrap the underlying classes'...einsum
subscripts to be passed via integer...np.generic
rich comparisonssqueeze
andtranspose
method to...Popen
to silently invoke f77 -vChecksums
MD5
SHA256
v1.23.1
Compare Source
NumPy 1.23.1 Release Notes
The NumPy 1.23.1 is a maintenance release that fixes bugs discovered
after the 1.23.0 release. Notable fixes are:
The Python version supported for this release are 3.8-3.10.
Contributors
A total of 7 people contributed to this release. People with a "+" by
their names contributed a patch for the first time.
Pull requests merged
A total of 8 pull requests were merged for this release.
keepdims
during normalization innp.average
and...max_rows
behaviour innp.loadtxt
Checksums
MD5
SHA256
v1.23.0
Compare Source
NumPy 1.23.0 Release Notes
The NumPy 1.23.0 release continues the ongoing work to improve the
handling and promotion of dtypes, increase the execution speed, clarify
the documentation, and expire old deprecations. The highlights are:
loadtxt
in C, greatly improving its performance.See below for the details,
New functions
A masked array specialization of
ndenumerate
is now available asnumpy.ma.ndenumerate
. It provides an alternative tonumpy.ndenumerate
and skips masked values by default.(gh-20020)
numpy.from_dlpack
has been added to allow easy exchange of datausing the DLPack protocol. It accepts Python objects that implement
the
__dlpack__
and__dlpack_device__
methods and returns andarray object which is generally the view of the data of the input
object.
(gh-21145)
Deprecations
Setting
__array_finalize__
toNone
is deprecated. It must now bea method and may wish to call
super().__array_finalize__(obj)
after checking for
None
or if the NumPy version is sufficientlynew.
(gh-20766)
Using
axis=32
(axis=np.MAXDIMS
) in many cases had the samemeaning as
axis=None
. This is deprecated andaxis=None
must beused instead.
(gh-20920)
The hook function
PyDataMem_SetEventHook
has been deprecated andthe demonstration of its use in tool/allocation_tracking has been
removed. The ability to track allocations is now built-in to python
via
tracemalloc
.(gh-20394)
numpy.distutils
has been deprecated, as a result ofdistutils
itself being deprecated. It will not be present in NumPy for
Python >= 3.12, and will be removed completely 2 years after the
release of Python 3.12 For more details, see
distutils-status-migration
{.interpreted-text role="ref"}.(gh-20875)
numpy.loadtxt
will now give aDeprecationWarning
when an integerdtype
is requested but the value is formatted as a floating point number.(gh-21663)
Expired deprecations
The
NpzFile.iteritems()
andNpzFile.iterkeys()
methods have beenremoved as part of the continued removal of Python 2 compatibility.
This concludes the deprecation from 1.15.
(gh-16830)
The
alen
andasscalar
functions have been removed.(gh-20414)
The
UPDATEIFCOPY
array flag has been removed together with theenum
NPY_ARRAY_UPDATEIFCOPY
. The associated (and deprecated)PyArray_XDECREF_ERR
was also removed. These were all deprecated in1.14. They are replaced by
WRITEBACKIFCOPY
, that requires callingPyArray_ResoveWritebackIfCopy
before the array is deallocated.(gh-20589)
Exceptions will be raised during array-like creation. When an object
raised an exception during access of the special attributes
__array__
or__array_interface__
, this exception was usuallyignored. This behaviour was deprecated in 1.21, and the exception
will now be raised.
(gh-20835)
Multidimensional indexing with non-tuple values is not allowed.
Previously, code such as
arr[ind]
whereind = [[0, 1], [0, 1]]
produced a
FutureWarning
and was interpreted as a multidimensionalindex (i.e.,
arr[tuple(ind)]
). Now this example is treated like anarray index over a single dimension (
arr[array(ind)]
).Multidimensional indexing with anything but a tuple was deprecated
in NumPy 1.15.
(gh-21029)
Changing to a dtype of different size in F-contiguous arrays is no
longer permitted. Deprecated since Numpy 1.11.0. See below for an
extended explanation of the effects of this change.
(gh-20722)
New Features
crackfortran has support for operator and assignment overloading
crackfortran
parser now understands operator and assignmentdefinitions in a module. They are added in the
body
list of the modulewhich contains a new key
implementedby
listing the names of thesubroutines or functions implementing the operator or assignment.
(gh-15006)
f2py supports reading access type attributes from derived type statements
As a result, one does not need to use
public
orprivate
statementsto specify derived type access properties.
(gh-15844)
New parameter
ndmin
added togenfromtxt
This parameter behaves the same as
ndmin
fromnumpy.loadtxt
.(gh-20500)
np.loadtxt
now supports quote character and single converter functionnumpy.loadtxt
now supports an additionalquotechar
keyword argumentwhich is not set by default. Using
quotechar='"'
will read quotedfields as used by the Excel CSV dialect.
Further, it is now possible to pass a single callable rather than a
dictionary for the
converters
argument.(gh-20580)
Changing to dtype of a different size now requires contiguity of only the last axis
Previously, viewing an array with a dtype of a different item size
required that the entire array be C-contiguous. This limitation would
unnecessarily force the user to make contiguous copies of non-contiguous
arrays before being able to change the dtype.
This change affects not only
ndarray.view
, but other constructionmechanisms, including the discouraged direct assignment to
ndarray.dtype
.This change expires the deprecation regarding the viewing of
F-contiguous arrays, described elsewhere in the release notes.
(gh-20722)
Deterministic output files for F2PY
For F77 inputs,
f2py
will generatemodname-f2pywrappers.f
unconditionally, though these may be empty. For free-form inputs,
modname-f2pywrappers.f
,modname-f2pywrappers2.f90
will both begenerated unconditionally, and may be empty. This allows writing generic
output rules in
cmake
ormeson
and other build systems. Olderbehavior can be restored by passing
--skip-empty-wrappers
tof2py
.f2py-meson
{.interpreted-text role="ref"} details usage.(gh-21187)
keepdims
parameter foraverage
The parameter
keepdims
was added to the functionsnumpy.average
andnumpy.ma.average
. The parameter has the same meaning as it does inreduction functions such as
numpy.sum
ornumpy.mean
.(gh-21485)
New parameter
equal_nan
added tonp.unique
np.unique
was changed in 1.21 to treat allNaN
values as equal andreturn a single
NaN
. Settingequal_nan=False
will restore pre-1.21behavior to treat
NaNs
as unique. Defaults toTrue
.(gh-21623)
Compatibility notes
1D
np.linalg.norm
preserves float input types, even for scalar resultsPreviously, this would promote to
float64
when theord
argument wasnot one of the explicitly listed values, e.g.
ord=3
:This change affects only
float32
andfloat16
vectors withord
other than
-Inf
,0
,1
,2
, andInf
.(gh-17709)
Changes to structured (void) dtype promotion and comparisons
In general, NumPy now defines correct, but slightly limited, promotion
for structured dtypes by promoting the subtypes of each field instead of
raising an exception:
For promotion matching field names, order, and titles are enforced,
however padding is ignored. Promotion involving structured dtypes now
always ensures native byte-order for all fields (which may change the
result of
np.concatenate
) and ensures that the result will be"packed", i.e. all fields are ordered contiguously and padding is
removed. See
structured_dtype_comparison_and_promotion
{.interpreted-textrole="ref"} for further details.
The
repr
of aligned structures will now never print the long formincluding
offsets
anditemsize
unless the structure includes paddingnot guaranteed by
align=True
.In alignment with the above changes to the promotion logic, the casting
safety has been updated:
"equiv"
enforces matching names and titles. The itemsize isallowed to differ due to padding.
"safe"
allows mismatching field names and titlesfield.
field. Previously, the field names were used and only unsafe casts
were possible when names mismatched.
The main important change here is that name mismatches are now
considered "safe" casts.
(gh-19226)
NPY_RELAXED_STRIDES_CHECKING
has been removedNumPy cannot be compiled with
NPY_RELAXED_STRIDES_CHECKING=0
anymore.Relaxed strides have been the default for many years and the option was
initially introduced to allow a smoother transition.
(gh-20220)
np.loadtxt
has recieved several changesThe row counting of
numpy.loadtxt
was fixed.loadtxt
ignores fullyempty lines in the file, but counted them towards
max_rows
. Whenmax_rows
is used and the file contains empty lines, these will now notbe counted. Previously, it was possible that the result contained fewer
than
max_rows
rows even though more data was available to be read. Ifthe old behaviour is required,
itertools.islice
may be used:While generally much faster and improved,
numpy.loadtxt
may now failto converter certain strings to numbers that were previously
successfully read. The most important cases for this are:
1.0
into integers is nowdeprecated.
0x3p3
will fail_
was previously accepted as a thousands delimiter100_000
.This will now result in an error.
If you experience these limitations, they can all be worked around by
passing appropriate
converters=
. NumPy now supports passing a singleconverter to be used for all columns to make this more convenient. For
example,
converters=float.fromhex
can read hexadecimal float numbersand
converters=int
will be able to read100_000
.Further, the error messages have been generally improved. However, this
means that error types may differ. In particularly, a
ValueError
isnow always raised when parsing of a single entry fails.
(gh-20580)
Improvements
ndarray.__array_finalize__
is now callableThis means subclasses can now use
super().__array_finalize__(obj)
without worrying whether
ndarray
is their superclass or not. Theactual call remains a no-op.
(gh-20766)
Add support for VSX4/Power10
With VSX4/Power10 enablement, the new instructions available in Power
ISA 3.1 can be used to accelerate some NumPy operations, e.g.,
floor_divide, modulo, etc.
(gh-20821)
np.fromiter
now accepts objects and subarraysThe
numpy.fromiter
function now supports object and subarray dtypes.Please see he function documentation for examples.
(gh-20993)
Math C library feature detection now uses correct signatures
Compiling is preceded by a detection phase to determine whether the
underlying libc supports certain math operations. Previously this code
did not respect the proper signatures. Fixing this enables compilation
for the
wasm-ld
backend (compilation for web assembly) and reduces thenumber of warnings.
(gh-21154)
np.kron
now maintains subclass informationnp.kron
maintains subclass information now such as masked arrays whilecomputing the Kronecker product of the inputs
⚠️ Warning,
np.kron
output now followsufunc
ordering (multiply
) to determinethe output class type
(gh-21262)
Performance improvements and changes
Faster
np.loadtxt
numpy.loadtxt
is now generally much faster than previously as most ofit is now implemented in C.
(gh-20580)
Faster reduction operators
Reduction operations like
numpy.sum
,numpy.prod
,numpy.add.reduce
,numpy.logical_and.reduce
on contiguous integer-based arrays are nowmuch faster.
(gh-21001)
Faster
np.where
numpy.where
is now much faster than previously on unpredictable/randominput data.
(gh-21130)
Faster operations on NumPy scalars
Many operations on NumPy scalars are now significantly faster, although
rare operations (e.g. with 0-D arrays rather than scalars) may be slower
in some cases. However, even with these improvements users who want the
best performance for their scalars, may want to convert a known NumPy
scalar into a Python one using
scalar.item()
.(gh-21188)
Faster
np.kron
numpy.kron
is about 80% faster as the product is now computed usingbroadcasting.
(gh-21354)
Checksums
MD5
SHA256
v1.22.4
Compare Source
NumPy 1.22.4 Release Notes
NumPy 1.22.4 is a maintenance release that fixes bugs discovered after
the 1.22.3 release. In addition, the wheels for this release are built
using the recently released Cython 0.29.30, which should fix the
reported problems with
debugging.
The Python versions supported for this release are 3.8-3.10. Note that
the Mac wheels are now based on OS X 10.15 rather than 10.6 that was
used in previous NumPy release cycles.
Contributors
A total of 12 people contributed to this release. People with a "+" by
their names contributed a patch for the first time.
Pull requests merged
A total of 22 pull requests were merged for this release.
np.lib.stride_tricks
re-exported under the...numpy._typing
npy_memchr
withno_sanitize("alignment")
on clangChecksums
MD5
SHA256
Configuration
📅 Schedule: At any time (no schedule defined).
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
This PR has been generated by Renovate Bot.
chore(deps): update dependency numpy to v1.22.4to chore(deps): update dependency numpy to v1.23.03148df0074
tof17273a001
chore(deps): update dependency numpy to v1.23.0to chore(deps): update dependency numpy to v1.23.1f17273a001
to78abd63d46
chore(deps): update dependency numpy to v1.23.1to chore(deps): update dependency numpy to v1.23.278abd63d46
to8b52c6dae3
chore(deps): update dependency numpy to v1.23.2to chore(deps): update dependency numpy to v1.23.38b52c6dae3
toe04fed0368
chore(deps): update dependency numpy to v1.23.3to chore(deps): update dependency numpy to v1.23.4e04fed0368
to0952c90b72
chore(deps): update dependency numpy to v1.23.4to chore(deps): update dependency numpy to v1.23.50952c90b72
to28fd3174cf
chore(deps): update dependency numpy to v1.23.5to chore(deps): update dependency numpy to v1.24.028fd3174cf
tof9b0243a79
chore(deps): update dependency numpy to v1.24.0to chore(deps): update dependency numpy to v1.24.1f9b0243a79
tob913ae9680
chore(deps): update dependency numpy to v1.24.1to chore(deps): update dependency numpy to v1.24.2b913ae9680
to5fb6360083
5fb6360083
toa0e7d2afe6
chore(deps): update dependency numpy to v1.24.2to chore(deps): update dependency numpy to v1.24.3a0e7d2afe6
to6cd80f3ddb
chore(deps): update dependency numpy to v1.24.3to chore(deps): update dependency numpy to v1.25.0⚠ Artifact update problem
Renovate failed to update an artifact related to this branch. You probably do not want to merge this PR as-is.
♻ Renovate will retry this branch, including artifacts, only when one of the following happens:
The artifact failure details are included below:
File name: poetry.lock
6cd80f3ddb
to61cbd31b77
chore(deps): update dependency numpy to v1.25.0to chore(deps): update dependency numpy to v1.25.161cbd31b77
tod883cc91c7
d883cc91c7
to2081fe8c20
2081fe8c20
toe0fc64f892
chore(deps): update dependency numpy to v1.25.1to chore(deps): update dependency numpy to v1.25.2e0fc64f892
tob026e69e3d
chore(deps): update dependency numpy to v1.25.2to chore(deps): update dependency numpy to v1.26.0b026e69e3d
to8f3a190a43
chore(deps): update dependency numpy to v1.26.0to chore(deps): update dependency numpy to v1.26.18f3a190a43
tof26d0029d1
chore(deps): update dependency numpy to v1.26.1to chore(deps): update dependency numpy to v1.26.2f26d0029d1
to4bd2f99b7f
chore(deps): update dependency numpy to v1.26.2to chore(deps): update dependency numpy to v1.26.34bd2f99b7f
to8a293ae29e
chore(deps): update dependency numpy to v1.26.3to chore(deps): update dependency numpy to v1.26.48a293ae29e
toce0d891bf4
ce0d891bf4
to86d4089d26
86d4089d26
to0548a57861
0548a57861
to4a7cd2b0e3
4a7cd2b0e3
tob3c3412609
b3c3412609
toc288e42e5f
Checkout
From your project repository, check out a new branch and test the changes.