Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR contains the following updates:
==1.18.3
->==1.21.4
Release Notes
numpy/numpy
v1.21.4
Compare Source
NumPy 1.21.4 Release Notes
The NumPy 1.21.4 is a maintenance release that fixes a few bugs
discovered after 1.21.3. The most important fix here is a fix for the
NumPy header files to make them work for both x86_64 and M1 hardware
when included in the Mac universal2 wheels. Previously, the header files
only worked for M1 and this caused problems for folks building x86_64
extensions. This problem was not seen before Python 3.10 because there
were thin wheels for x86_64 that had precedence. This release also
provides thin x86_64 Mac wheels for Python 3.10.
The Python versions supported in this release are 3.7-3.10. If you want
to compile your own version using gcc-11, you will need to use gcc-11.2+
to avoid problems.
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 9 pull requests were merged for this release.
dtype
in type stubVOID_nonzero
could sometimes mutate alignment flagArrayterator
typing test failureChecksums
MD5
SHA256
v1.21.3
Compare Source
NumPy 1.21.3 Release Notes
The NumPy 1.21.3 is a maintenance release the fixes a few bugs
discovered after 1.21.2. It also provides 64 bit Python 3.10.0 wheels.
Note a few oddities about Python 3.10:
The Python versions supported in this release are 3.7-3.10. If you want
to compile your own version using gcc-11 you will need to use gcc-11.2+
to avoid problems.
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.
`generic
/ndarray
methodsChecksums
MD5
SHA256
v1.21.2
Compare Source
NumPy 1.21.2 Release Notes
The NumPy 1.21.2 is maintenance release that fixes bugs discovered after
1.21.1. It also provides 64 bit manylinux Python 3.10.0rc1 wheels for
downstream testing. Note that Python 3.10 is not yet final. There is
also preliminary support for Windows on ARM64 builds, but there is no
OpenBLAS for that platform and no wheels are available.
The Python versions supported for this release are 3.7-3.9. The 1.21.x
series is compatible with Python 3.10.0rc1 and Python 3.10 will be
officially supported after it is released. The previous problems with
gcc-11.1 have been fixed by gcc-11.2, check your version if you are
using gcc-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 18 pull requests were merged for this release.
<3.11
numpy.typing
could raise-Werror
isn't applicable...runtest.py
Checksums
MD5
SHA256
v1.21.1
Compare Source
NumPy 1.21.1 Release Notes
The NumPy 1.21.1 is maintenance release that fixes bugs discovered after
the 1.21.0 release and updates OpenBLAS to v0.3.17 to deal with problems
on arm64.
The Python versions supported for this release are 3.7-3.9. The 1.21.x
series is compatible with development Python 3.10. Python 3.10 will be
officially supported after it is released.
warnings when running the tests.
Contributors
A total of 11 people contributed to this release. People with a "+" by
their names contributed a patch for the first time.
Pull requests merged
A total of 26 pull requests were merged for this release.
NotImplemented
withtyping.Any
ndarray.real
andimag
"dtype[Any]"
withdtype
in the definiton of...numpy.f2py.get_include
functionnp.number
subclassesprint()
's in distutils template handlingGenericAlias
test failure for python 3.9.0Checksums
MD5
SHA256
v1.21.0
Compare Source
NumPy 1.21.0 Release Notes
The NumPy 1.21.0 release highlights are
PCG64DXSM
bitgenerator for random numbers.In addition there are the usual large number of bug fixes and other
improvements.
The Python versions supported for this release are 3.7-3.9. Official
support for Python 3.10 will be added when it is released.
-O3
results in many wrong warnings when running the tests.New functions
Add PCG64DXSM BitGenerator
Uses of the PCG64 BitGenerator in a massively-parallel context have
been shown to have statistical weaknesses that were not apparent at the
first release in numpy 1.17. Most users will never observe this weakness
and are safe to continue to use PCG64. We have introduced a new
PCG64DXSM BitGenerator that will eventually become the new default
BitGenerator implementation used by
default_rng
in future releases.PCG64DXSM solves the statistical weakness while preserving the
performance and the features of PCG64.
See
upgrading-pcg64
for more details.(gh-18906)
Expired deprecations
The
shape
argumentnumpy.unravel_index
cannot bepassed as
dims
keyword argument anymore. (Was deprecated in NumPy1.16.)
(gh-17900)
The function
PyUFunc_GenericFunction
has been disabled. It wasdeprecated in NumPy 1.19. Users should call the ufunc directly using
the Python API.
(gh-18697)
The function
PyUFunc_SetUsesArraysAsData
has been disabled. It wasdeprecated in NumPy 1.19.
(gh-18697)
The class
PolyBase
has been removed (deprecated in numpy 1.9.0).Please use the abstract
ABCPolyBase
class instead.(gh-18963)
The unused
PolyError
andPolyDomainError
exceptions are removed.(gh-18963)
Deprecations
The
.dtype
attribute must return adtype
A
DeprecationWarning
is now given if the.dtype
attribute of anobject passed into
np.dtype
or as adtype=obj
argument is not adtype. NumPy will stop attempting to recursively coerce the result of
.dtype
.(gh-13578)
Inexact matches for
numpy.convolve
andnumpy.correlate
are deprecatednumpy.convolve
andnumpy.correlate
nowemit a warning when there are case insensitive and/or inexact matches
found for
mode
argument in the functions. Pass full"same"
,"valid"
,"full"
strings instead of"s"
,"v"
,"f"
for themode
argument.(gh-17492)
np.typeDict
has been formally deprecatednp.typeDict
is a deprecated alias fornp.sctypeDict
and has been sofor over 14 years
(6689502).
A deprecation warning will now be issued whenever getting
np.typeDict
.(gh-17586)
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 wasusually ignored. A warning is now given when the exception is anything
but AttributeError. To silence the warning, the type raising the
exception has to be adapted to raise an
AttributeError
.(gh-19001)
Four
ndarray.ctypes
methods have been deprecatedFour methods of the
ndarray.ctypes
object have beendeprecated, as they are (undocumentated) implementation artifacts of
their respective properties.
The methods in question are:
_ctypes.get_data
(use_ctypes.data
instead)_ctypes.get_shape
(use_ctypes.shape
instead)_ctypes.get_strides
(use_ctypes.strides
instead)_ctypes.get_as_parameter
(use_ctypes._as_parameter_
instead)(gh-19031)
Expired deprecations
The
shape
argumentnumpy.unravel_index
] cannot bepassed as
dims
keyword argument anymore. (Was deprecated in NumPy1.16.)
(gh-17900)
The function
PyUFunc_GenericFunction
has been disabled. It wasdeprecated in NumPy 1.19. Users should call the ufunc directly using
the Python API.
(gh-18697)
The function
PyUFunc_SetUsesArraysAsData
has been disabled. It wasdeprecated in NumPy 1.19.
(gh-18697)
Remove deprecated
PolyBase
and unusedPolyError
andPolyDomainError
The class
PolyBase
has been removed (deprecated in numpy 1.9.0).Please use the abstract
ABCPolyBase
class instead.Furthermore, the unused
PolyError
andPolyDomainError
exceptions areremoved from the
numpy.polynomial
.(gh-18963)
Compatibility notes
Error type changes in universal functions
The universal functions may now raise different errors on invalid input
in some cases. The main changes should be that a
RuntimeError
wasreplaced with a more fitting
TypeError
. When multiple errors werepresent in the same call, NumPy may now raise a different one.
(gh-15271)
__array_ufunc__
argument validationNumPy will now partially validate arguments before calling
__array_ufunc__
. Previously, it was possible to pass on invalidarguments (such as a non-existing keyword argument) when dispatch was
known to occur.
(gh-15271)
__array_ufunc__
and additional positional argumentsPreviously, all positionally passed arguments were checked for
__array_ufunc__
support. In the case ofreduce
,accumulate
, andreduceat
all arguments may be passed by position. This means that whenthey were passed by position, they could previously have been asked to
handle the ufunc call via
__array_ufunc__
. Since this depended on theway the arguments were passed (by position or by keyword), NumPy will
now only dispatch on the input and output array. For example, NumPy will
never dispatch on the
where
array in a reduction such asnp.add.reduce
.(gh-15271)
Validate input values in
Generator.uniform
Checked that
high - low >= 0
innp.random.Generator.uniform
. RaisesValueError
iflow > high
. Previously out-of-order inputs wereaccepted and silently swapped, so that if
low > high
, the valuegenerated was
high + (low - high) * random()
.(gh-17921)
/usr/include
removed from default include pathsThe default include paths when building a package with
numpy.distutils
no longer include
/usr/include
. This path is normally added by thecompiler, and hardcoding it can be problematic. In case this causes a
problem, please open an issue. A workaround is documented in PR 18658.
(gh-18658)
Changes to comparisons with
dtype=...
When the
dtype=
(orsignature
) arguments to comparison ufuncs(
equal
,less
, etc.) is used, this will denote the desired outputdtype in the future. This means that:
will give a
FutureWarning
that it will return anobject
array in thefuture, which currently happens for:
due to the fact that
np.array(None)
is already an object array. (Thisalso happens for some other dtypes.)
Since comparisons normally only return boolean arrays, providing any
other dtype will always raise an error in the future and give a
DeprecationWarning
now.(gh-18718)
Changes to
dtype
andsignature
arguments in ufuncsThe universal function arguments
dtype
andsignature
which are alsovalid for reduction such as
np.add.reduce
(which is the implementationfor
np.sum
) will now issue a warning when thedtype
provided is nota "basic" dtype.
NumPy almost always ignored metadata, byteorder or time units on these
inputs. NumPy will now always ignore it and raise an error if byteorder
or time unit changed. The following are the most important examples of
changes which will give the error. In some cases previously the
information stored was not ignored, in all of these an error is now
raised:
Previously ignored the byte-order (affect if non-native)
The biggest impact is for timedelta or datetimes:
The examples always ignored the time unit "ns":
The following previously did use "ns" (as opposed to
arr.dtype
)The same applies for functions like
np.sum
which use these internally.This change is necessary to achieve consistent handling within NumPy.
If you run into these, in most cases pass for example
dtype=np.timedelta64
which clearly denotes a generaltimedelta64
without any unit or byte-order defined. If you need to specify the
output dtype precisely, you may do so by either casting the inputs or
providing an output array using
out=
.NumPy may choose to allow providing an exact output
dtype
here in thefuture, which would be preceded by a
FutureWarning
.(gh-18718)
Ufunc
signature=...
anddtype=
generalization andcasting
The behaviour for
np.ufunc(1.0, 1.0, signature=...)
ornp.ufunc(1.0, 1.0, dtype=...)
can now yield different loops in 1.21compared to 1.20 because of changes in promotion. When
signature
waspreviously used, the casting check on inputs was relaxed, which could
lead to downcasting inputs unsafely especially if combined with
casting="unsafe"
.Casting is now guaranteed to be safe. If a signature is only partially
provided, for example using
signature=("float64", None, None)
, thiscould lead to no loop being found (an error). In that case, it is
necessary to provide the complete signature to enforce casting the
inputs. If
dtype="float64"
is used or only outputs are set (e.g.signature=(None, None, "float64")
the is unchanged. We expect thatvery few users are affected by this change.
Further, the meaning of
dtype="float64"
has been slightly modified andnow strictly enforces only the correct output (and not input) DTypes.
This means it is now always equivalent to:
(If the ufunc has two inputs and one output). Since this could lead to
no loop being found in some cases, NumPy will normally also search for
the loop:
if the first search failed. In the future, this behaviour may be
customized to achieve the expected results for more complex ufuncs. (For
some universal functions such as
np.ldexp
inputs can have differentDTypes.)
(gh-18880)
Distutils forces strict floating point model on clang
NumPy distutils will now always add the
-ffp-exception-behavior=strict
compiler flag when compiling with clang. Clang defaults to a non-strict
version, which allows the compiler to generate code that does not set
floating point warnings/errors correctly.
(gh-19049)
C API changes
Use of
ufunc->type_resolver
and "type tuple"NumPy now normalizes the "type tuple" argument to the type resolver
functions before calling it. Note that in the use of this type resolver
is legacy behaviour and NumPy will not do so when possible. Calling
ufunc->type_resolver
orPyUFunc_DefaultTypeResolver
is stronglydiscouraged and will now enforce a normalized type tuple if done. Note
that this does not affect providing a type resolver, which is expected
to keep working in most circumstances. If you have an unexpected
use-case for calling the type resolver, please inform the NumPy
developers so that a solution can be found.
(gh-18718)
New Features
Added a mypy plugin for handling platform-specific
numpy.number
precisionsA mypy plugin is now available for
automatically assigning the (platform-dependent) precisions of certain
numpy.number
subclasses, including the likes ofnumpy.int_
,numpy.intp
andnumpy.longlong
. See the documentation onscalar types <arrays.scalars.built-in>
for a comprehensive overview of the affected classes.
Note that while usage of the plugin is completely optional, without it
the precision of above-mentioned classes will be inferred as
typing.Any
.To enable the plugin, one must add it to their mypy [configuration file]
(https://mypy.readthedocs.io/en/stable/config_file.html):
(gh-17843)
Let the mypy plugin manage extended-precision
numpy.number
subclassesThe mypy plugin, introduced in
numpy/numpy#17843, has
been expanded: the plugin now removes annotations for platform-specific
extended-precision types that are not available to the platform in
question. For example, it will remove
numpy.float128
when not available.
Without the plugin all extended-precision types will, as far as mypy
is concerned, be available on all platforms.
To enable the plugin, one must add it to their mypy configuration
file:
(gh-18322)
New
min_digits
argument for printing float valuesA new
min_digits
argument has been added to the dragon4 float printingfunctions
numpy.format_float_positional
andnumpy.format_float_scientific
. This kwd guaranteesthat at least the given number of digits will be printed when printing
in unique=True mode, even if the extra digits are unnecessary to
uniquely specify the value. It is the counterpart to the precision
argument which sets the maximum number of digits to be printed. When
unique=False in fixed precision mode, it has no effect and the precision
argument fixes the number of digits.
(gh-18629)
f2py now recognizes Fortran abstract interface blocks
numpy.f2py
can now parse abstract interface blocks.(gh-18695)
BLAS and LAPACK configuration via environment variables
Autodetection of installed BLAS and LAPACK libraries can be bypassed by
using the
NPY_BLAS_LIBS
andNPY_LAPACK_LIBS
environment variables.Instead, the link flags in these environment variables will be used
directly, and the language is assumed to be F77. This is especially
useful in automated builds where the BLAS and LAPACK that are installed
are known exactly. A use case is replacing the actual implementation at
runtime via stub library links.
If
NPY_CBLAS_LIBS
is set (optional in addition toNPY_BLAS_LIBS
),this will be used as well, by defining
HAVE_CBLAS
and appending theenvironment variable content to the link flags.
(gh-18737)
A runtime-subcriptable alias has been added for
ndarray
numpy.typing.NDArray
has been added, a runtime-subscriptable alias fornp.ndarray[Any, np.dtype[~Scalar]]
. The new type alias can be used forannotating arrays with a given dtype and unspecified shape.
NumPy does not support the annotating of array shapes as of 1.21,
this is expected to change in the future though (see
646
{.interpreted-text role="pep"}).Examples
(gh-18935)
Improvements
Arbitrary
period
option fornumpy.unwrap
The size of the interval over which phases are unwrapped is no longer
restricted to
2 * pi
. This is especially useful for unwrappingdegrees, but can also be used for other intervals.
(gh-16987)
np.unique
now returns singleNaN
When
np.unique
operated on an array with multipleNaN
entries, itsreturn included a
NaN
for each entry that wasNaN
in the originalarray. This is now improved such that the returned array contains just
one
NaN
as the last element.Also for complex arrays all
NaN
values are considered equivalent (nomatter whether the
NaN
is in the real or imaginary part). As therepresentant for the returned array the smallest one in the
lexicographical order is chosen - see
np.sort
for how thelexicographical order is defined for complex arrays.
(gh-18070)
Generator.rayleigh
andGenerator.geometric
performance improvedThe performance of Rayleigh and geometric random variate generation in
Generator
has improved. These are both transformation of exponentialrandom variables and the slow log-based inverse cdf transformation has
been replaced with the Ziggurat-based exponential variate generator.
This change breaks the stream of variates generated when variates from
either of these distributions are produced.
(gh-18666)
Placeholder annotations have been improved
All placeholder annotations, that were previously annotated as
typing.Any
, have been improved. Where appropiate they have beenreplaced with explicit function definitions, classes or other
miscellaneous objects.
([gh-18934](https://togithub.com/numpy/numpy/pull
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 WhiteSource Renovate. View repository job log here.