From b9a5c35f80c8e05cd8178bace99809eb5b129c7a Mon Sep 17 00:00:00 2001 From: DongHun Kwak Date: Thu, 31 Dec 2020 09:37:29 +0900 Subject: Imported Upstream version 1.17.0 --- doc/C_STYLE_GUIDE.rst.txt | 19 +- doc/DISTUTILS.rst.txt | 181 +++++- doc/HOWTO_RELEASE.rst.txt | 38 +- doc/Makefile | 56 +- doc/RELEASE_WALKTHROUGH.rst.txt | 45 +- doc/TESTS.rst.txt | 32 +- doc/changelog/1.15.0-changelog.rst | 2 +- doc/changelog/1.16.1-changelog.rst | 2 +- doc/changelog/1.16.5-changelog.rst | 54 -- doc/changelog/1.16.6-changelog.rst | 36 -- doc/changelog/1.17.0-changelog.rst | 694 +++++++++++++++++++++ doc/neps/nep-0010-new-iterator-ufunc.rst | 4 +- doc/neps/nep-0016-abstract-array.rst | 2 +- doc/neps/nep-0018-array-function-protocol.rst | 255 +++++--- doc/neps/nep-0019-rng-policy.rst | 74 +-- doc/neps/nep-0020-gufunc-signature-enhancement.rst | 2 +- doc/neps/nep-0026-missing-data-summary.rst | 4 +- doc/neps/nep-0027-zero-rank-arrarys.rst | 28 +- doc/neps/roadmap.rst | 129 ++-- doc/release/1.12.0-notes.rst | 2 + doc/release/1.14.4-notes.rst | 2 +- doc/release/1.15.6-notes.rst | 52 -- doc/release/1.16.0-notes.rst | 4 +- doc/release/1.16.5-notes.rst | 68 -- doc/release/1.16.6-notes.rst | 85 --- doc/release/1.17.0-notes.rst | 562 +++++++++++++++++ doc/release/template.rst | 12 +- doc/source/_templates/indexcontent.html | 2 + doc/source/about.rst | 2 +- doc/source/benchmarking.rst | 1 + doc/source/conf.py | 38 +- doc/source/dev/development_environment.rst | 11 +- doc/source/dev/development_workflow.rst | 510 +++++++++++++++ doc/source/dev/gitwash/development_workflow.rst | 510 --------------- doc/source/dev/gitwash/following_latest.rst | 4 - doc/source/dev/gitwash/git_development.rst | 14 - doc/source/dev/gitwash/git_intro.rst | 40 +- doc/source/dev/gitwash/git_links.inc | 5 +- doc/source/dev/gitwash/index.rst | 26 +- doc/source/dev/gitwash/pull_button.png | Bin 12893 -> 0 bytes doc/source/dev/governance/people.rst | 7 +- doc/source/dev/index.rst | 222 ++++++- doc/source/dev/pull_button.png | Bin 0 -> 12893 bytes doc/source/docs/howto_build_docs.rst | 2 +- doc/source/reference/arrays.classes.rst | 4 - doc/source/reference/arrays.dtypes.rst | 9 +- doc/source/reference/arrays.indexing.rst | 18 +- doc/source/reference/arrays.ndarray.rst | 36 +- doc/source/reference/arrays.scalars.rst | 8 +- doc/source/reference/c-api.array.rst | 174 +++--- doc/source/reference/c-api.config.rst | 19 + doc/source/reference/c-api.coremath.rst | 15 +- doc/source/reference/c-api.dtype.rst | 57 +- doc/source/reference/c-api.iterator.rst | 49 +- .../reference/c-api.types-and-structures.rst | 171 +++-- doc/source/reference/distutils.rst | 100 +-- doc/source/reference/maskedarray.baseclass.rst | 90 +-- .../random/bit_generators/bitgenerators.rst | 11 + .../reference/random/bit_generators/index.rst | 112 ++++ .../reference/random/bit_generators/mt19937.rst | 34 + .../reference/random/bit_generators/pcg64.rst | 33 + .../reference/random/bit_generators/philox.rst | 35 ++ .../reference/random/bit_generators/sfc64.rst | 28 + doc/source/reference/random/entropy.rst | 6 + doc/source/reference/random/extending.rst | 165 +++++ doc/source/reference/random/generator.rst | 84 +++ doc/source/reference/random/index.rst | 212 +++++++ doc/source/reference/random/legacy.rst | 125 ++++ doc/source/reference/random/multithreading.rst | 108 ++++ doc/source/reference/random/new-or-different.rst | 118 ++++ doc/source/reference/random/parallel.rst | 193 ++++++ doc/source/reference/random/performance.py | 87 +++ doc/source/reference/random/performance.rst | 153 +++++ doc/source/reference/routines.char.rst | 16 +- doc/source/reference/routines.dtype.rst | 3 +- doc/source/reference/routines.linalg.rst | 13 + doc/source/reference/routines.ma.rst | 13 +- doc/source/reference/routines.math.rst | 1 + doc/source/reference/routines.other.rst | 8 - doc/source/reference/routines.random.rst | 83 --- doc/source/reference/routines.rst | 2 +- doc/source/reference/routines.testing.rst | 2 - doc/source/reference/ufuncs.rst | 9 +- doc/source/release.rst | 3 +- doc/source/user/basics.io.genfromtxt.rst | 6 - doc/source/user/building.rst | 61 +- doc/source/user/c-info.how-to-extend.rst | 75 +-- doc/source/user/numpy-for-matlab-users.rst | 14 +- doc/source/user/quickstart.rst | 13 +- doc/source/user/whatisnumpy.rst | 17 +- 90 files changed, 4659 insertions(+), 1772 deletions(-) delete mode 100644 doc/changelog/1.16.5-changelog.rst delete mode 100644 doc/changelog/1.16.6-changelog.rst create mode 100644 doc/changelog/1.17.0-changelog.rst delete mode 100644 doc/release/1.15.6-notes.rst delete mode 100644 doc/release/1.16.5-notes.rst delete mode 100644 doc/release/1.16.6-notes.rst create mode 100644 doc/release/1.17.0-notes.rst create mode 100644 doc/source/benchmarking.rst create mode 100644 doc/source/dev/development_workflow.rst delete mode 100644 doc/source/dev/gitwash/development_workflow.rst delete mode 100644 doc/source/dev/gitwash/git_development.rst delete mode 100644 doc/source/dev/gitwash/pull_button.png create mode 100644 doc/source/dev/pull_button.png create mode 100644 doc/source/reference/random/bit_generators/bitgenerators.rst create mode 100644 doc/source/reference/random/bit_generators/index.rst create mode 100644 doc/source/reference/random/bit_generators/mt19937.rst create mode 100644 doc/source/reference/random/bit_generators/pcg64.rst create mode 100644 doc/source/reference/random/bit_generators/philox.rst create mode 100644 doc/source/reference/random/bit_generators/sfc64.rst create mode 100644 doc/source/reference/random/entropy.rst create mode 100644 doc/source/reference/random/extending.rst create mode 100644 doc/source/reference/random/generator.rst create mode 100644 doc/source/reference/random/index.rst create mode 100644 doc/source/reference/random/legacy.rst create mode 100644 doc/source/reference/random/multithreading.rst create mode 100644 doc/source/reference/random/new-or-different.rst create mode 100644 doc/source/reference/random/parallel.rst create mode 100644 doc/source/reference/random/performance.py create mode 100644 doc/source/reference/random/performance.rst delete mode 100644 doc/source/reference/routines.random.rst (limited to 'doc') diff --git a/doc/C_STYLE_GUIDE.rst.txt b/doc/C_STYLE_GUIDE.rst.txt index a5726f16f..07f4b99df 100644 --- a/doc/C_STYLE_GUIDE.rst.txt +++ b/doc/C_STYLE_GUIDE.rst.txt @@ -10,9 +10,6 @@ to achieve uniformity. Because the NumPy conventions are very close to those in PEP-0007, that PEP is used as a template below with the NumPy additions and variations in the appropriate spots. -NumPy modified PEP-0007 -======================= - Introduction ------------ @@ -31,10 +28,7 @@ Two good reasons to break a particular rule: C dialect --------- -* Use ANSI/ISO standard C (the 1989 version of the standard). - This means, amongst many other things, that all declarations - must be at the top of a block (not necessarily at the top of - function). +* Use C99 (that is, the standard defined by ISO/IEC 9899:1999). * Don't use GCC extensions (e.g. don't write multi-line strings without trailing backslashes). Preferably break long strings @@ -49,9 +43,6 @@ C dialect * All function declarations and definitions must use full prototypes (i.e. specify the types of all arguments). -* Do not use C++ style // one line comments, they aren't portable. - Note: this will change with the proposed transition to C++. - * No compiler warnings with major compilers (gcc, VC++, a few others). Note: NumPy still produces compiler warnings that need to be addressed. @@ -138,7 +129,7 @@ Code lay-out the open paren, no spaces inside the parens, no spaces before commas, one space after each comma. -* Always put spaces around assignment, Boolean and comparison +* Always put spaces around the assignment, Boolean and comparison operators. In expressions using a lot of operators, add spaces around the outermost (lowest priority) operators. @@ -179,12 +170,12 @@ Code lay-out Trailing comments should be used sparingly. Instead of :: - if (yes) {/* Success! */ + if (yes) { // Success! do :: if (yes) { - /* Success! */ + // Success! * All functions and global variables should be declared static when they aren't needed outside the current compilation unit. @@ -201,7 +192,7 @@ Naming conventions In the future the names should be of the form ``Npy*_PublicFunction``, where the star is something appropriate. -* Public Macros should have a NPY_ prefix and then use upper case, +* Public Macros should have a ``NPY_`` prefix and then use upper case, for example, ``NPY_DOUBLE``. * Private functions should be lower case with underscores, for example: diff --git a/doc/DISTUTILS.rst.txt b/doc/DISTUTILS.rst.txt index c027afff2..eadde63f8 100644 --- a/doc/DISTUTILS.rst.txt +++ b/doc/DISTUTILS.rst.txt @@ -297,11 +297,182 @@ in writing setup scripts: + ``config.get_info(*names)`` --- -Template files --------------- -XXX: Describe how files with extensions ``.f.src``, ``.pyf.src``, -``.c.src``, etc. are pre-processed by the ``build_src`` command. +.. _templating: + +Conversion of ``.src`` files using Templates +-------------------------------------------- + +NumPy distutils supports automatic conversion of source files named +.src. This facility can be used to maintain very similar +code blocks requiring only simple changes between blocks. During the +build phase of setup, if a template file named .src is +encountered, a new file named is constructed from the +template and placed in the build directory to be used instead. Two +forms of template conversion are supported. The first form occurs for +files named .ext.src where ext is a recognized Fortran +extension (f, f90, f95, f77, for, ftn, pyf). The second form is used +for all other cases. + +.. index:: + single: code generation + +Fortran files +------------- + +This template converter will replicate all **function** and +**subroutine** blocks in the file with names that contain '<...>' +according to the rules in '<...>'. The number of comma-separated words +in '<...>' determines the number of times the block is repeated. What +these words are indicates what that repeat rule, '<...>', should be +replaced with in each block. All of the repeat rules in a block must +contain the same number of comma-separated words indicating the number +of times that block should be repeated. If the word in the repeat rule +needs a comma, leftarrow, or rightarrow, then prepend it with a +backslash ' \'. If a word in the repeat rule matches ' \\' then +it will be replaced with the -th word in the same repeat +specification. There are two forms for the repeat rule: named and +short. + +Named repeat rule +^^^^^^^^^^^^^^^^^ + +A named repeat rule is useful when the same set of repeats must be +used several times in a block. It is specified using , where N is the number of times the block +should be repeated. On each repeat of the block, the entire +expression, '<...>' will be replaced first with item1, and then with +item2, and so forth until N repeats are accomplished. Once a named +repeat specification has been introduced, the same repeat rule may be +used **in the current block** by referring only to the name +(i.e. . + + +Short repeat rule +^^^^^^^^^^^^^^^^^ + +A short repeat rule looks like . The +rule specifies that the entire expression, '<...>' should be replaced +first with item1, and then with item2, and so forth until N repeats +are accomplished. + + +Pre-defined names +^^^^^^^^^^^^^^^^^ + +The following predefined named repeat rules are available: + +- + +- <_c=s,d,c,z> + +- <_t=real, double precision, complex, double complex> + +- + +- + +- + +- + + +Other files +------------ + +Non-Fortran files use a separate syntax for defining template blocks +that should be repeated using a variable expansion similar to the +named repeat rules of the Fortran-specific repeats. + +NumPy Distutils preprocesses C source files (extension: :file:`.c.src`) written +in a custom templating language to generate C code. The :c:data:`@` symbol is +used to wrap macro-style variables to empower a string substitution mechanism +that might describe (for instance) a set of data types. + +The template language blocks are delimited by :c:data:`/**begin repeat` +and :c:data:`/**end repeat**/` lines, which may also be nested using +consecutively numbered delimiting lines such as :c:data:`/**begin repeat1` +and :c:data:`/**end repeat1**/`: + +1. "/\**begin repeat "on a line by itself marks the beginning of +a segment that should be repeated. + +2. Named variable expansions are defined using ``#name=item1, item2, item3, +..., itemN#`` and placed on successive lines. These variables are +replaced in each repeat block with corresponding word. All named +variables in the same repeat block must define the same number of +words. + +3. In specifying the repeat rule for a named variable, ``item*N`` is short- +hand for ``item, item, ..., item`` repeated N times. In addition, +parenthesis in combination with \*N can be used for grouping several +items that should be repeated. Thus, #name=(item1, item2)*4# is +equivalent to #name=item1, item2, item1, item2, item1, item2, item1, +item2# + +4. "\*/ "on a line by itself marks the end of the variable expansion +naming. The next line is the first line that will be repeated using +the named rules. + +5. Inside the block to be repeated, the variables that should be expanded +are specified as ``@name@`` + +6. "/\**end repeat**/ "on a line by itself marks the previous line +as the last line of the block to be repeated. + +7. A loop in the NumPy C source code may have a ``@TYPE@`` variable, targeted +for string substitution, which is preprocessed to a number of otherwise +identical loops with several strings such as INT, LONG, UINT, ULONG. The +``@TYPE@`` style syntax thus reduces code duplication and maintenance burden by +mimicking languages that have generic type support. + +The above rules may be clearer in the following template source example: + +.. code-block:: NumPyC + :linenos: + :emphasize-lines: 3, 13, 29, 31 + + /* TIMEDELTA to non-float types */ + + /**begin repeat + * + * #TOTYPE = BYTE, UBYTE, SHORT, USHORT, INT, UINT, LONG, ULONG, + * LONGLONG, ULONGLONG, DATETIME, + * TIMEDELTA# + * #totype = npy_byte, npy_ubyte, npy_short, npy_ushort, npy_int, npy_uint, + * npy_long, npy_ulong, npy_longlong, npy_ulonglong, + * npy_datetime, npy_timedelta# + */ + + /**begin repeat1 + * + * #FROMTYPE = TIMEDELTA# + * #fromtype = npy_timedelta# + */ + static void + @FROMTYPE@_to_@TOTYPE@(void *input, void *output, npy_intp n, + void *NPY_UNUSED(aip), void *NPY_UNUSED(aop)) + { + const @fromtype@ *ip = input; + @totype@ *op = output; + + while (n--) { + *op++ = (@totype@)*ip++; + } + } + /**end repeat1**/ + + /**end repeat**/ + +The preprocessing of generically typed C source files (whether in NumPy +proper or in any third party package using NumPy Distutils) is performed +by `conv_template.py`_. +The type specific C files generated (extension: .c) +by these modules during the build process are ready to be compiled. This +form of generic typing is also supported for C header files (preprocessed +to produce .h files). + +.. _conv_template.py: https://github.com/numpy/numpy/blob/master/numpy/distutils/conv_template.py Useful functions in ``numpy.distutils.misc_util`` ------------------------------------------------- @@ -427,7 +598,7 @@ Extra features in NumPy Distutils ''''''''''''''''''''''''''''''''' Specifying config_fc options for libraries in setup.py script ------------------------------------------------------------- +------------------------------------------------------------- It is possible to specify config_fc options in setup.py scripts. For example, using diff --git a/doc/HOWTO_RELEASE.rst.txt b/doc/HOWTO_RELEASE.rst.txt index a6a8fe8ab..e2aea12b7 100644 --- a/doc/HOWTO_RELEASE.rst.txt +++ b/doc/HOWTO_RELEASE.rst.txt @@ -5,7 +5,7 @@ Current build and release info ============================== The current info on building and releasing NumPy and SciPy is scattered in -several places. It should be summarized in one place, updated and where +several places. It should be summarized in one place, updated, and where necessary described in more detail. The sections below list all places where useful info can be found. @@ -37,8 +37,8 @@ Supported platforms and versions ================================ Python 2.7 and >=3.4 are the currently supported versions when building from -source. We test numpy against all these versions every time we merge code to -trunk. Binary installers may be available for a subset of these versions (see +source. We test NumPy against all these versions every time we merge code to +master. Binary installers may be available for a subset of these versions (see below). OS X @@ -54,7 +54,7 @@ Windows ------- We build 32- and 64-bit wheels for Python 2.7, 3.4, 3.5 on Windows. Windows -XP, Vista, 7, 8 and 10 are supported. We build numpy using the MSVC compilers +XP, Vista, 7, 8 and 10 are supported. We build NumPy using the MSVC compilers on Appveyor, but we are hoping to update to a `mingw-w64 toolchain `_. The Windows wheels use ATLAS for BLAS / LAPACK. @@ -62,7 +62,7 @@ Linux ----- We build and ship `manylinux1 `_ -wheels for numpy. Many Linux distributions include their own binary builds +wheels for NumPy. Many Linux distributions include their own binary builds of NumPy. BSD / Solaris @@ -93,7 +93,7 @@ each platform. At the moment this means: * Manylinux1 wheels use the gcc provided on the Manylinux docker images. You will need Cython for building the binaries. Cython compiles the ``.pyx`` -files in the numpy distribution to ``.c`` files. +files in the NumPy distribution to ``.c`` files. Building source archives and wheels ----------------------------------- @@ -130,9 +130,9 @@ Uploading to PyPI Generating author/pr lists -------------------------- -You will need an personal access token +You will need a personal access token ``_ -so that scripts can access the github numpy repository +so that scripts can access the github NumPy repository. * gitpython (pip) * pygithub (pip) @@ -182,8 +182,8 @@ After a date is set, create a new maintenance/x.y.z branch, add new empty release notes for the next version in the master branch and update the Trac Milestones. -Make sure current trunk builds a package correctly --------------------------------------------------- +Make sure current branch builds a package correctly +--------------------------------------------------- :: git clean -fxd @@ -191,7 +191,7 @@ Make sure current trunk builds a package correctly python setup.py sdist To actually build the binaries after everything is set up correctly, the -release.sh script can be used. For details of the build process itself it is +release.sh script can be used. For details of the build process itself, it is best to read the pavement.py script. .. note:: The following steps are repeated for the beta(s), release @@ -233,7 +233,7 @@ There are three steps to the process. 2. If the C_API_VERSION in the first step has changed, or if the hash of the API has changed, the cversions.txt file needs to be updated. To check - the hash, run the script numpy/core/cversions.py and note the api hash that + the hash, run the script numpy/core/cversions.py and note the API hash that is printed. If that hash does not match the last hash in numpy/core/code_generators/cversions.txt the hash has changed. Using both the appropriate C_API_VERSION and hash, add a new entry to cversions.txt. @@ -244,7 +244,7 @@ There are three steps to the process. definitive. If steps 1 and 2 are done correctly, compiling the release should not give - a warning "API mismatch detect at the beginning of the build. + a warning "API mismatch detect at the beginning of the build". 3. The numpy/core/include/numpy/numpyconfig.h will need a new NPY_X_Y_API_VERSION macro, where X and Y are the major and minor version @@ -271,7 +271,7 @@ Mention at least the following: - outlook for the near future Also make sure that as soon as the branch is made, there is a new release -notes file in trunk for the next release. +notes file in the master branch for the next release. Update the release status and create a release "tag" ---------------------------------------------------- @@ -318,10 +318,10 @@ The ``-s`` flag makes a PGP (usually GPG) signed tag. Please do sign the release tags. The release tag should have the release number in the annotation (tag -message). Unfortunately the name of a tag can be changed without breaking the +message). Unfortunately, the name of a tag can be changed without breaking the signature, the contents of the message cannot. -See : https://github.com/scipy/scipy/issues/4919 for a discussion of signing +See: https://github.com/scipy/scipy/issues/4919 for a discussion of signing release tags, and https://keyring.debian.org/creating-key.html for instructions on creating a GPG key if you do not have one. @@ -479,9 +479,9 @@ Announce to the lists The release should be announced on the mailing lists of NumPy and SciPy, to python-announce, and possibly also those of -Matplotlib,IPython and/or Pygame. +Matplotlib, IPython and/or Pygame. -During the beta/RC phase an explicit request for testing the binaries with +During the beta/RC phase, an explicit request for testing the binaries with several other libraries (SciPy/Matplotlib/Pygame) should be posted on the mailing list. @@ -497,5 +497,5 @@ After the final release is announced, a few administrative tasks are left to be done: - Forward port changes in the release branch to release notes and release - scripts, if any, to trunk. + scripts, if any, to master branch. - Update the Milestones in Trac. diff --git a/doc/Makefile b/doc/Makefile index d61d115f0..842d2ad13 100644 --- a/doc/Makefile +++ b/doc/Makefile @@ -1,23 +1,34 @@ # Makefile for Sphinx documentation # -PYVER = 3 +# PYVER needs to be major.minor, just "3" doesn't work - it will result in +# issues with the amendments to PYTHONPATH and install paths (see DIST_VARS). + +# Use explicit "version_info" indexing since make cannot handle colon characters, and +# evaluate it now to allow easier debugging when printing the variable + +PYVER:=$(shell python3 -c 'from sys import version_info as v; print("{0}.{1}".format(v[0], v[1]))') PYTHON = python$(PYVER) +NUMPYVER:=$(shell python3 -c "import numpy; print(numpy.version.git_revision[:10])") +GITVER ?= $(shell cd ..; python3 -c "from setup import git_version; \ + print(git_version()[:10])") + # You can set these variables from the command line. -SPHINXOPTS = -SPHINXBUILD = LANG=C sphinx-build -PAPER = +SPHINXOPTS ?= +SPHINXBUILD ?= LANG=C sphinx-build +PAPER ?= FILES= # Internal variables. PAPEROPT_a4 = -D latex_paper_size=a4 PAPEROPT_letter = -D latex_paper_size=letter -ALLSPHINXOPTS = -d build/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) source +ALLSPHINXOPTS = -WT --keep-going -d build/doctrees $(PAPEROPT_$(PAPER)) \ + $(SPHINXOPTS) source .PHONY: help clean html web pickle htmlhelp latex changes linkcheck \ - dist dist-build gitwash-update + dist dist-build gitwash-update version-check #------------------------------------------------------------------------------ @@ -35,7 +46,20 @@ help: @echo " upload USERNAME=... RELEASE=... to upload built docs to docs.scipy.org" clean: - -rm -rf build/* source/reference/generated + -rm -rf build/* + find . -name generated -type d -prune -exec rm -rf "{}" ";" + +version-check: +ifeq "$(GITVER)" "Unknown" + # @echo sdist build with unlabeled sources +else ifneq ($(NUMPYVER),$(GITVER)) + @echo installed numpy $(NUMPYVER) != current repo git version \'$(GITVER)\' + @echo use '"make dist"' or '"GITVER=$(NUMPYVER) make $(MAKECMDGOALS) ..."' + @exit 1 +else + # for testing + # @echo installed numpy $(NUMPYVER) matches git version $(GITVER); exit 1 +endif gitwash-update: rm -rf source/dev/gitwash @@ -58,7 +82,7 @@ gitwash-update: # -INSTALL_DIR = $(CURDIR)/build/inst-dist/ +INSTALL_DIR = $(CURDIR)/build/inst-dist INSTALL_PPH = $(INSTALL_DIR)/lib/python$(PYVER)/site-packages:$(INSTALL_DIR)/local/lib/python$(PYVER)/site-packages:$(INSTALL_DIR)/lib/python$(PYVER)/dist-packages:$(INSTALL_DIR)/local/lib/python$(PYVER)/dist-packages UPLOAD_DIR=/srv/docs_scipy_org/doc/numpy-$(RELEASE) @@ -112,7 +136,7 @@ build/generate-stamp: $(wildcard source/reference/*.rst) mkdir -p build touch build/generate-stamp -html: generate +html: generate version-check mkdir -p build/html build/doctrees $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) build/html $(FILES) $(PYTHON) postprocess.py html build/html/*.html @@ -125,7 +149,7 @@ html-scipyorg: @echo @echo "Build finished. The HTML pages are in build/html." -pickle: generate +pickle: generate version-check mkdir -p build/pickle build/doctrees $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) build/pickle $(FILES) @echo @@ -135,7 +159,7 @@ pickle: generate web: pickle -htmlhelp: generate +htmlhelp: generate version-check mkdir -p build/htmlhelp build/doctrees $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) build/htmlhelp $(FILES) @echo @@ -146,11 +170,11 @@ htmlhelp-build: htmlhelp build/htmlhelp/numpy.chm %.chm: %.hhp -hhc.exe $^ -qthelp: generate +qthelp: generate version-check mkdir -p build/qthelp build/doctrees $(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) build/qthelp $(FILES) -latex: generate +latex: generate version-check mkdir -p build/latex build/doctrees $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) build/latex $(FILES) $(PYTHON) postprocess.py tex build/latex/*.tex @@ -160,18 +184,18 @@ latex: generate @echo "Run \`make all-pdf' or \`make all-ps' in that directory to" \ "run these through (pdf)latex." -coverage: build +coverage: build version-check mkdir -p build/coverage build/doctrees $(SPHINXBUILD) -b coverage $(ALLSPHINXOPTS) build/coverage $(FILES) @echo "Coverage finished; see c.txt and python.txt in build/coverage" -changes: generate +changes: generate version-check mkdir -p build/changes build/doctrees $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) build/changes $(FILES) @echo @echo "The overview file is in build/changes." -linkcheck: generate +linkcheck: generate version-check mkdir -p build/linkcheck build/doctrees $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) build/linkcheck $(FILES) @echo diff --git a/doc/RELEASE_WALKTHROUGH.rst.txt b/doc/RELEASE_WALKTHROUGH.rst.txt index 960bb3f3e..6987dd6c1 100644 --- a/doc/RELEASE_WALKTHROUGH.rst.txt +++ b/doc/RELEASE_WALKTHROUGH.rst.txt @@ -6,6 +6,11 @@ replace 1.14.5 by the correct version. Release Walkthrough ==================== +Note that in the code snippets below, ``upstream`` refers to the root repository on +github and ``origin`` to a fork in your personal account. You may need to make adjustments +if you have not forked the repository but simply cloned it locally. You can +also edit ``.git/config`` and add ``upstream`` if it isn't already present. + Backport Pull Requests ---------------------- @@ -55,7 +60,7 @@ Edit pavement.py and setup.py as detailed in HOWTO_RELEASE:: Sanity check:: - $ python runtests.py -m "full" + $ python runtests.py -m "full" # NumPy < 1.17 only $ python3 runtests.py -m "full" Push this release directly onto the end of the maintenance branch. This @@ -86,7 +91,7 @@ commit. This can take a while. The numpy-wheels repository is cloned from may have been accessed and changed by someone else and a push will fail:: $ cd ../numpy-wheels - $ git pull origin master + $ git pull upstream master $ git branch # only when starting new numpy version $ git checkout v1.14.x # v1.14.x already existed for the 1.14.4 release @@ -96,7 +101,7 @@ above for ``BUILD_COMMIT``, see the _example from `v1.14.3`:: $ gvim .travis.yml .appveyor.yml $ git commit -a - $ git push origin HEAD + $ git push upstream HEAD Now wait. If you get nervous at the amount of time taken -- the builds can take several hours-- you can check the build progress by following the links @@ -121,7 +126,7 @@ download all the wheels to the ``../numpy/release/installers`` directory and upload later using ``twine``:: $ cd ../terryfy - $ git pull origin master + $ git pull upstream master $ CDN_URL=https://3f23b170c54c2533c070-1c8a9b3114517dc5fe17b7c3f8c63a43.ssl.cf2.rackcdn.com $ NPY_WHLS=../numpy/release/installers $ ./wheel-uploader -u $CDN_URL -n -v -w $NPY_WHLS -t win numpy 1.14.5 @@ -134,8 +139,8 @@ environment. Generate the README files ------------------------- -This needs to be done after all installers are present, but before the pavement -file is updated for continued development. +This needs to be done after all installers are downloaded, but before the pavement +file is updated for continued development:: $ cd ../numpy $ paver write_release @@ -146,7 +151,7 @@ Tag the release Once the wheels have been built and downloaded without errors, go back to your numpy repository in the maintenance branch and tag the ``REL`` commit, signing -it with your gpg key, and build the source distribution archives:: +it with your gpg key:: $ git tag -s v1.14.5 @@ -158,8 +163,8 @@ push the tag upstream:: $ git push upstream v1.14.5 -We wait until this point to push the tag because it is very difficult to change -the tag after it has been pushed. +We wait until this point to push the tag because it is public and should not +be changed after it has been pushed. Reset the maintenance branch into a development state @@ -169,6 +174,19 @@ Add another ``REL`` commit to the numpy maintenance branch, which resets the ``ISREALEASED`` flag to ``False`` and increments the version counter:: $ gvim pavement.py setup.py + +Create release notes for next release and edit them to set the version:: + + $ cp doc/release/template.rst doc/release/1.14.6-notes.rst + $ gvim doc/release/1.14.6-notes.rst + $ git add doc/release/1.14.6-notes.rst + +Add new release notes to the documentation release list:: + + $ gvim doc/source/release.rst + +Commit the result:: + $ git commit -a -m"REL: prepare 1.14.x for further development" $ git push upstream maintenance/1.14.x @@ -177,7 +195,9 @@ Upload to PyPI -------------- Upload to PyPI using ``twine``. A recent version of ``twine`` of is needed -after recent PyPI changes, version ``1.11.0`` was used here. :: +after recent PyPI changes, version ``1.11.0`` was used here. + +.. code-block:: sh $ cd ../numpy $ twine upload release/installers/*.whl @@ -251,8 +271,9 @@ Announce to mailing lists The release should be announced on the numpy-discussion, scipy-devel, scipy-user, and python-announce-list mailing lists. Look at previous -announcements for the basic template. The contributor and PR lists -are the same as generated for the release notes above. +announcements for the basic template. The contributor and PR lists are the same +as generated for the release notes above. If you crosspost, make sure that +python-announce-list is BCC so that replies will not be sent to that list. Post-Release Tasks diff --git a/doc/TESTS.rst.txt b/doc/TESTS.rst.txt index 5fe0be1f1..14cb28df8 100644 --- a/doc/TESTS.rst.txt +++ b/doc/TESTS.rst.txt @@ -37,10 +37,9 @@ or from the command line:: $ python runtests.py -SciPy uses the testing framework from NumPy (specifically -:ref:`numpy-testing`), so all the SciPy examples shown here are also -applicable to NumPy. NumPy's full test suite can be run as -follows:: +SciPy uses the testing framework from :mod:`numpy.testing`, so all +the SciPy examples shown here are also applicable to NumPy. NumPy's full test +suite can be run as follows:: >>> import numpy >>> numpy.test() @@ -120,15 +119,6 @@ that makes it hard to identify the test from the output of running the test suite with ``verbose=2`` (or similar verbosity setting). Use plain comments (``#``) if necessary. -Sometimes it is convenient to run ``test_yyy.py`` by itself, so we add - -:: - - if __name__ == "__main__": - run_module_suite() - -at the bottom. - Labeling tests -------------- @@ -331,35 +321,33 @@ Known failures & skipping tests Sometimes you might want to skip a test or mark it as a known failure, such as when the test suite is being written before the code it's meant to test, or if a test only fails on a particular architecture. -The decorators from numpy.testing.dec can be used to do this. To skip a test, simply use ``skipif``:: - from numpy.testing import dec + import pytest - @dec.skipif(SkipMyTest, "Skipping this test because...") + @pytest.mark.skipif(SkipMyTest, reason="Skipping this test because...") def test_something(foo): ... The test is marked as skipped if ``SkipMyTest`` evaluates to nonzero, and the message in verbose test output is the second argument given to ``skipif``. Similarly, a test can be marked as a known failure by -using ``knownfailureif``:: +using ``xfail``:: - from numpy.testing import dec + import pytest - @dec.knownfailureif(MyTestFails, "This test is known to fail because...") + @pytest.mark.xfail(MyTestFails, reason="This test is known to fail because...") def test_something_else(foo): ... Of course, a test can be unconditionally skipped or marked as a known -failure by passing ``True`` as the first argument to ``skipif`` or -``knownfailureif``, respectively. +failure by using ``skip`` or ``xfail`` without argument, respectively. A total of the number of skipped and known failing tests is displayed at the end of the test run. Skipped tests are marked as ``'S'`` in the test results (or ``'SKIPPED'`` for ``verbose > 1``), and known -failing tests are marked as ``'K'`` (or ``'KNOWN'`` if ``verbose > +failing tests are marked as ``'x'`` (or ``'XFAIL'`` if ``verbose > 1``). Tests on random data diff --git a/doc/changelog/1.15.0-changelog.rst b/doc/changelog/1.15.0-changelog.rst index b76b9699a..4e3d3680b 100644 --- a/doc/changelog/1.15.0-changelog.rst +++ b/doc/changelog/1.15.0-changelog.rst @@ -374,7 +374,7 @@ A total of 438 pull requests were merged for this release. * `#10778 `__: BUG: test, fix for missing flags['WRITEBACKIFCOPY'] key * `#10781 `__: ENH: NEP index builder * `#10785 `__: DOC: Fixed author name in reference to book -* `#10786 `__: ENH: Add "stablesort" option to inp.sort as an alias for "mergesort". +* `#10786 `__: ENH: Add "stable" option to np.sort as an alias for "mergesort". * `#10790 `__: TST: Various fixes prior to switching to pytest * `#10795 `__: BUG: Allow spaces in output string of einsum * `#10796 `__: BUG: fix wrong inplace vectorization on overlapping arguments diff --git a/doc/changelog/1.16.1-changelog.rst b/doc/changelog/1.16.1-changelog.rst index aaa803c14..30e0e3a24 100644 --- a/doc/changelog/1.16.1-changelog.rst +++ b/doc/changelog/1.16.1-changelog.rst @@ -25,7 +25,7 @@ names contributed a patch for the first time. Pull requests merged ==================== -A total of 32 pull requests were merged for this release. +A total of 33 pull requests were merged for this release. * `#12754 `__: BUG: Check paths are unicode, bytes or path-like * `#12767 `__: ENH: add mm->q floordiv diff --git a/doc/changelog/1.16.5-changelog.rst b/doc/changelog/1.16.5-changelog.rst deleted file mode 100644 index 19374058d..000000000 --- a/doc/changelog/1.16.5-changelog.rst +++ /dev/null @@ -1,54 +0,0 @@ - -Contributors -============ - -A total of 18 people contributed to this release. People with a "+" by their -names contributed a patch for the first time. - -* Alexander Shadchin -* Allan Haldane -* Bruce Merry + -* Charles Harris -* Colin Snyder + -* Dan Allan + -* Emile + -* Eric Wieser -* Grey Baker + -* Maksim Shabunin + -* Marten van Kerkwijk -* Matti Picus -* Peter Andreas Entschev + -* Ralf Gommers -* Richard Harris + -* Sebastian Berg -* Sergei Lebedev + -* Stephan Hoyer - -Pull requests merged -==================== - -A total of 23 pull requests were merged for this release. - -* `#13742 `__: ENH: Add project URLs to setup.py -* `#13823 `__: TEST, ENH: fix tests and ctypes code for PyPy -* `#13845 `__: BUG: use npy_intp instead of int for indexing array -* `#13867 `__: TST: Ignore DeprecationWarning during nose imports -* `#13905 `__: BUG: Fix use-after-free in boolean indexing -* `#13933 `__: MAINT/BUG/DOC: Fix errors in _add_newdocs -* `#13984 `__: BUG: fix byte order reversal for datetime64[ns] -* `#13994 `__: MAINT,BUG: Use nbytes to also catch empty descr during allocation -* `#14042 `__: BUG: np.array cleared errors occured in PyMemoryView_FromObject -* `#14043 `__: BUG: Fixes for Undefined Behavior Sanitizer (UBSan) errors. -* `#14044 `__: BUG: ensure that casting to/from structured is properly checked. -* `#14045 `__: MAINT: fix histogram*d dispatchers -* `#14046 `__: BUG: further fixup to histogram2d dispatcher. -* `#14052 `__: BUG: Replace contextlib.suppress for Python 2.7 -* `#14056 `__: BUG: fix compilation of 3rd party modules with Py_LIMITED_API... -* `#14057 `__: BUG: Fix memory leak in dtype from dict contructor -* `#14058 `__: DOC: Document array_function at a higher level. -* `#14084 `__: BUG, DOC: add new recfunctions to `__all__` -* `#14162 `__: BUG: Remove stray print that causes a SystemError on python 3.7 -* `#14297 `__: TST: Pin pytest version to 5.0.1. -* `#14322 `__: ENH: Enable huge pages in all Linux builds -* `#14346 `__: BUG: fix behavior of structured_to_unstructured on non-trivial... -* `#14382 `__: REL: Prepare for the NumPy 1.16.5 release. diff --git a/doc/changelog/1.16.6-changelog.rst b/doc/changelog/1.16.6-changelog.rst deleted file mode 100644 index 62ff46c34..000000000 --- a/doc/changelog/1.16.6-changelog.rst +++ /dev/null @@ -1,36 +0,0 @@ - -Contributors -============ - -A total of 10 people contributed to this release. - -* CakeWithSteak -* Charles Harris -* Chris Burr -* Eric Wieser -* Fernando Saravia -* Lars Grueter -* Matti Picus -* Maxwell Aladago -* Qiming Sun -* Warren Weckesser - -Pull requests merged -==================== - -A total of 14 pull requests were merged for this release. - -* `#14211 `__: BUG: Fix uint-overflow if padding with linear_ramp and negative... -* `#14275 `__: BUG: fixing to allow unpickling of PY3 pickles from PY2 -* `#14340 `__: BUG: Fix misuse of .names and .fields in various places (backport... -* `#14423 `__: BUG: test, fix regression in converting to ctypes. -* `#14434 `__: BUG: Fixed maximum relative error reporting in assert_allclose -* `#14509 `__: BUG: Fix regression in boolean matmul. -* `#14686 `__: BUG: properly define PyArray_DescrCheck -* `#14853 `__: BLD: add 'apt update' to shippable -* `#14854 `__: BUG: Fix _ctypes class circular reference. (#13808) -* `#14856 `__: BUG: Fix `np.einsum` errors on Power9 Linux and z/Linux -* `#14863 `__: BLD: Prevent -flto from optimising long double representation... -* `#14864 `__: BUG: lib: Fix histogram problem with signed integer arrays. -* `#15172 `__: ENH: Backport improvements to testing functions. -* `#15191 `__: REL: Prepare for 1.16.6 release. diff --git a/doc/changelog/1.17.0-changelog.rst b/doc/changelog/1.17.0-changelog.rst new file mode 100644 index 000000000..debfb6f5b --- /dev/null +++ b/doc/changelog/1.17.0-changelog.rst @@ -0,0 +1,694 @@ + +Contributors +============ + +A total of 150 people contributed to this release. People with a "+" by their +names contributed a patch for the first time. + +* Aaron Voelker + +* Abdur Rehman + +* Abdur-Rahmaan Janhangeer + +* Abhinav Sagar + +* Adam J. Stewart + +* Adam Orr + +* Albert Thomas + +* Alex Watt + +* Alexander Blinne + +* Alexander Shadchin +* Allan Haldane +* Ander Ustarroz + +* Andras Deak +* Andrea Pattori + +* Andreas Schwab +* Andrew Naguib + +* Andy Scholand + +* Ankit Shukla + +* Anthony Sottile +* Antoine Pitrou +* Antony Lee +* Arcesio Castaneda Medina + +* Assem + +* Bernardt Duvenhage + +* Bharat Raghunathan + +* Bharat123rox + +* Bran + +* Bruce Merry + +* Charles Harris +* Chirag Nighut + +* Christoph Gohlke +* Christopher Whelan + +* Chuanzhu Xu + +* Colin Snyder + +* Dan Allan + +* Daniel Hrisca +* Daniel Lawrence + +* Debsankha Manik + +* Dennis Zollo + +* Dieter Werthmüller + +* Dominic Jack + +* EelcoPeacs + +* Eric Larson +* Eric Wieser +* Fabrice Fontaine + +* Gary Gurlaskie + +* Gregory Lee + +* Gregory R. Lee +* Guillaume Horel + +* Hameer Abbasi +* Haoyu Sun + +* Harmon + +* He Jia + +* Hunter Damron + +* Ian Sanders + +* Ilja + +* Isaac Virshup + +* Isaiah Norton + +* Jackie Leng + +* Jaime Fernandez +* Jakub Wilk +* Jan S. (Milania1) + +* Jarrod Millman +* Javier Dehesa + +* Jeremy Lay + +* Jim Turner + +* Jingbei Li + +* Joachim Hereth + +* Johannes Hampp + +* John Belmonte + +* John Kirkham +* John Law + +* Jonas Jensen +* Joseph Fox-Rabinovitz +* Joseph Martinot-Lagarde +* Josh Wilson +* Juan Luis Cano Rodríguez +* Julian Taylor +* Jérémie du Boisberranger + +* Kai Striega + +* Katharine Hyatt + +* Kevin Sheppard +* Kexuan Sun +* Kiko Correoso + +* Kriti Singh + +* Lars Grueter + +* Luis Pedro Coelho +* Maksim Shabunin + +* Manvi07 + +* Mark Harfouche +* Marten van Kerkwijk +* Martin Reinecke + +* Matthew Brett +* Matthias Bussonnier +* Matti Picus +* Michel Fruchart + +* Mike Lui + +* Mike Taves + +* Min ho Kim + +* Mircea Akos Bruma +* Nick Minkyu Lee +* Nick Papior +* Nick R. Papior + +* Nicola Soranzo + +* Nimish Telang + +* OBATA Akio + +* Oleksandr Pavlyk +* Ori Broda + +* Paul Ivanov +* Pauli Virtanen +* Peter Andreas Entschev + +* Peter Bell + +* Pierre de Buyl +* Piyush Jaipuriayar + +* Prithvi MK + +* Raghuveer Devulapalli + +* Ralf Gommers +* Richard Harris + +* Rishabh Chakrabarti + +* Riya Sharma + +* Robert Kern +* Roman Yurchak +* Ryan Levy + +* Sebastian Berg +* Sergei Lebedev + +* Shekhar Prasad Rajak + +* Stefan van der Walt +* Stephan Hoyer +* Steve Stagg + +* SuryaChand P + +* Søren Rasmussen + +* Thibault Hallouin + +* Thomas A Caswell +* Tobias Uelwer + +* Tony LaTorre + +* Toshiki Kataoka +* Tyler Moncur + +* Tyler Reddy +* Valentin Haenel +* Vrinda Narayan + +* Warren Weckesser +* Weitang Li +* Wojtek Ruszczewski +* Yu Feng +* Yu Kobayashi + +* Yury Kirienko + +* aashuli + +* luzpaz +* parul + +* spacescientist + + +Pull requests merged +==================== + +A total of 531 pull requests were merged for this release. + +* `#4808 `__: ENH: Make the `mode` parameter of np.pad default to 'constant' +* `#8131 `__: BUG: Fix help() formatting for deprecated functions. +* `#8159 `__: ENH: Add import time benchmarks. +* `#8641 `__: BUG: Preserve types of empty arrays in ix_ when known +* `#8662 `__: ENH: preserve subclasses in ufunc.outer +* `#9330 `__: ENH: Make errstate a ContextDecorator in Python3 +* `#10308 `__: API: Make MaskedArray.mask return a view, rather than the underlying... +* `#10417 `__: ENH: Allow dtype objects to be indexed with multiple fields at... +* `#10723 `__: BUG: longdouble(int) does not work +* `#10741 `__: ENH: Implement `np.floating.as_integer_ratio` +* `#10855 `__: ENH: Adding a count parameter to np.unpackbits +* `#11230 `__: MAINT: More cleanup of einsum +* `#11233 `__: BUG: ensure i0 does not change the shape. +* `#11684 `__: BUG: Raise when unravel_index, ravel_multi_index are given empty... +* `#11689 `__: DOC: Add ref docs for C generic types. +* `#11721 `__: BUG: Make `arr.ctypes.data` hold onto a reference to the underlying... +* `#11829 `__: MAINT: Use textwrap.dedent in f2py tests +* `#11859 `__: BUG: test and fix np.dtype('i,L') #5645 +* `#11888 `__: ENH: Add pocketfft sources to numpy for testing, benchmarks,... +* `#11977 `__: BUG: reference cycle in np.vectorize +* `#12025 `__: DOC: add detail for 'where' argument in ufunc +* `#12152 `__: TST: Added tests for np.tensordot() +* `#12201 `__: TST: coverage for _commonType() +* `#12234 `__: MAINT: refactor PyArray_AdaptFlexibleDType to return a meaningful... +* `#12239 `__: BUG: polyval returned non-masked arrays for masked input. +* `#12253 `__: DOC, TST: enable doctests +* `#12308 `__: ENH: add mm->q floordiv +* `#12317 `__: ENH: port np.core.overrides to C for speed +* `#12333 `__: DOC: update description of the Dirichlet distribution +* `#12418 `__: ENH: Add timsort to npysort +* `#12428 `__: ENH: always use zip64, upgrade pickle protocol to 3 +* `#12456 `__: ENH: Add np.ctypeslib.as_ctypes_type(dtype), improve `np.ctypeslib.as_ctypes` +* `#12457 `__: TST: openblas for Azure MacOS +* `#12463 `__: DOC: fix docstrings for broadcastable inputs in ufunc +* `#12502 `__: TST: Azure Python version fix +* `#12506 `__: MAINT: Prepare master for 1.17.0 development. +* `#12508 `__: DOC, MAINT: Make `PYVER = 3` in doc/Makefile. +* `#12511 `__: BUG: don't check alignment of size=0 arrays (RELAXED_STRIDES) +* `#12512 `__: added template-generated files to .gitignore +* `#12519 `__: ENH/DEP: Use a ufunc under the hood for ndarray.clip +* `#12522 `__: BUG: Make new-lines in compiler error messages print to the console +* `#12524 `__: BUG: fix improper use of C-API +* `#12526 `__: BUG: reorder operations for VS2015 +* `#12527 `__: DEV: Fix lgtm.com C/C++ build +* `#12528 `__: BUG: fix an unsafe PyTuple_GET_ITEM call +* `#12532 `__: DEV: add ctags option file +* `#12534 `__: DOC: Fix desc. of Ellipsis behavior in reference +* `#12537 `__: DOC: Change 'num' to 'np' +* `#12538 `__: MAINT: remove VC 9.0 from CI +* `#12539 `__: DEV: remove travis 32 bit job since it is running on azure +* `#12543 `__: TST: wheel-match Linux openblas in CI +* `#12544 `__: BUG: fix refcount issue caused by #12524 +* `#12545 `__: BUG: Ensure probabilities are not NaN in choice +* `#12546 `__: BUG: check for errors after PyArray_DESCR_REPLACE +* `#12547 `__: ENH: Cast covariance to double in random mvnormal +* `#12549 `__: TST: relax codecov project threshold +* `#12551 `__: MAINT: add warning to numpy.distutils for LDFLAGS append behavior. +* `#12552 `__: BENCH: Improve benchmarks for numpy.pad +* `#12554 `__: DOC: more doc updates for structured arrays +* `#12555 `__: BUG: only override vector size for avx code +* `#12560 `__: DOC: fix some doctest failures +* `#12566 `__: BUG: fix segfault in ctypeslib with obj being collected +* `#12571 `__: Revert "Merge pull request #11721 from eric-wieser/fix-9647" +* `#12572 `__: BUG: Make `arr.ctypes.data` hold a reference to the underlying... +* `#12575 `__: ENH: improve performance for numpy.core.records.find_duplicate +* `#12577 `__: BUG: fix f2py pep338 execution method +* `#12578 `__: TST: activate shippable maintenance branches +* `#12583 `__: TST: add test for 'python -mnumpy.f2py' +* `#12584 `__: Clarify skiprows in loadtxt +* `#12586 `__: ENH: Implement radix sort +* `#12589 `__: MAINT: Update changelog.py for Python 3. +* `#12591 `__: ENH: add "max difference" messages to np.testing.assert_array_equal +* `#12592 `__: BUG,TST: Remove the misguided `run_command` that wraps subprocess +* `#12593 `__: ENH,WIP: Use richer exception types for ufunc type resolution... +* `#12594 `__: DEV, BUILD: add pypy3 to azure CI +* `#12596 `__: ENH: improve performance of numpy.core.records.fromarrays +* `#12601 `__: DOC: Correct documentation of `numpy.delete` obj parameter. +* `#12602 `__: DOC: Update RELEASE_WALKTHROUGH.rst.txt. +* `#12604 `__: BUG: Check that dtype and formats arguments for None. +* `#12606 `__: DOC: Document NPY_SORTKIND parameter in PyArray_Sort +* `#12608 `__: MAINT: Use `*.format` for some strings. +* `#12609 `__: ENH: Deprecate writeable broadcast_array +* `#12610 `__: TST: Update runtests.py to specify C99 for gcc. +* `#12611 `__: BUG: longdouble with elsize 12 is never uint alignable +* `#12612 `__: TST: Update `travis-test.sh` for C99 +* `#12616 `__: BLD: Fix minimum Python version in setup.py +* `#12617 `__: BUG: Add missing free in ufunc dealloc +* `#12618 `__: MAINT: add test for 12-byte alignment +* `#12620 `__: BLD: move -std=c99 addition to CFLAGS to Azure config +* `#12624 `__: BUG: Fix incorrect/missing reference cleanups found using valgrind +* `#12626 `__: BUG: fix uint alignment asserts in lowlevel loops +* `#12631 `__: BUG: fix f2py problem to build wrappers using PGI's Fortran +* `#12634 `__: DOC, TST: remove "agg" setting from docs +* `#12639 `__: BENCH: don't fail at import time with old Numpy +* `#12641 `__: DOC: update 2018 -> 2019 +* `#12644 `__: ENH: where for ufunc reductions +* `#12645 `__: DOC: Minor fix to pocketfft release note +* `#12650 `__: BUG: Fix reference counting for subarrays containing objects +* `#12651 `__: DOC: SimpleNewFromDescr cannot be given NULL for descr +* `#12666 `__: BENCH: add asv nanfunction benchmarks +* `#12668 `__: ENH: Improve error messages for non-matching shapes in concatenate. +* `#12671 `__: TST: Fix endianness in unstuctured_to_structured test +* `#12672 `__: BUG: Add 'sparc' to platforms implementing 16 byte reals. +* `#12677 `__: MAINT: Further fixups to uint alignment checks +* `#12679 `__: ENH: remove "Invalid value" warnings from median, percentile +* `#12680 `__: BUG: Ensure failing memory allocations are reported +* `#12683 `__: ENH: add mm->qm divmod +* `#12684 `__: DEV: remove _arg from public API, add matmul to benchmark ufuncs +* `#12685 `__: BUG: Make pocketfft handle long doubles. +* `#12687 `__: ENH: Better links in documentation +* `#12690 `__: WIP, ENH: add _nan_mask function +* `#12693 `__: ENH: Add a hermitian argument to `pinv` and `svd`, matching `matrix_rank` +* `#12696 `__: BUG: Fix leak of void scalar buffer info +* `#12698 `__: DOC: improve comments in copycast_isaligned +* `#12700 `__: ENH: chain additional exception on ufunc method lookup error +* `#12702 `__: TST: Check FFT results for C/Fortran ordered and non contigous... +* `#12704 `__: TST: pin Azure brew version for stability +* `#12709 `__: TST: add ppc64le to Travis CI matrix +* `#12713 `__: BUG: loosen kwargs requirements in ediff1d +* `#12722 `__: BUG: Fix rounding of denormals in double and float to half casts... +* `#12723 `__: BENCH: Include other sort benchmarks +* `#12724 `__: BENCH: quiet DeprecationWarning +* `#12727 `__: DOC: fix and doctest tutorial +* `#12728 `__: DOC: clarify the suffix of single/extended precision math constants +* `#12729 `__: DOC: Extend documentation of `ndarray.tolist` +* `#12731 `__: DOC: Update release notes and changelog after 1.16.0 release. +* `#12733 `__: DOC: clarify the extend of __array_function__ support in NumPy... +* `#12741 `__: DOC: fix generalized eigenproblem reference in "NumPy for MATLAB... +* `#12743 `__: BUG: Fix crash in error message formatting introduced by gh-11230 +* `#12748 `__: BUG: Fix SystemError when pickling datetime64 array with pickle5 +* `#12757 `__: BUG: Added parens to macro argument expansions +* `#12758 `__: DOC: Update docstring of diff() to use 'i' not 'n' +* `#12762 `__: MAINT: Change the order of checking for locale file and import... +* `#12783 `__: DOC: document C99 requirement in dev guide +* `#12787 `__: DOC: remove recommendation to add main for testing +* `#12805 `__: BUG: double decref of dtype in failure codepath. Test and fix +* `#12807 `__: BUG, DOC: test, fix that f2py.compile accepts str and bytes,... +* `#12814 `__: BUG: resolve writeback in arr_insert failure paths +* `#12815 `__: BUG: Fix testing of f2py.compile from strings. +* `#12818 `__: DOC: remove python2-only methods, small cleanups +* `#12824 `__: BUG: fix to check before apply `shlex.split` +* `#12830 `__: ENH: __array_function__ updates for NumPy 1.17.0 +* `#12831 `__: BUG: Catch stderr when checking compiler version +* `#12842 `__: BUG: ndarrays pickled by 1.16 cannot be loaded by 1.15.4 and... +* `#12846 `__: BUG: fix signed zero behavior in npy_divmod +* `#12850 `__: BUG: fail if old multiarray module detected +* `#12851 `__: TEST: use xenial by default for travis +* `#12854 `__: BUG: do not Py_DECREF NULL pointer +* `#12857 `__: STY: simplify code +* `#12863 `__: TEST: pin mingw version +* `#12866 `__: DOC: link to benchmarking info +* `#12867 `__: TST: Use same OpenBLAS build for testing as for current wheels. +* `#12871 `__: ENH: add c-imported modules to namespace for freeze analysis +* `#12877 `__: Remove deprecated ``sudo: false`` from .travis.yml +* `#12879 `__: DEP: deprecate exec_command +* `#12885 `__: DOC: fix math formatting of np.linalg.lstsq docs +* `#12886 `__: DOC: add missing character routines, fix #8578 +* `#12887 `__: BUG: Fix np.rec.fromarrays on arrays which are already structured +* `#12889 `__: BUG: Make allow_pickle=False the default for loading +* `#12892 `__: BUG: Do not double-quote arguments passed on to the linker +* `#12894 `__: MAINT: Removed unused and confusingly indirect imports from mingw32ccompiler +* `#12895 `__: BUG: Do not insert extra double quote into preprocessor macros +* `#12903 `__: TST: fix vmImage dispatch in Azure +* `#12905 `__: BUG: fix byte order reversal for datetime64[ns] +* `#12908 `__: DOC: Update master following 1.16.1 release. +* `#12911 `__: BLD: fix doc build for distribution. +* `#12915 `__: ENH: pathlib support for fromfile(), .tofile() and .dump() +* `#12920 `__: MAINT: remove complicated test of multiarray import failure mode +* `#12922 `__: DOC: Add note about arbitrary code execution to numpy.load +* `#12925 `__: BUG: parse shell escaping in extra_compile_args and extra_link_args +* `#12928 `__: MAINT: Merge together the unary and binary type resolvers +* `#12929 `__: DOC: fix documentation bug in np.argsort and extend examples +* `#12931 `__: MAINT: Remove recurring check +* `#12932 `__: BUG: do not dereference NULL pointer +* `#12937 `__: DOC: Correct negative_binomial docstring +* `#12944 `__: BUG: Make timsort deal with zero length elements. +* `#12945 `__: BUG: Add timsort without breaking the API. +* `#12949 `__: DOC: ndarray.max is missing +* `#12962 `__: ENH: Add 'bitorder' keyword to packbits, unpackbits +* `#12963 `__: DOC: Grammatical fix in numpy doc +* `#12964 `__: DOC: Document that ``scale==0`` is now allowed in many distributions. +* `#12965 `__: DOC: Properly format Return section of ogrid Docstring, +* `#12968 `__: BENCH: Re-write sorting benchmarks +* `#12971 `__: ENH: Add 'offset' keyword to 'numpy.fromfile()' +* `#12973 `__: DOC: Recommend adding dimension to switch between row and column... +* `#12983 `__: DOC: Randomstate docstring fixes +* `#12984 `__: DOC: Add examples of negative shifts in np.roll +* `#12986 `__: BENCH: set ones in any/all benchmarks to 1 instead of 0 +* `#12988 `__: ENH: Create boolean and integer ufuncs for isnan, isinf, and... +* `#12989 `__: ENH: Correct handling of infinities in np.interp (option B) +* `#12995 `__: BUG: Add missing PyErr_NoMemory() for reporting a failed malloc +* `#12996 `__: MAINT: Use the same multiplication order in interp for cached... +* `#13002 `__: DOC: reduce warnings when building, and rephrase slightly +* `#13004 `__: MAINT: minor changes for consistency to site.cfg.example +* `#13008 `__: MAINT: Move pickle import to numpy.compat +* `#13019 `__: BLD: Windows absolute path DLL loading +* `#13023 `__: BUG: Changes to string-to-shell parsing behavior broke paths... +* `#13027 `__: BUG: Fix regression in parsing of F90 and F77 environment variables +* `#13031 `__: MAINT: Replace if statement with a dictionary lookup for ease... +* `#13032 `__: MAINT: Extract the loop macros into their own header +* `#13033 `__: MAINT: Convert property to @property +* `#13035 `__: DOC: Draw more attention to which functions in random are convenience... +* `#13036 `__: BUG: __array_interface__ offset was always ignored +* `#13039 `__: BUG: Remove error-prone borrowed reference handling +* `#13044 `__: DOC: link to devdocs in README +* `#13046 `__: ENH: Add shape to *_like() array creation +* `#13049 `__: MAINT: remove undocumented __buffer__ attribute lookup +* `#13050 `__: BLD: make doc build work more robustly. +* `#13054 `__: DOC: Added maximum_sctype to documentation +* `#13055 `__: DOC: Post NumPy 1.16.2 release update. +* `#13056 `__: BUG: Fixes to numpy.distutils.Configuration.get_version +* `#13058 `__: DOC: update docstring in numpy.interp docstring +* `#13060 `__: BUG: Use C call to sysctlbyname for AVX detection on MacOS +* `#13063 `__: DOC: revert PR #13058 and fixup Makefile +* `#13067 `__: MAINT: Use with statements for opening files in distutils +* `#13068 `__: BUG: Add error checks when converting integers to datetime types +* `#13071 `__: DOC: Removed incorrect claim regarding shape constraints for... +* `#13073 `__: MAINT: Fix ABCPolyBase in various ways +* `#13075 `__: BUG: Convert fortran flags in environment variable +* `#13076 `__: BUG: Remove our patched version of `distutils.split_quoted` +* `#13077 `__: BUG: Fix errors in string formatting while producing an error +* `#13078 `__: MAINT: deduplicate fromroots in np.polynomial +* `#13079 `__: MAINT: Merge duplicate implementations of `*vander2d` and `*vander3d`... +* `#13086 `__: BLD: fix include list for sdist building +* `#13090 `__: BUILD: sphinx 1.8.3 can be used with our outdated templates +* `#13092 `__: BUG: ensure linspace works on object input. +* `#13093 `__: BUG: Fix parameter validity checks in ``random.choice``. +* `#13095 `__: BUG: Fix testsuite failures on ppc and riscv +* `#13096 `__: TEST: allow refcheck result to vary, increase discoverability... +* `#13097 `__: DOC: update doc of `ndarray.T` +* `#13099 `__: DOC: Add note about "copy and slicing" +* `#13104 `__: DOC: fix references in docs +* `#13107 `__: MAINT: Unify polynomial valnd functions +* `#13108 `__: MAINT: Merge duplicate implementations of `hermvander2d` and... +* `#13109 `__: Prevent traceback chaining in _wrapfunc. +* `#13111 `__: MAINT: Unify polydiv +* `#13115 `__: DOC: Fix #12050 by updating numpy.random.hypergeometric docs +* `#13116 `__: DOC: Add backticks in linalg docstrings. +* `#13117 `__: DOC: Fix arg type for np.pad, fix #9489 +* `#13118 `__: DOC: update scipy-sphinx-theme, fixes search +* `#13119 `__: DOC: Fix c-api function documentation duplication. +* `#13125 `__: BUG: Fix unhandled exception in CBLAS detection +* `#13126 `__: DEP: polynomial: Be stricter about integral arguments +* `#13127 `__: DOC: Tidy 1.17.0 release note newlines +* `#13128 `__: MAINT: Unify polynomial addition and subtraction functions +* `#13130 `__: MAINT: Unify polynomial fitting functions +* `#13131 `__: BUILD: use 'quiet' when building docs +* `#13132 `__: BLD: Allow users to specify BLAS and LAPACK library link order +* `#13134 `__: ENH: Use AVX for float32 implementation of np.exp & np.log +* `#13137 `__: BUG: Fix build for glibc on ARC and uclibc. +* `#13140 `__: DEV: cleanup imports and some assignments (from LGTM) +* `#13146 `__: MAINT: Unify polynomial power functions +* `#13147 `__: DOC: Add description of overflow errors +* `#13149 `__: DOC: correction to numpy.pad docstring +* `#13157 `__: BLD: streamlined library names in site.cfg sections +* `#13158 `__: BLD: Add libflame as a LAPACK back-end +* `#13161 `__: BLD: streamlined CBLAS linkage tries, default to try libraries... +* `#13162 `__: BUILD: update numpydoc to latest version +* `#13163 `__: ENH: randomgen +* `#13169 `__: STY: Fix weird indents to be multiples of 4 spaces +* `#13170 `__: DOC, BUILD: fail the devdoc build if there are warnings +* `#13174 `__: DOC: Removed some c-api duplication +* `#13176 `__: BUG: fix reference count error on invalid input to ndarray.flat +* `#13181 `__: BENCH, BUG: fix Savez suite, previously was actually calling... +* `#13182 `__: MAINT: add overlap checks to choose, take, put, putmask +* `#13188 `__: MAINT: Simplify logic in convert_datetime_to_datetimestruct +* `#13202 `__: ENH: use rotated companion matrix to reduce error +* `#13203 `__: DOC: Use std docstring for multivariate normal +* `#13205 `__: DOC : Fix C-API documentation references to items that don't... +* `#13206 `__: BUILD: pin sphinx to 1.8.5 +* `#13208 `__: MAINT: cleanup of fast_loop_macros.h +* `#13216 `__: Adding an example of successful execution of numpy.test() to... +* `#13217 `__: TST: always publish Azure tests +* `#13218 `__: ENH: `isfinite` support for `datetime64` and `timedelta64` +* `#13219 `__: ENH: nan_to_num keyword addition (was #9355) +* `#13222 `__: DOC: Document/ Deprecate functions exposed in "numpy" namespace +* `#13224 `__: Improve error message for negative valued argument +* `#13226 `__: DOC: Fix small issues in mtrand doc strings +* `#13231 `__: DOC: Change the required Sphinx version to build documentation +* `#13234 `__: DOC : PyArray_Descr.names undocumented +* `#13239 `__: DOC: Minor grammatical fixes in NumPy docs +* `#13242 `__: DOC: fix docstring for floor_divide +* `#13243 `__: MAINT: replace SETREF with assignment to ret array in ndarray.flat +* `#13244 `__: DOC: Improve mtrand docstrings +* `#13250 `__: MAINT: Improve efficiency of pad by avoiding use of apply_along_axis +* `#13253 `__: TST: fail Azure CI if test failures +* `#13259 `__: DOC: Small readability improvement +* `#13262 `__: DOC : Correcting bug on Documentation Page (Byteswapping) +* `#13264 `__: TST: use OpenBLAS v0.3.5 for POWER8 CI runs +* `#13269 `__: BUG, MAINT: f2py: Add a cast to avoid a compiler warning. +* `#13270 `__: TST: use OpenBLAS v0.3.5 for ARMv8 CI +* `#13271 `__: ENH: vectorize np.abs for unsigned ints and half, improving performance... +* `#13273 `__: BUG: Fix null pointer dereference in PyArray_DTypeFromObject +* `#13277 `__: DOC: Document caveat in random.uniform +* `#13287 `__: Add benchmark for sorting random array. +* `#13289 `__: DOC: add Quansight Labs as an Institutional Partner +* `#13291 `__: MAINT: fix unused variable warning in npy_math_complex.c.src +* `#13292 `__: DOC: update numpydoc to latest master +* `#13293 `__: DOC: add more info to failure message +* `#13298 `__: ENH: Added clearer exception for np.diff on 0-dimensional ndarray +* `#13301 `__: BUG: Fix crash when calling savetxt on a padded array +* `#13305 `__: NEP: Update NEP-18 to include the ``__skip_array_function__``... +* `#13306 `__: MAINT: better MemoryError message (#13225) +* `#13309 `__: DOC: list Quansight rather than Quansight Labs as Institutional... +* `#13310 `__: ENH: Add project_urls to setup +* `#13311 `__: BUG: Fix bad error message in np.memmap +* `#13312 `__: BUG: Close files if an error occurs in genfromtxt +* `#13313 `__: MAINT: fix typo in 'self' +* `#13314 `__: DOC: remove misplaced section at bottom of governance people... +* `#13316 `__: DOC: Added anti-diagonal examples to np.diagonal and np.fill_diagonal +* `#13320 `__: MAINT: remove unused file +* `#13321 `__: MAINT: Move exceptions from core._internal to core._exceptions +* `#13322 `__: MAINT: Move umath error helpers into their own module +* `#13323 `__: BUG: ufunc.at iteration variable size fix +* `#13324 `__: MAINT: Move asarray helpers into their own module +* `#13326 `__: DEP: Deprecate collapsing shape-1 dtype fields to scalars. +* `#13328 `__: MAINT: Tidy up error message for accumulate and reduceat +* `#13331 `__: DOC, BLD: fix doc build issues in preparation for the next numpydoc... +* `#13332 `__: BUG: Always return views from structured_to_unstructured when... +* `#13334 `__: BUG: Fix structured_to_unstructured on single-field types +* `#13335 `__: DOC: Add as_ctypes_type to the documentation +* `#13336 `__: BUILD: fail documentation build if numpy version does not match +* `#13337 `__: DOC: Add docstrings for consistency in aliases +* `#13346 `__: BUG/MAINT: Tidy typeinfo.h and .c +* `#13348 `__: BUG: Return the coefficients array directly +* `#13354 `__: TST: Added test_fftpocket.py::test_axes +* `#13367 `__: DOC: reorganize developer docs, use scikit-image as a base for... +* `#13371 `__: BUG/ENH: Make floor, ceil, and trunc call the matching special... +* `#13374 `__: DOC: Specify range for numpy.angle +* `#13377 `__: DOC: Add missing macros to C API documentation +* `#13379 `__: BLD: address mingw-w64 issue. Follow-up to gh-9977 +* `#13383 `__: MAINT, DOC: Post 1.16.3 release updates +* `#13388 `__: BUG: Some PyPy versions lack PyStructSequence_InitType2. +* `#13389 `__: ENH: implement ``__skip_array_function__`` attribute for NEP-18 +* `#13390 `__: ENH: Add support for Fraction to percentile and quantile +* `#13391 `__: MAINT, DEP: Fix deprecated ``assertEquals()`` +* `#13395 `__: DOC: note re defaults allclose to assert_allclose +* `#13397 `__: DOC: Resolve confusion regarding hashtag in header line of csv +* `#13399 `__: ENH: Improved performance of PyArray_FromAny for sequences of... +* `#13402 `__: DOC: Show the default value of deletechars in the signature of... +* `#13403 `__: DOC: fix typos in dev/index +* `#13404 `__: DOC: Add Sebastian Berg as sponsored by BIDS +* `#13406 `__: DOC: clarify array_{2string,str,repr} defaults +* `#13409 `__: BUG: (py2 only) fix unicode support for savetxt fmt string +* `#13413 `__: DOC: document existence of linalg backends +* `#13415 `__: BUG: fixing bugs in AVX exp/log while handling special value... +* `#13416 `__: BUG: Protect generators from log(0.0) +* `#13417 `__: DOC: dimension sizes are non-negative, not positive +* `#13425 `__: MAINT: fixed typo 'Mismacth' from numpy/core/setup_common.py +* `#13433 `__: BUG: Handle subarrays in descr_to_dtype +* `#13435 `__: BUG: Add TypeError to accepted exceptions in crackfortran. +* `#13436 `__: TST: Add file-not-closed check to LGTM analysis. +* `#13440 `__: MAINT: fixed typo 'wtihout' from numpy/core/shape_base.py +* `#13443 `__: BLD, TST: implicit func errors +* `#13445 `__: MAINT: refactor PyArrayMultiIterObject constructors +* `#13446 `__: MANT: refactor unravel_index for code repetition +* `#13449 `__: BUG: missing git raises an OSError +* `#13456 `__: TST: refine Azure fail reports +* `#13463 `__: BUG,DEP: Fix writeable flag setting for arrays without base +* `#13467 `__: ENH: err msg for too large sequences. See #13450 +* `#13469 `__: DOC: correct "version added" in npymath docs +* `#13471 `__: LICENSE: split license file in standard BSD 3-clause and bundled. +* `#13477 `__: DOC: have notes in histogram_bin_edges match parameter style +* `#13479 `__: DOC: Mention the handling of nan in the assert_equal docstring. +* `#13482 `__: TEST: add duration report to tests, speed up two outliers +* `#13483 `__: DOC: update mailmap for Bill Spotz +* `#13485 `__: DOC: add security vulnerability reporting and doc links to README +* `#13491 `__: BUG/ENH: Create npy format 3.0 to support extended unicode characters... +* `#13495 `__: BUG: test all ufunc.types for return type, fix for exp, log +* `#13496 `__: BUG: ma.tostring should respect the order parameter +* `#13498 `__: DOC: Clarify rcond normalization in linalg.pinv +* `#13499 `__: MAINT: Use with statement to open/close files to fix LGTM alerts +* `#13503 `__: ENH: Support object arrays in matmul +* `#13504 `__: DOC: Update links in PULL_REQUEST_TEMPLATE.md +* `#13506 `__: ENH: Add sparse option to np.core.numeric.indices +* `#13507 `__: BUG: np.array cleared errors occured in PyMemoryView_FromObject +* `#13508 `__: BUG: Removes ValueError for empty kwargs in arraymultiter_new +* `#13518 `__: MAINT: implement assert_array_compare without converting array... +* `#13520 `__: BUG: exp, log AVX loops do not use steps +* `#13523 `__: BUG: distutils/system_info.py fix missing subprocess import +* `#13529 `__: MAINT: Use exec() instead array_function_dispatch to improve... +* `#13530 `__: BENCH: Modify benchmarks for radix sort. +* `#13534 `__: BLD: Make CI pass again with pytest 4.5 +* `#13541 `__: ENH: restore unpack bit lookup table +* `#13544 `__: ENH: Allow broadcast to be called with zero arguments +* `#13550 `__: TST: Register markers in conftest.py. +* `#13551 `__: DOC: Add note to ``nonzero`` docstring. +* `#13558 `__: MAINT: Fix errors seen on new python 3.8 +* `#13570 `__: DOC: Remove duplicate documentation of the PyArray_SimpleNew... +* `#13571 `__: DOC: Mention that expand_dims returns a view +* `#13574 `__: DOC: remove performance claim from searchsorted() +* `#13575 `__: TST: Apply ufunc signature and type test fixmes. +* `#13581 `__: ENH: AVX support for exp/log for strided float32 arrays +* `#13584 `__: DOC: roadmap update +* `#13589 `__: MAINT: Increment stacklevel for warnings to account for NEP-18... +* `#13590 `__: BUG: Fixes for Undefined Behavior Sanitizer (UBSan) errors. +* `#13595 `__: NEP: update NEP 19 with API terminology +* `#13599 `__: DOC: Fixed minor doc error in take_along_axis +* `#13603 `__: TST: bump / verify OpenBLAS in CI +* `#13619 `__: DOC: Add missing return value documentation in ndarray.require +* `#13621 `__: DOC: Update boolean indices in index arrays with slices example +* `#13623 `__: BUG: Workaround for bug in clang7.0 +* `#13624 `__: DOC: revert __skip_array_function__ from NEP-18 +* `#13626 `__: DOC: update isfortran docs with return value +* `#13627 `__: MAINT: revert __skip_array_function__ from NEP-18 +* `#13629 `__: BUG: setup.py install --skip-build fails +* `#13632 `__: MAINT: Collect together the special-casing of 0d nonzero into... +* `#13633 `__: DOC: caution against relying upon NumPy's implementation in subclasses +* `#13634 `__: MAINT: avoid nested dispatch in numpy.core.shape_base +* `#13636 `__: DOC: Add return section to linalg.matrix_rank & tensordot +* `#13639 `__: MAINT: Update mailmap for 1.17.0 +* `#13642 `__: BUG: special case object arrays when printing rel-, abs-error... +* `#13648 `__: BUG: ensure that casting to/from structured is properly checked. +* `#13649 `__: DOC: Mention PyArray_GetField steals a reference +* `#13652 `__: MAINT: remove superfluous setting in can_cast_safely_table. +* `#13655 `__: BUG/MAINT: Non-native byteorder in random ints +* `#13656 `__: PERF: Use intrinsic rotr on Windows +* `#13657 `__: BUG: Avoid leading underscores in C function names. +* `#13660 `__: DOC: Updates following NumPy 1.16.4 release. +* `#13663 `__: BUG: regression for array([pandas.DataFrame()]) +* `#13664 `__: MAINT: Misc. typo fixes +* `#13665 `__: MAINT: Use intrinsics in Win64-PCG64 +* `#13670 `__: BUG: Fix RandomState argument name +* `#13672 `__: DOC: Fix rst markup in RELEASE_WALKTHROUGH. +* `#13678 `__: BUG: fix benchmark suite importability on Numpy<1.17 +* `#13682 `__: ENH: Support __length_hint__ in PyArray_FromIter +* `#13684 `__: BUG: Move ndarray.dump to python and make it close the file it... +* `#13687 `__: DOC: Remove misleading statement +* `#13688 `__: MAINT: Correct masked aliases +* `#13690 `__: MAINT: Remove version added from Generator +* `#13691 `__: BUG: Prevent passing of size 0 to array alloc C functions +* `#13692 `__: DOC: Update C-API documentation of scanfunc, fromstr +* `#13693 `__: ENH: Pass input strides and dimensions by pointer to const +* `#13695 `__: BUG: Ensure Windows choice returns int32 +* `#13696 `__: DOC: Put the useful constants first +* `#13697 `__: MAINT: speed up hstack and vstack by eliminating list comprehension. +* `#13700 `__: Add links for GitHub Sponsors button. +* `#13703 `__: DOC: Adds documentation for numpy.dtype.base +* `#13704 `__: DOC: Mention PyArray_DIMS can be NULL +* `#13708 `__: DEP: Deprecate nonzero(0d) in favor of calling atleast_1d explicitly +* `#13715 `__: BUG: Fix use-after-free in boolean indexing +* `#13716 `__: BUG: Fix random.choice when probability is not C contiguous +* `#13720 `__: MAINT/BUG: Manage more files with with statements +* `#13721 `__: MAINT,BUG: More ufunc exception cleanup +* `#13724 `__: MAINT: fix use of cache_dim +* `#13725 `__: BUG: fix compilation of 3rd party modules with Py_LIMITED_API... +* `#13726 `__: MAINT: Update PCG jump sizes +* `#13729 `__: DOC: Merge together DISTUTILS.rst.txt#template-files" and distutils.r… +* `#13730 `__: MAINT: Change keyword from reserved word +* `#13737 `__: DOC: Mention and try to explain pairwise summation in sum +* `#13741 `__: MAINT: random: Remove unused empty file binomial.h. +* `#13743 `__: MAINT: random: Rename legacy distributions file. +* `#13744 `__: DOC: Update the C style guide for C99. +* `#13745 `__: BUG: fix segfault on side-effect in __bool__ function in array.nonzero() +* `#13746 `__: [WIP] DOC : Refactor C-API -- Python Types and C structures +* `#13757 `__: MAINT: fix histogram*d dispatchers +* `#13760 `__: DOC: update test guidelines document to use pytest for skipif +* `#13761 `__: MAINT: random: Rewrite the hypergeometric distribution. +* `#13762 `__: MAINT: Use textwrap.dedent for multiline strings +* `#13763 `__: MAINT: Use with statements and dedent in core/setup.py +* `#13767 `__: DOC: Adds examples for dtype attributes +* `#13770 `__: MAINT: random: Combine ziggurat.h and ziggurat_constants.h +* `#13771 `__: DOC: Change random to uninitialized and unpredictable in empty... +* `#13772 `__: BUILD: use numpy-wheels/openblas_support.py to create _distributor_init.py +* `#13773 `__: DOC: Update of reference to paper for Lemire's method +* `#13774 `__: BUG: Make ``Generator._masked`` flag default to ``False``. +* `#13777 `__: MAINT: Remove duplication of should_use_min_scalar_type function +* `#13780 `__: ENH: use SeedSequence instead of seed() +* `#13781 `__: DOC: Update TESTS.rst.txt for pytest +* `#13786 `__: MAINT: random: Fix a few compiler warnings. +* `#13787 `__: DOC: Fixed the problem of "versionadded" +* `#13788 `__: MAINT: fix 'in' -> 'is' typo +* `#13789 `__: MAINT: Fix warnings in radixsort.c.src: comparing integers of... +* `#13791 `__: MAINT: remove dSFMT +* `#13792 `__: LICENSE: update dragon4 license to MIT +* `#13793 `__: MAINT: remove xoshiro* BitGenerators +* `#13795 `__: DOC: Update description of sep in fromstring +* `#13803 `__: DOC: Improve documentation for ``defchararray`` +* `#13813 `__: BUG: further fixup to histogram2d dispatcher. +* `#13815 `__: MAINT: Correct intrinsic use on Windows +* `#13818 `__: TST: Add tests for ComplexWarning in astype +* `#13819 `__: DOC: Fix documented default value of ``__array_priority__`` for... +* `#13820 `__: MAINT, DOC: Fix misspelled words in documetation. +* `#13821 `__: MAINT: core: Fix a compiler warning. +* `#13830 `__: MAINT: Update tox for supported Python versions +* `#13832 `__: MAINT: remove pcg32 BitGenerator +* `#13833 `__: MAINT: remove ThreeFry BitGenerator +* `#13837 `__: MAINT, BUG: fixes from seedsequence +* `#13838 `__: ENH: SFC64 BitGenerator +* `#13839 `__: MAINT: Ignore some generated files. +* `#13840 `__: ENH: np.random.default_gen() +* `#13843 `__: DOC: remove note about `__array_ufunc__` being provisional for... +* `#13849 `__: DOC: np.random documentation cleanup and expansion. +* `#13850 `__: DOC: Update performance numbers +* `#13851 `__: MAINT: Update shippable.yml to remove Python 2 dependency +* `#13855 `__: BUG: Fix memory leak in dtype from dict contructor +* `#13856 `__: MAINT: move location of bitgen.h +* `#13858 `__: BUG: do not force emulation of 128-bit arithmetic. +* `#13859 `__: DOC: Update performance numbers for PCG64 +* `#13861 `__: BUG: Ensure consistent interpretation of uint64 states. +* `#13863 `__: DOC: Document the precise PCG variant. +* `#13864 `__: TST: Ignore DeprecationWarning during nose imports +* `#13869 `__: DOC: Prepare for 1.17.0rc1 release +* `#13870 `__: MAINT,BUG: Use nbytes to also catch empty descr during allocation +* `#13873 `__: ENH: Rename default_gen -> default_rng +* `#13893 `__: DOC: fix links in 1.17 release note +* `#13897 `__: DOC: Use Cython >= 0.29.11 for Python 3.8 support. +* `#13932 `__: MAINT,BUG,DOC: Fix errors in _add_newdocs +* `#13963 `__: ENH, BUILD: refactor all OpenBLAS downloads into a single, testable... +* `#13971 `__: DOC: emphasize random API changes +* `#13972 `__: MAINT: Rewrite Floyd algorithm +* `#13992 `__: BUG: Do not crash on recursive `.dtype` attribute lookup. +* `#13993 `__: DEP: Speed up WarnOnWrite deprecation in buffer interface +* `#13995 `__: BLD: Remove Trusty dist in Travis CI build +* `#13996 `__: BUG: Handle weird bytestrings in dtype() +* `#13997 `__: BUG: i0 Bessel function regression on array-likes supporting... +* `#13998 `__: BUG: Missing warnings import in polyutils. +* `#13999 `__: DOC: Document array_function at a higher level. +* `#14001 `__: DOC: Show workaround for Generator.integers backward compatibility +* `#14021 `__: DOC: Prepare 1.17.0rc2 release. +* `#14040 `__: DOC: Improve quickstart documentation of new random Generator. +* `#14041 `__: TST, MAINT: expand OpenBLAS version checking +* `#14080 `__: BUG, DOC: add new recfunctions to `__all__` +* `#14081 `__: BUG: fix build issue on icc 2016 +* `#14082 `__: BUG: Fix file-like object check when saving arrays +* `#14109 `__: REV: "ENH: Improved performance of PyArray_FromAny for sequences... +* `#14126 `__: BUG, TEST: Adding validation test suite to validate float32 exp +* `#14127 `__: DOC: Add blank line above doctest for intersect1d +* `#14128 `__: MAINT: adjustments to test_ufunc_noncontigous +* `#14129 `__: MAINT: Use equality instead of identity check with literal +* `#14133 `__: MAINT: Update mailmap and changelog for 1.17.0 diff --git a/doc/neps/nep-0010-new-iterator-ufunc.rst b/doc/neps/nep-0010-new-iterator-ufunc.rst index 8601b4a4c..fd7b3e52c 100644 --- a/doc/neps/nep-0010-new-iterator-ufunc.rst +++ b/doc/neps/nep-0010-new-iterator-ufunc.rst @@ -1877,8 +1877,8 @@ the new iterator. Here is one of the original functions, for reference, and some random image data.:: - In [5]: rand1 = np.random.random_sample(1080*1920*4).astype(np.float32) - In [6]: rand2 = np.random.random_sample(1080*1920*4).astype(np.float32) + In [5]: rand1 = np.random.random(1080*1920*4).astype(np.float32) + In [6]: rand2 = np.random.random(1080*1920*4).astype(np.float32) In [7]: image1 = rand1.reshape(1080,1920,4).swapaxes(0,1) In [8]: image2 = rand2.reshape(1080,1920,4).swapaxes(0,1) diff --git a/doc/neps/nep-0016-abstract-array.rst b/doc/neps/nep-0016-abstract-array.rst index 86d164d8e..7551b11b9 100644 --- a/doc/neps/nep-0016-abstract-array.rst +++ b/doc/neps/nep-0016-abstract-array.rst @@ -266,7 +266,7 @@ array, then they'll get a segfault. Right now, in the same situation, ``asarray`` will instead invoke the object's ``__array__`` method, or use the buffer interface to make a view, or pass through an array with object dtype, or raise an error, or similar. Probably none of these -outcomes are actually desireable in most cases, so maybe making it a +outcomes are actually desirable in most cases, so maybe making it a segfault instead would be OK? But it's dangerous given that we don't know how common such code is. OTOH, if we were starting from scratch then this would probably be the ideal solution. diff --git a/doc/neps/nep-0018-array-function-protocol.rst b/doc/neps/nep-0018-array-function-protocol.rst index ffe780c79..fb9b838b5 100644 --- a/doc/neps/nep-0018-array-function-protocol.rst +++ b/doc/neps/nep-0018-array-function-protocol.rst @@ -10,6 +10,7 @@ NEP 18 — A dispatch mechanism for NumPy's high level array functions :Status: Provisional :Type: Standards Track :Created: 2018-05-29 +:Updated: 2019-05-25 :Resolution: https://mail.python.org/pipermail/numpy-discussion/2018-August/078493.html Abstact @@ -97,12 +98,15 @@ A prototype implementation can be found in .. note:: - Dispatch with the ``__array_function__`` protocol has been implemented on - NumPy's master branch but is not yet enabled by default. In NumPy 1.16, - you will need to set the environment variable - ``NUMPY_EXPERIMENTAL_ARRAY_FUNCTION=1`` before importing NumPy to test - NumPy function overrides. We anticipate the protocol will be enabled by - default in NumPy 1.17. + Dispatch with the ``__array_function__`` protocol has been implemented but is + not yet enabled by default: + + - In NumPy 1.16, you need to set the environment variable + ``NUMPY_EXPERIMENTAL_ARRAY_FUNCTION=1`` before importing NumPy to test + NumPy function overrides. + - In NumPy 1.17, the protocol will be enabled by default, but can be disabled + with ``NUMPY_EXPERIMENTAL_ARRAY_FUNCTION=0``. + - Eventually, expect to ``__array_function__`` to always be enabled. The interface ~~~~~~~~~~~~~ @@ -199,6 +203,14 @@ include *all* of the corresponding NumPy function's optional arguments Optional arguments are only passed in to ``__array_function__`` if they were explicitly used in the NumPy function call. +.. note:: + + Just like the case for builtin special methods like ``__add__``, properly + written ``__array_function__`` methods should always return + ``NotImplemented`` when an unknown type is encountered. Otherwise, it will + be impossible to correctly override NumPy functions from another object + if the operation also includes one of your objects. + Necessary changes within the NumPy codebase itself ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -300,6 +312,13 @@ In particular: - If all ``__array_function__`` methods return ``NotImplemented``, NumPy will raise ``TypeError``. +If no ``__array_function__`` methods exist, NumPy will default to calling its +own implementation, intended for use on NumPy arrays. This case arises, for +example, when all array-like arguments are Python numbers or lists. +(NumPy arrays do have a ``__array_function__`` method, given below, but it +always returns ``NotImplemented`` if any argument other than a NumPy array +subclass implements ``__array_function__``.) + One deviation from the current behavior of ``__array_ufunc__`` is that NumPy will only call ``__array_function__`` on the *first* argument of each unique type. This matches Python's @@ -310,31 +329,47 @@ between these two dispatch protocols, we should `also update `_ ``__array_ufunc__`` to match this behavior. -Special handling of ``numpy.ndarray`` -''''''''''''''''''''''''''''''''''''' +The ``__array_function__`` method on ``numpy.ndarray`` +'''''''''''''''''''''''''''''''''''''''''''''''''''''' The use cases for subclasses with ``__array_function__`` are the same as those -with ``__array_ufunc__``, so ``numpy.ndarray`` should also define a -``__array_function__`` method mirroring ``ndarray.__array_ufunc__``: +with ``__array_ufunc__``, so ``numpy.ndarray`` also defines a +``__array_function__`` method: .. code:: python def __array_function__(self, func, types, args, kwargs): - # Cannot handle items that have __array_function__ other than our own. - for t in types: - if (hasattr(t, '__array_function__') and - t.__array_function__ is not ndarray.__array_function__): - return NotImplemented - - # Arguments contain no overrides, so we can safely call the - # overloaded function again. - return func(*args, **kwargs) - -To avoid infinite recursion, the dispatch rules for ``__array_function__`` need -also the same special case they have for ``__array_ufunc__``: any arguments with -an ``__array_function__`` method that is identical to -``numpy.ndarray.__array_function__`` are not be called as -``__array_function__`` implementations. + if not all(issubclass(t, ndarray) for t in types): + # Defer to any non-subclasses that implement __array_function__ + return NotImplemented + + # Use NumPy's private implementation without __array_function__ + # dispatching + return func._implementation(*args, **kwargs) + +This method matches NumPy's dispatching rules, so for most part it is +possible to pretend that ``ndarray.__array_function__`` does not exist. +The private ``_implementation`` attribute, defined below in the +``array_function_dispatch`` decorator, allows us to avoid the special cases for +NumPy arrays that were needed in the ``__array_ufunc__`` protocol. + +The ``__array_function__`` protocol always calls subclasses before +superclasses, so if any ``ndarray`` subclasses are involved in an operation, +they will get the chance to override it, just as if any other argument +overrides ``__array_function__``. But the default behavior in an operation +that combines a base NumPy array and a subclass is different: if the subclass +returns ``NotImplemented``, NumPy's implementation of the function will be +called instead of raising an exception. This is appropriate since subclasses +are `expected to be substitutable `_. + +We still caution authors of subclasses to exercise caution when relying +upon details of NumPy's internal implementations. It is not always possible to +write a perfectly substitutable ndarray subclass, e.g., in cases involving the +creation of new arrays, not least because NumPy makes use of internal +optimizations specialized to base NumPy arrays, e.g., code written in C. Even +if NumPy's implementation happens to work today, it may not work in the future. +In these cases, your recourse is to re-implement top-level NumPy functions via +``__array_function__`` on your subclass. Changes within NumPy functions ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -346,13 +381,12 @@ but of fairly simple and innocuous code that should complete quickly and without effect if no arguments implement the ``__array_function__`` protocol. -In most cases, these functions should written using the -``array_function_dispatch`` decorator, which also associates dispatcher -functions: +To achieve this, we define a ``array_function_dispatch`` decorator to rewrite +NumPy functions. The basic implementation is as follows: .. code:: python - def array_function_dispatch(dispatcher): + def array_function_dispatch(dispatcher, module=None): """Wrap a function for dispatch with the __array_function__ protocol.""" def decorator(implementation): @functools.wraps(implementation) @@ -360,6 +394,10 @@ functions: relevant_args = dispatcher(*args, **kwargs) return implement_array_function( implementation, public_api, relevant_args, args, kwargs) + if module is not None: + public_api.__module__ = module + # for ndarray.__array_function__ + public_api._implementation = implementation return public_api return decorator @@ -367,7 +405,7 @@ functions: def _broadcast_to_dispatcher(array, shape, subok=None): return (array,) - @array_function_dispatch(_broadcast_to_dispatcher) + @array_function_dispatch(_broadcast_to_dispatcher, module='numpy') def broadcast_to(array, shape, subok=False): ... # existing definition of np.broadcast_to @@ -385,33 +423,41 @@ It's particularly worth calling out the decorator's use of the wrapped NumPy function. - On Python 3, it also ensures that the decorator function copies the original function signature, which is important for introspection based tools such as - auto-complete. If we care about preserving function signatures on Python 2, - for the `short while longer `_ - that NumPy supports Python 2.7, we do could do so by adding a vendored - dependency on the (single-file, BSD licensed) - `decorator library `_. + auto-complete. - Finally, it ensures that the wrapped function `can be pickled `_. -In a few cases, it would not make sense to use the ``array_function_dispatch`` -decorator directly, but override implementation in terms of -``implement_array_function`` should still be straightforward. - -- Functions written entirely in C (e.g., ``np.concatenate``) can't use - decorators, but they could still use a C equivalent of - ``implement_array_function``. If performance is not a - concern, they could also be easily wrapped with a small Python wrapper. -- ``np.einsum`` does complicated argument parsing to handle two different - function signatures. It would probably be best to avoid the overhead of - parsing it twice in the typical case of no overrides. - -Fortunately, in each of these cases so far, the functions already has a generic -signature of the form ``*args, **kwargs``, which means we don't need to worry -about potential inconsistency between how functions are called and what we pass -to ``__array_function__``. (In C, arguments for all Python functions are parsed -from a tuple ``*args`` and dict ``**kwargs``.) This shouldn't stop us from -writing overrides for functions with non-generic signatures that can't use the -decorator, but we should consider these cases carefully. +The example usage illustrates several best practices for writing dispatchers +relevant to NumPy contributors: + +- We passed the ``module`` argument, which in turn sets the ``__module__`` + attribute on the generated function. This is for the benefit of better error + messages, here for errors raised internally by NumPy when no implementation + is found, e.g., + ``TypeError: no implementation found for 'numpy.broadcast_to'``. Setting + ``__module__`` to the canonical location in NumPy's public API encourages + users to use NumPy's public API for identifying functions in + ``__array_function__``. + +- The dispatcher is a function that returns a tuple, rather than an equivalent + (and equally valid) generator using ``yield``: + + .. code:: python + + # example usage + def broadcast_to(array, shape, subok=None): + yield array + + This is no accident: NumPy's implementation of dispatch for + ``__array_function__`` is fastest when dispatcher functions return a builtin + sequence type (``tuple`` or ``list``). + + On a related note, it's perfectly fine for dispatchers to return arguments + even if in some cases you *know* that they cannot have an + ``__array_function__`` method. This can arise for functions with default + arguments (e.g., ``None``) or complex signatures. NumPy's dispatching logic + sorts out these cases very quickly, so it generally is not worth the trouble + of parsing them on your own. .. note:: @@ -426,10 +472,10 @@ An important virtue of this approach is that it allows for adding new optional arguments to NumPy functions without breaking code that already relies on ``__array_function__``. -This is not a theoretical concern. The implementation of overrides *within* -functions like ``np.sum()`` rather than defining a new function capturing -``*args`` and ``**kwargs`` necessitated some awkward gymnastics to ensure that -the new ``keepdims`` argument is only passed in cases where it is used, e.g., +This is not a theoretical concern. NumPy's older, haphazard implementation of +overrides *within* functions like ``np.sum()`` necessitated some awkward +gymnastics when we decided to add new optional arguments, e.g., the new +``keepdims`` argument is only passed in cases where it is used: .. code:: python @@ -439,11 +485,12 @@ the new ``keepdims`` argument is only passed in cases where it is used, e.g., kwargs['keepdims'] = keepdims return array.sum(..., **kwargs) -This also makes it possible to add optional arguments to ``__array_function__`` -implementations incrementally and only in cases where it makes sense. For -example, a library implementing immutable arrays would not be required to -explicitly include an unsupported ``out`` argument. Doing this properly for all -optional arguments is somewhat onerous, e.g., +For ``__array_function__`` implementors, this also means that it is possible +to implement even existing optional arguments incrementally, and only in cases +where it makes sense. For example, a library implementing immutable arrays +would not be required to explicitly include an unsupported ``out`` argument in +the function signature. This can be somewhat onerous to implement properly, +e.g., .. code:: python @@ -553,7 +600,7 @@ Backward compatibility ---------------------- This proposal does not change existing semantics, except for those arguments -that currently have ``__array_function__`` methods, which should be rare. +that currently have ``__array_function__`` attributes, which should be rare. Alternatives @@ -595,7 +642,7 @@ layer, separating NumPy's high level API from default implementations on The downsides are that this would require an explicit opt-in from all existing code, e.g., ``import numpy.api as np``, and in the long term -would result in the maintainence of two separate NumPy APIs. Also, many +would result in the maintenance of two separate NumPy APIs. Also, many functions from ``numpy`` itself are already overloaded (but inadequately), so confusion about high vs. low level APIs in NumPy would still persist. @@ -631,7 +678,7 @@ would be straightforward to write a shim for a default Implementations in terms of a limited core API ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -The internal implementations of some NumPy functions is extremely simple. +The internal implementation of some NumPy functions is extremely simple. For example: - ``np.stack()`` is implemented in only a few lines of code by combining @@ -669,8 +716,8 @@ However, to work well this would require the possibility of implementing *some* but not all functions with ``__array_function__``, e.g., as described in the next section. -Coercion to a NumPy array as a catch-all fallback -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Partial implementation of NumPy's API +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ With the current design, classes that implement ``__array_function__`` to overload at least one function implicitly declare an intent to @@ -687,44 +734,64 @@ that assuredly many pandas users rely on. If pandas implemented functions like ``np.nanmean`` would suddenly break on pandas objects by raising TypeError. +Even libraries that reimplement most of NumPy's public API sometimes rely upon +using utility functions from NumPy without a wrapper. For example, both CuPy +and JAX simply `use an alias `_ to +``np.result_type``, which already supports duck-types with a ``dtype`` +attribute. + With ``__array_ufunc__``, it's possible to alleviate this concern by casting all arguments to numpy arrays and re-calling the ufunc, but the heterogeneous function signatures supported by ``__array_function__`` make it impossible to implement this generic fallback behavior for ``__array_function__``. -We could resolve this issue by change the handling of return values in -``__array_function__`` in either of two possible ways: +We considered three possible ways to resolve this issue, but none were +entirely satisfactory: -1. Change the meaning of all arguments returning ``NotImplemented`` to indicate - that all arguments should be coerced to NumPy arrays and the operation - should be retried. However, many array libraries (e.g., scipy.sparse) really - don't want implicit conversions to NumPy arrays, and often avoid implementing - ``__array__`` for exactly this reason. Implicit conversions can result in - silent bugs and performance degradation. +1. Change the meaning of all arguments returning ``NotImplemented`` from + ``__array_function__`` to indicate that all arguments should be coerced to + NumPy arrays and the operation should be retried. However, many array + libraries (e.g., scipy.sparse) really don't want implicit conversions to + NumPy arrays, and often avoid implementing ``__array__`` for exactly this + reason. Implicit conversions can result in silent bugs and performance + degradation. Potentially, we could enable this behavior only for types that implement ``__array__``, which would resolve the most problematic cases like scipy.sparse. But in practice, a large fraction of classes that present a high level API like NumPy arrays already implement ``__array__``. This would preclude reliable use of NumPy's high level API on these objects. + 2. Use another sentinel value of some sort, e.g., - ``np.NotImplementedButCoercible``, to indicate that a class implementing part - of NumPy's higher level array API is coercible as a fallback. This is a more - appealing option. - -With either approach, we would need to define additional rules for *how* -coercible array arguments are coerced. The only sane rule would be to treat -these return values as equivalent to not defining an -``__array_function__`` method at all, which means that NumPy functions would -fall-back to their current behavior of coercing all array-like arguments. - -It is not yet clear to us yet if we need an optional like -``NotImplementedButCoercible``, so for now we propose to defer this issue. -We can always implement ``np.NotImplementedButCoercible`` at some later time if -it proves critical to the NumPy community in the future. Importantly, we don't -think this will stop critical libraries that desire to implement most of the -high level NumPy API from adopting this proposal. + ``np.NotImplementedButCoercible``, to indicate that a class implementing + part of NumPy's higher level array API is coercible as a fallback. If all + arguments return ``NotImplementedButCoercible``, arguments would be coerced + and the operation would be retried. + + Unfortunately, correct behavior after encountering + ``NotImplementedButCoercible`` is not always obvious. Particularly + challenging is the "mixed" case where some arguments return + ``NotImplementedButCoercible`` and others return ``NotImplemented``. + Would dispatching be retried after only coercing the "coercible" arguments? + If so, then conceivably we could end up looping through the dispatching + logic an arbitrary number of times. Either way, the dispatching rules would + definitely get more complex and harder to reason about. + +3. Allow access to NumPy's implementation of functions, e.g., in the form of + a publicly exposed ``__skip_array_function__`` attribute on the NumPy + functions. This would allow for falling back to NumPy's implementation by + using ``func.__skip_array_function__`` inside ``__array_function__`` + methods, and could also potentially be used to be used to avoid the + overhead of dispatching. However, it runs the risk of potentially exposing + details of NumPy's implementations for NumPy functions that do not call + ``np.asarray()`` internally. See + `this note `_ + for a summary of the full discussion. + +These solutions would solve real use cases, but at the cost of additional +complexity. We would like to gain experience with how ``__array_function__`` is +actually used before making decisions that would be difficult to roll back. A magic decorator that inspects type annotations ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -860,7 +927,7 @@ a descriptor. Given the complexity and the limited use cases, we are also deferring on this issue for now, but we are confident that ``__array_function__`` could be -expanded to accomodate these use cases in the future if need be. +expanded to accommodate these use cases in the future if need be. Discussion ---------- @@ -877,7 +944,7 @@ it was discussed at a `NumPy developer sprint Berkeley Institute for Data Science (BIDS) `_. Detailed discussion of this proposal itself can be found on the -`the mailing list `_ and relvant pull requests +`the mailing list `_ and relevant pull requests (`1 `_, `2 `_, `3 `_) diff --git a/doc/neps/nep-0019-rng-policy.rst b/doc/neps/nep-0019-rng-policy.rst index f50897b0f..aa5fdc653 100644 --- a/doc/neps/nep-0019-rng-policy.rst +++ b/doc/neps/nep-0019-rng-policy.rst @@ -6,6 +6,7 @@ NEP 19 — Random Number Generator Policy :Status: Accepted :Type: Standards Track :Created: 2018-05-24 +:Updated: 2019-05-21 :Resolution: https://mail.python.org/pipermail/numpy-discussion/2018-June/078126.html Abstract @@ -91,7 +92,8 @@ those contributors simply walked away. Implementation -------------- -Work on a proposed new PRNG subsystem is already underway in the randomgen_ +Work on a proposed new Pseudo Random Number Generator (PRNG) subsystem is +already underway in the randomgen_ project. The specifics of the new design are out of scope for this NEP and up for much discussion, but we will discuss general policies that will guide the evolution of whatever code is adopted. We will also outline just a few of the @@ -119,37 +121,38 @@ Gaussian variate generation to the faster `Ziggurat algorithm discouraged improvement would be tweaking the Ziggurat tables just a little bit for a small performance improvement. -Any new design for the RNG subsystem will provide a choice of different core +Any new design for the random subsystem will provide a choice of different core uniform PRNG algorithms. A promising design choice is to make these core uniform PRNGs their own lightweight objects with a minimal set of methods -(randomgen_ calls them “basic RNGs”). The broader set of non-uniform +(randomgen_ calls them “BitGenerators”). The broader set of non-uniform distributions will be its own class that holds a reference to one of these core uniform PRNG objects and simply delegates to the core uniform PRNG object when -it needs uniform random numbers. To borrow an example from randomgen_, the -class ``MT19937`` is a basic RNG that implements the classic Mersenne Twister -algorithm. The class ``RandomGenerator`` wraps around the basic RNG to provide +it needs uniform random numbers (randomgen_ calls this the Generator). To +borrow an example from randomgen_, the +class ``MT19937`` is a BitGenerator that implements the classic Mersenne Twister +algorithm. The class ``Generator`` wraps around the BitGenerator to provide all of the non-uniform distribution methods:: # This is not the only way to instantiate this object. # This is just handy for demonstrating the delegation. - >>> brng = MT19937(seed) - >>> rg = RandomGenerator(brng) + >>> bg = MT19937(seed) + >>> rg = Generator(bg) >>> x = rg.standard_normal(10) -We will be more strict about a select subset of methods on these basic RNG +We will be more strict about a select subset of methods on these BitGenerator objects. They MUST guarantee stream-compatibility for a specified set of methods which are chosen to make it easier to compose them to build other distributions and which are needed to abstract over the implementation details -of the variety of core PRNG algorithms. Namely, +of the variety of BitGenerator algorithms. Namely, * ``.bytes()`` - * ``.random_uintegers()`` - * ``.random_sample()`` + * ``integers()`` (formerly ``.random_integers()``) + * ``random()`` (formerly ``.random_sample()``) -The distributions class (``RandomGenerator``) SHOULD have all of the same +The distributions class (``Generator``) SHOULD have all of the same distribution methods as ``RandomState`` with close-enough function signatures such that almost all code that currently works with ``RandomState`` instances -will work with ``RandomGenerator`` instances (ignoring the precise stream +will work with ``Generator`` instances (ignoring the precise stream values). Some variance will be allowed for integer distributions: in order to avoid some of the cross-platform problems described above, these SHOULD be rewritten to work with ``uint64`` numbers on all platforms. @@ -183,9 +186,10 @@ reproducible across numpy versions. This legacy distributions class MUST be accessible under the name ``numpy.random.RandomState`` for backwards compatibility. All current ways of instantiating ``numpy.random.RandomState`` with a given state should -instantiate the Mersenne Twister basic RNG with the same state. The legacy -distributions class MUST be capable of accepting other basic RNGs. The purpose -here is to ensure that one can write a program with a consistent basic RNG +instantiate the Mersenne Twister BitGenerator with the same state. The legacy +distributions class MUST be capable of accepting other BitGenerators. The +purpose +here is to ensure that one can write a program with a consistent BitGenerator state with a mixture of libraries that may or may not have upgraded from ``RandomState``. Instances of the legacy distributions class MUST respond ``True`` to ``isinstance(rg, numpy.random.RandomState)`` because there is @@ -209,27 +213,27 @@ consistently and usefully, but a very common usage is in unit tests where many of the problems of global state are less likely. This NEP does not propose removing these functions or changing them to use the -less-stable ``RandomGenerator`` distribution implementations. Future NEPs +less-stable ``Generator`` distribution implementations. Future NEPs might. Specifically, the initial release of the new PRNG subsystem SHALL leave these convenience functions as aliases to the methods on a global ``RandomState`` -that is initialized with a Mersenne Twister basic RNG object. A call to -``numpy.random.seed()`` will be forwarded to that basic RNG object. In +that is initialized with a Mersenne Twister BitGenerator object. A call to +``numpy.random.seed()`` will be forwarded to that BitGenerator object. In addition, the global ``RandomState`` instance MUST be accessible in this initial release by the name ``numpy.random.mtrand._rand``: Robert Kern long ago promised ``scikit-learn`` that this name would be stable. Whoops. -In order to allow certain workarounds, it MUST be possible to replace the basic -RNG underneath the global ``RandomState`` with any other basic RNG object (we -leave the precise API details up to the new subsystem). Calling +In order to allow certain workarounds, it MUST be possible to replace the +BitGenerator underneath the global ``RandomState`` with any other BitGenerator +object (we leave the precise API details up to the new subsystem). Calling ``numpy.random.seed()`` thereafter SHOULD just pass the given seed to the -current basic RNG object and not attempt to reset the basic RNG to the Mersenne -Twister. The set of ``numpy.random.*`` convenience functions SHALL remain the -same as they currently are. They SHALL be aliases to the ``RandomState`` -methods and not the new less-stable distributions class (``RandomGenerator``, -in the examples above). Users who want to get the fastest, best distributions -can follow best practices and instantiate generator objects explicitly. +current BitGenerator object and not attempt to reset the BitGenerator to the +Mersenne Twister. The set of ``numpy.random.*`` convenience functions SHALL +remain the same as they currently are. They SHALL be aliases to the +``RandomState`` methods and not the new less-stable distributions class +(``Generator``, in the examples above). Users who want to get the fastest, best +distributions can follow best practices and instantiate generator objects explicitly. This NEP does not propose that these requirements remain in perpetuity. After we have experience with the new PRNG subsystem, we can and should revisit these @@ -292,14 +296,14 @@ satisfactory subset. At least some projects used a fairly broad selection of the ``RandomState`` methods in unit tests. Downstream project owners would have been forced to modify their code to -accomodate the new PRNG subsystem. Some modifications might be simply +accommodate the new PRNG subsystem. Some modifications might be simply mechanical, but the bulk of the work would have been tedious churn for no positive improvement to the downstream project, just avoiding being broken. Furthermore, under this old proposal, we would have had a quite lengthy deprecation period where ``RandomState`` existed alongside the new system of -basic RNGs and distribution classes. Leaving the implementation of -``RandomState`` fixed meant that it could not use the new basic RNG state +BitGenerator and Generator classes. Leaving the implementation of +``RandomState`` fixed meant that it could not use the new BitGenerator state objects. Developing programs that use a mixture of libraries that have and have not upgraded would require managing two sets of PRNG states. This would notionally have been time-limited, but we intended the deprecation to be very @@ -308,9 +312,9 @@ long. The current proposal solves all of these problems. All current usages of ``RandomState`` will continue to work in perpetuity, though some may be discouraged through documentation. Unit tests can continue to use the full -complement of ``RandomState`` methods. Mixed ``RandomState/RandomGenerator`` -code can safely share the common basic RNG state. Unmodified ``RandomState`` -code can make use of the new features of alternative basic RNGs like settable +complement of ``RandomState`` methods. Mixed ``RandomState/Generator`` +code can safely share the common BitGenerator state. Unmodified ``RandomState`` +code can make use of the new features of alternative BitGenerator-like settable streams. diff --git a/doc/neps/nep-0020-gufunc-signature-enhancement.rst b/doc/neps/nep-0020-gufunc-signature-enhancement.rst index 38a9fd53b..a7a992cf1 100644 --- a/doc/neps/nep-0020-gufunc-signature-enhancement.rst +++ b/doc/neps/nep-0020-gufunc-signature-enhancement.rst @@ -3,7 +3,7 @@ NEP 20 — Expansion of Generalized Universal Function Signatures =============================================================== :Author: Marten van Kerkwijk -:Status: Accepted +:Status: Final :Type: Standards Track :Created: 2018-06-10 :Resolution: https://mail.python.org/pipermail/numpy-discussion/2018-April/077959.html, diff --git a/doc/neps/nep-0026-missing-data-summary.rst b/doc/neps/nep-0026-missing-data-summary.rst index e99138cdd..78fe999df 100644 --- a/doc/neps/nep-0026-missing-data-summary.rst +++ b/doc/neps/nep-0026-missing-data-summary.rst @@ -669,7 +669,7 @@ NumPy could more easily be overtaken by another project. In the case of the existing NA contribution at issue, how we resolve this disagreement represents a decision about how NumPy's -developers, contributers, and users should interact. If we create +developers, contributors, and users should interact. If we create a document describing a dispute resolution process, how do we design it so that it doesn't introduce a large burden and excessive uncertainty on developers that could prevent them from productively @@ -677,7 +677,7 @@ contributing code? If we go this route of writing up a decision process which includes such a dispute resolution mechanism, I think the meat of it should -be a roadmap that potential contributers and developers can follow +be a roadmap that potential contributors and developers can follow to gain influence over NumPy. NumPy development needs broad support beyond code contributions, and tying influence in the project to contributions seems to me like it would be a good way to encourage diff --git a/doc/neps/nep-0027-zero-rank-arrarys.rst b/doc/neps/nep-0027-zero-rank-arrarys.rst index d932bb609..430397235 100644 --- a/doc/neps/nep-0027-zero-rank-arrarys.rst +++ b/doc/neps/nep-0027-zero-rank-arrarys.rst @@ -51,7 +51,7 @@ However there are some important differences: * Array scalars are immutable * Array scalars have different python type for different data types - + Motivation for Array Scalars ---------------------------- @@ -62,7 +62,7 @@ we will try to explain why it is necessary to have three different ways to represent a number. There were several numpy-discussion threads: - + * `rank-0 arrays`_ in a 2002 mailing list thread. * Thoughts about zero dimensional arrays vs Python scalars in a `2005 mailing list thread`_] @@ -71,7 +71,7 @@ It has been suggested several times that NumPy just use rank-0 arrays to represent scalar quantities in all case. Pros and cons of converting rank-0 arrays to scalars were summarized as follows: -- Pros: +- Pros: - Some cases when Python expects an integer (the most dramatic is when slicing and indexing a sequence: @@ -94,15 +94,15 @@ arrays to scalars were summarized as follows: files (though this could also be done by a special case in the pickling code for arrays) -- Cons: +- Cons: - It is difficult to write generic code because scalars do not have the same methods and attributes as arrays. (such as ``.type`` or ``.shape``). Also Python scalars have - different numeric behavior as well. + different numeric behavior as well. - - This results in a special-case checking that is not - pleasant. Fundamentally it lets the user believe that + - This results in a special-case checking that is not + pleasant. Fundamentally it lets the user believe that somehow multidimensional homoegeneous arrays are something like Python lists (which except for Object arrays they are not). @@ -117,7 +117,7 @@ The Need for Zero-Rank Arrays ----------------------------- Once the idea to use zero-rank arrays to represent scalars was rejected, it was -natural to consider whether zero-rank arrays can be eliminated alltogether. +natural to consider whether zero-rank arrays can be eliminated altogether. However there are some important use cases where zero-rank arrays cannot be replaced by array scalars. See also `A case for rank-0 arrays`_ from February 2006. @@ -164,12 +164,12 @@ Alexander started a `Jan 2006 discussion`_ on scipy-dev with the following proposal: ... it may be reasonable to allow ``a[...]``. This way - ellipsis can be interpereted as any number of ``:`` s including zero. + ellipsis can be interpereted as any number of ``:`` s including zero. Another subscript operation that makes sense for scalars would be - ``a[...,newaxis]`` or even ``a[{newaxis, }* ..., {newaxis,}*]``, where - ``{newaxis,}*`` stands for any number of comma-separated newaxis tokens. + ``a[...,newaxis]`` or even ``a[{newaxis, }* ..., {newaxis,}*]``, where + ``{newaxis,}*`` stands for any number of comma-separated newaxis tokens. This will allow one to use ellipsis in generic code that would work on - any numpy type. + any numpy type. Francesc Altet supported the idea of ``[...]`` on zero-rank arrays and `suggested`_ that ``[()]`` be supported as well. @@ -204,7 +204,7 @@ remains on what should be the type of the result - zero rank ndarray or ``x.dtyp 1 Since most if not all numpy function automatically convert zero-rank arrays to scalars on return, there is no reason for -``[...]`` and ``[()]`` operations to be different. +``[...]`` and ``[()]`` operations to be different. See SVN changeset 1864 (which became git commit `9024ff0`_) for implementation of ``x[...]`` and ``x[()]`` returning numpy scalars. @@ -234,7 +234,7 @@ Currently all indexing on zero-rank arrays is implemented in a special ``if (nd that the changes do not affect any existing usage (except, the usage that relies on exceptions). On the other hand part of motivation for these changes was to make behavior of ndarrays more uniform and this should allow to -eliminate ``if (nd == 0)`` checks alltogether. +eliminate ``if (nd == 0)`` checks altogether. Copyright --------- diff --git a/doc/neps/roadmap.rst b/doc/neps/roadmap.rst index a45423711..2ec0b7520 100644 --- a/doc/neps/roadmap.rst +++ b/doc/neps/roadmap.rst @@ -6,74 +6,78 @@ This is a live snapshot of tasks and features we will be investing resources in. It may be used to encourage and inspire developers and to search for funding. -Interoperability protocols & duck typing ----------------------------------------- - -- `__array_function__` - - See `NEP 18`_ and a sample implementation_ - -- Array Duck-Typing - - `NEP 22`_ `np.asduckarray()` - -- Mixins like `NDArrayOperatorsMixin`: +Interoperability +---------------- + +We aim to make it easier to interoperate with NumPy. There are many NumPy-like +packages that add interesting new capabilities to the Python ecosystem, as well +as many libraries that extend NumPy's model in various ways. Work in NumPy to +facilitate interoperability with all such packages, and the code that uses them, +may include (among other things) interoperability protocols, better duck typing +support and ndarray subclass handling. + +- The ``__array_function__`` protocol is currently experimental and needs to be + matured. See `NEP 18`_ for details. +- New protocols for overriding other functionality in NumPy may be needed. +- Array duck typing, or handling "duck arrays", needs improvements. See + `NEP 22`_ for details. + +Extensibility +------------- - - for mutable arrays - - for reduction methods implemented as ufuncs +We aim to make it much easier to extend NumPy. The primary topic here is to +improve the dtype system. -Better dtypes -------------- +- Easier custom dtypes: -- Easier custom dtypes - Simplify and/or wrap the current C-API - More consistent support for dtype metadata - Support for writing a dtype in Python -- New string dtype(s): - - Encoded strings with fixed-width storage (utf8, latin1, ...) and/or - - Variable length strings (could share implementation with dtype=object, but are explicitly type-checked) - - One of these should probably be the default for text data. The current behavior on Python 3 is neither efficient nor user friendly. -- `np.int` should not be platform dependent -- better coercion for string + number -Random number generation policy & rewrite ------------------------------------------ +- New string dtype(s): -`NEP 19`_ and a `reference implementation`_ + - Encoded strings with fixed-width storage (utf8, latin1, ...) and/or + - Variable length strings (could share implementation with dtype=object, + but are explicitly type-checked) + - One of these should probably be the default for text data. The current + behavior on Python 3 is neither efficient nor user friendly. -Indexing --------- +- `np.int` should not be platform dependent +- Better coercion for string + number -vindex/oindex `NEP 21`_ +Performance +----------- -Infrastructure --------------- +We want to further improve NumPy's performance, through: -NumPy is much more than just the code base itself, we also maintain -docs, CI, benchmarks, etc. +- Better use of SIMD instructions, also on platforms other than x86. +- Reducing ufunc overhead. +- Optimizations in individual functions. -- Rewrite numpy.org -- Benchmarking: improve the extent of the existing suite, and run & render - the results as part of the docs or website. +Furthermore we would like to improve the benchmarking system, in terms of coverage, +easy of use, and publication of the results (now +`here `__) as part of the docs or website. - - Hardware: find a machine that can reliably run serial benchmarks - - ASV produces graphs, could we set up a site? Currently at - https://pv.github.io/numpy-bench/, should that become a community resource? +Website and documentation +------------------------- -Functionality outside core --------------------------- +Our website (https://numpy.org) is in very poor shape and needs to be rewritten +completely. -Some things inside NumPy do not actually match the `Scope of NumPy`. +The NumPy `documentation `__ is +of varying quality - in particular the User Guide needs major improvements. -- A backend system for `numpy.fft` (so that e.g. `fft-mkl` doesn't need to monkeypatch numpy) +Random number generation policy & rewrite +----------------------------------------- -- Rewrite masked arrays to not be a ndarray subclass -- maybe in a separate project? -- MaskedArray as a duck-array type, and/or -- dtypes that support missing values +A new random number generation framework with higher performance generators is +close to completion, see `NEP 19`_ and `PR 13163`_. -- Write a strategy on how to deal with overlap between numpy and scipy for `linalg` and `fft` (and implement it). +Indexing +-------- -- Deprecate `np.matrix` +We intend to add new indexing modes for "vectorized indexing" and "outer indexing", +see `NEP 21`_. Continuous Integration ---------------------- @@ -81,31 +85,25 @@ Continuous Integration We depend on CI to discover problems as we continue to develop NumPy before the code reaches downstream users. -- CI for more exotic platforms (e.g. ARM is now available from - http://www.shippable.com/, but it is not free). +- CI for more exotic platforms (if available as a service). - Multi-package testing - Add an official channel for numpy dev builds for CI usage by other projects so they may confirm new builds do not break their package. -Typing ------- +Other functionality +------------------- -Python type annotation syntax should support ndarrays and dtypes. +- ``MaskedArray`` needs to be improved, ideas include: -- Type annotations for NumPy: github.com/numpy/numpy-stubs -- Support for typing shape and dtype in multi-dimensional arrays in Python more generally - -NumPy scalars -------------- + - Rewrite masked arrays to not be a ndarray subclass -- maybe in a separate project? + - MaskedArray as a duck-array type, and/or + - dtypes that support missing values -Numpy has both scalars and zero-dimensional arrays. +- A backend system for ``numpy.fft`` (so that e.g. ``fft-mkl`` doesn't need to monkeypatch numpy) +- Write a strategy on how to deal with overlap between NumPy and SciPy for ``linalg`` + and ``fft`` (and implement it). +- Deprecate ``np.matrix`` (very slowly) -- The current implementation adds a large maintenance burden -- can we remove - scalars and/or simplify it internally? -- Zero dimensional arrays get converted into scalars by most NumPy - functions (i.e., output of `np.sin(x)` depends on whether `x` is - zero-dimensional or not). This inconsistency should be addressed, - so that one could, e.g., write sane type annotations. .. _`NEP 19`: https://www.numpy.org/neps/nep-0019-rng-policy.html .. _`NEP 22`: http://www.numpy.org/neps/nep-0022-ndarray-duck-typing-overview.html @@ -113,3 +111,4 @@ Numpy has both scalars and zero-dimensional arrays. .. _implementation: https://gist.github.com/shoyer/1f0a308a06cd96df20879a1ddb8f0006 .. _`reference implementation`: https://github.com/bashtage/randomgen .. _`NEP 21`: https://www.numpy.org/neps/nep-0021-advanced-indexing.html +.. _`PR 13163`: https://github.com/numpy/numpy/pull/13163 diff --git a/doc/release/1.12.0-notes.rst b/doc/release/1.12.0-notes.rst index 711055d16..e735d2d77 100644 --- a/doc/release/1.12.0-notes.rst +++ b/doc/release/1.12.0-notes.rst @@ -1,3 +1,5 @@ +.. 1.12.0: + ========================== NumPy 1.12.0 Release Notes ========================== diff --git a/doc/release/1.14.4-notes.rst b/doc/release/1.14.4-notes.rst index 174094c1c..3fb94383b 100644 --- a/doc/release/1.14.4-notes.rst +++ b/doc/release/1.14.4-notes.rst @@ -19,7 +19,7 @@ values are now correct. Note that NumPy will error on import if it detects incorrect float32 `dot` results. This problem has been seen on the Mac when working in the Anaconda -enviroment and is due to a subtle interaction between MKL and PyQt5. It is not +environment and is due to a subtle interaction between MKL and PyQt5. It is not strictly a NumPy problem, but it is best that users be aware of it. See the gh-8577 NumPy issue for more information. diff --git a/doc/release/1.15.6-notes.rst b/doc/release/1.15.6-notes.rst deleted file mode 100644 index 863f4b495..000000000 --- a/doc/release/1.15.6-notes.rst +++ /dev/null @@ -1,52 +0,0 @@ -========================== -NumPy 1.16.6 Release Notes -========================== - -The NumPy 1.16.6 release fixes bugs reported against the 1.16.5 release, and -also backports several enhancements from master that seem appropriate for a -release series that is the last to support Python 2.7. The wheels on PyPI are -linked with OpenBLAS v0.3.7-dev, which should fix errors on Skylake series -cpus. - -Downstream developers building this release should use Cython >= 0.29.2 and, -if using OpenBLAS, OpenBLAS >= v0.3.7. The supported Python versions are 2.7 -and 3.5-3.7. - -Highlights -========== - - -New functions -============= - - -New deprecations -================ - - -Expired deprecations -==================== - - -Future changes -============== - - -Compatibility notes -=================== - - -C API changes -============= - - -New Features -============ - - -Improvements -============ - - -Changes -======= diff --git a/doc/release/1.16.0-notes.rst b/doc/release/1.16.0-notes.rst index 341d5f715..1034d6e6c 100644 --- a/doc/release/1.16.0-notes.rst +++ b/doc/release/1.16.0-notes.rst @@ -176,7 +176,7 @@ of: * :c:member:`PyUFuncObject.core_dim_flags` * :c:member:`PyUFuncObject.core_dim_sizes` * :c:member:`PyUFuncObject.identity_value` -* :c:function:`PyUFunc_FromFuncAndDataAndSignatureAndIdentity` +* :c:func:`PyUFunc_FromFuncAndDataAndSignatureAndIdentity` New Features @@ -407,7 +407,7 @@ Additionally, `logaddexp` now has an identity of ``-inf``, allowing it to be called on empty sequences, where previously it could not be. This is possible thanks to the new -:c:function:`PyUFunc_FromFuncAndDataAndSignatureAndIdentity`, which allows +:c:func:`PyUFunc_FromFuncAndDataAndSignatureAndIdentity`, which allows arbitrary values to be used as identities now. Improved conversion from ctypes objects diff --git a/doc/release/1.16.5-notes.rst b/doc/release/1.16.5-notes.rst deleted file mode 100644 index 5b6eb585b..000000000 --- a/doc/release/1.16.5-notes.rst +++ /dev/null @@ -1,68 +0,0 @@ -========================== -NumPy 1.16.5 Release Notes -========================== - -The NumPy 1.16.5 release fixes bugs reported against the 1.16.4 release, and -also backports several enhancements from master that seem appropriate for a -release series that is the last to support Python 2.7. The wheels on PyPI are -linked with OpenBLAS v0.3.7-dev, which should fix errors on Skylake series -cpus. - -Downstream developers building this release should use Cython >= 0.29.2 and, if -using OpenBLAS, OpenBLAS >= v0.3.7. The supported Python versions are 2.7 and -3.5-3.7. - - -Contributors -============ - -A total of 18 people contributed to this release. People with a "+" by their -names contributed a patch for the first time. - -* Alexander Shadchin -* Allan Haldane -* Bruce Merry + -* Charles Harris -* Colin Snyder + -* Dan Allan + -* Emile + -* Eric Wieser -* Grey Baker + -* Maksim Shabunin + -* Marten van Kerkwijk -* Matti Picus -* Peter Andreas Entschev + -* Ralf Gommers -* Richard Harris + -* Sebastian Berg -* Sergei Lebedev + -* Stephan Hoyer - -Pull requests merged -==================== - -A total of 23 pull requests were merged for this release. - -* `#13742 `__: ENH: Add project URLs to setup.py -* `#13823 `__: TEST, ENH: fix tests and ctypes code for PyPy -* `#13845 `__: BUG: use npy_intp instead of int for indexing array -* `#13867 `__: TST: Ignore DeprecationWarning during nose imports -* `#13905 `__: BUG: Fix use-after-free in boolean indexing -* `#13933 `__: MAINT/BUG/DOC: Fix errors in _add_newdocs -* `#13984 `__: BUG: fix byte order reversal for datetime64[ns] -* `#13994 `__: MAINT,BUG: Use nbytes to also catch empty descr during allocation -* `#14042 `__: BUG: np.array cleared errors occured in PyMemoryView_FromObject -* `#14043 `__: BUG: Fixes for Undefined Behavior Sanitizer (UBSan) errors. -* `#14044 `__: BUG: ensure that casting to/from structured is properly checked. -* `#14045 `__: MAINT: fix histogram*d dispatchers -* `#14046 `__: BUG: further fixup to histogram2d dispatcher. -* `#14052 `__: BUG: Replace contextlib.suppress for Python 2.7 -* `#14056 `__: BUG: fix compilation of 3rd party modules with Py_LIMITED_API... -* `#14057 `__: BUG: Fix memory leak in dtype from dict contructor -* `#14058 `__: DOC: Document array_function at a higher level. -* `#14084 `__: BUG, DOC: add new recfunctions to `__all__` -* `#14162 `__: BUG: Remove stray print that causes a SystemError on python 3.7 -* `#14297 `__: TST: Pin pytest version to 5.0.1. -* `#14322 `__: ENH: Enable huge pages in all Linux builds -* `#14346 `__: BUG: fix behavior of structured_to_unstructured on non-trivial... -* `#14382 `__: REL: Prepare for the NumPy 1.16.5 release. diff --git a/doc/release/1.16.6-notes.rst b/doc/release/1.16.6-notes.rst deleted file mode 100644 index cda34497c..000000000 --- a/doc/release/1.16.6-notes.rst +++ /dev/null @@ -1,85 +0,0 @@ -========================== -NumPy 1.16.6 Release Notes -========================== - -The NumPy 1.16.6 release fixes bugs reported against the 1.16.5 release, and -also backports several enhancements from master that seem appropriate for a -release series that is the last to support Python 2.7. The wheels on PyPI are -linked with OpenBLAS v0.3.7, which should fix errors on Skylake series -cpus. - -Downstream developers building this release should use Cython >= 0.29.2 and, if -using OpenBLAS, OpenBLAS >= v0.3.7. The supported Python versions are 2.7 and -3.5-3.7. - -Highlights -========== - -- The ``np.testing.utils`` functions have been updated from 1.19.0-dev0. - This improves the function documentation and error messages as well - extending the ``assert_array_compare`` function to additional types. - - -New functions -============= - -Allow matmul (`@` operator) to work with object arrays. -------------------------------------------------------- -This is an enhancement that was added in NumPy 1.17 and seems reasonable to -include in the LTS 1.16 release series. - - -Compatibility notes -=================== - -Fix regression in matmul (`@` operator) for boolean types ---------------------------------------------------------- -Booleans were being treated as integers rather than booleans, -which was a regression from previous behavior. - - -Improvements -============ - -Array comparison assertions include maximum differences -------------------------------------------------------- -Error messages from array comparison tests such as ``testing.assert_allclose`` -now include "max absolute difference" and "max relative difference," in -addition to the previous "mismatch" percentage. This information makes it -easier to update absolute and relative error tolerances. - -Contributors -============ - -A total of 10 people contributed to this release. - -* CakeWithSteak -* Charles Harris -* Chris Burr -* Eric Wieser -* Fernando Saravia -* Lars Grueter -* Matti Picus -* Maxwell Aladago -* Qiming Sun -* Warren Weckesser - -Pull requests merged -==================== - -A total of 14 pull requests were merged for this release. - -* `#14211 `__: BUG: Fix uint-overflow if padding with linear_ramp and negative... -* `#14275 `__: BUG: fixing to allow unpickling of PY3 pickles from PY2 -* `#14340 `__: BUG: Fix misuse of .names and .fields in various places (backport... -* `#14423 `__: BUG: test, fix regression in converting to ctypes. -* `#14434 `__: BUG: Fixed maximum relative error reporting in assert_allclose -* `#14509 `__: BUG: Fix regression in boolean matmul. -* `#14686 `__: BUG: properly define PyArray_DescrCheck -* `#14853 `__: BLD: add 'apt update' to shippable -* `#14854 `__: BUG: Fix _ctypes class circular reference. (#13808) -* `#14856 `__: BUG: Fix `np.einsum` errors on Power9 Linux and z/Linux -* `#14863 `__: BLD: Prevent -flto from optimising long double representation... -* `#14864 `__: BUG: lib: Fix histogram problem with signed integer arrays. -* `#15172 `__: ENH: Backport improvements to testing functions. -* `#15191 `__: REL: Prepare for 1.16.6 release. diff --git a/doc/release/1.17.0-notes.rst b/doc/release/1.17.0-notes.rst new file mode 100644 index 000000000..8d69e36d9 --- /dev/null +++ b/doc/release/1.17.0-notes.rst @@ -0,0 +1,562 @@ +.. currentmodule:: numpy + +========================== +NumPy 1.17.0 Release Notes +========================== + +This NumPy release contains a number of new features that should substantially +improve its performance and usefulness, see Highlights below for a summary. The +Python versions supported are 3.5-3.7, note that Python 2.7 has been dropped. +Python 3.8b2 should work with the released source packages, but there are no +future guarantees. + +Downstream developers should use Cython >= 0.29.11 for Python 3.8 support and +OpenBLAS >= 3.7 (not currently out) to avoid problems on the Skylake +architecture. The NumPy wheels on PyPI are built from the OpenBLAS development +branch in order to avoid those problems. + + +Highlights +========== + +* A new extensible `random` module along with four selectable `random number + generators ` and improved seeding designed for use in parallel + processes has been added. The currently available bit generators are `MT19937 + `, `PCG64 `, `Philox + `, and `SFC64 `. See below under + New Features. + +* NumPy's `FFT ` implementation was changed from fftpack to pocketfft, + resulting in faster, more accurate transforms and better handling of datasets + of prime length. See below under Improvements. + +* New radix sort and timsort sorting methods. It is currently not possible to + choose which will be used. They are hardwired to the datatype and used + when either ``stable`` or ``mergesort`` is passed as the method. See below + under Improvements. + +* Overriding numpy functions is now possible by default, + see ``__array_function__`` below. + + +New functions +============= + +* `numpy.errstate` is now also a function decorator + + +Deprecations +============ + +`numpy.polynomial` functions warn when passed ``float`` in place of ``int`` +--------------------------------------------------------------------------- +Previously functions in this module would accept ``float`` values provided they +were integral (``1.0``, ``2.0``, etc). For consistency with the rest of numpy, +doing so is now deprecated, and in future will raise a ``TypeError``. + +Similarly, passing a float like ``0.5`` in place of an integer will now raise a +``TypeError`` instead of the previous ``ValueError``. + +Deprecate `numpy.distutils.exec_command` and ``temp_file_name`` +--------------------------------------------------------------- +The internal use of these functions has been refactored and there are better +alternatives. Replace ``exec_command`` with `subprocess.Popen` and +`temp_file_name ` with `tempfile.mkstemp`. + +Writeable flag of C-API wrapped arrays +-------------------------------------- +When an array is created from the C-API to wrap a pointer to data, the only +indication we have of the read-write nature of the data is the ``writeable`` +flag set during creation. It is dangerous to force the flag to writeable. +In the future it will not be possible to switch the writeable flag to ``True`` +from python. +This deprecation should not affect many users since arrays created in such +a manner are very rare in practice and only available through the NumPy C-API. + +`numpy.nonzero` should no longer be called on 0d arrays +------------------------------------------------------- +The behavior of `numpy.nonzero` on 0d arrays was surprising, making uses of it +almost always incorrect. If the old behavior was intended, it can be preserved +without a warning by using ``nonzero(atleast_1d(arr))`` instead of +``nonzero(arr)``. In a future release, it is most likely this will raise a +``ValueError``. + +Writing to the result of `numpy.broadcast_arrays` will warn +----------------------------------------------------------- + +Commonly `numpy.broadcast_arrays` returns a writeable array with internal +overlap, making it unsafe to write to. A future version will set the +``writeable`` flag to ``False``, and require users to manually set it to +``True`` if they are sure that is what they want to do. Now writing to it will +emit a deprecation warning with instructions to set the ``writeable`` flag +``True``. Note that if one were to inspect the flag before setting it, one +would find it would already be ``True``. Explicitly setting it, though, as one +will need to do in future versions, clears an internal flag that is used to +produce the deprecation warning. To help alleviate confusion, an additional +`FutureWarning` will be emitted when accessing the ``writeable`` flag state to +clarify the contradiction. + +Note that for the C-side buffer protocol such an array will return a +readonly buffer immediately unless a writable buffer is requested. If +a writeable buffer is requested a warning will be given. When using +cython, the ``const`` qualifier should be used with such arrays to avoid +the warning (e.g. ``cdef const double[::1] view``). + + +Future Changes +============== + +Shape-1 fields in dtypes won't be collapsed to scalars in a future version +-------------------------------------------------------------------------- + +Currently, a field specified as ``[(name, dtype, 1)]`` or ``"1type"`` is +interpreted as a scalar field (i.e., the same as ``[(name, dtype)]`` or +``[(name, dtype, ()]``). This now raises a FutureWarning; in a future version, +it will be interpreted as a shape-(1,) field, i.e. the same as ``[(name, +dtype, (1,))]`` or ``"(1,)type"`` (consistently with ``[(name, dtype, n)]`` +/ ``"ntype"`` with ``n>1``, which is already equivalent to ``[(name, dtype, +(n,)]`` / ``"(n,)type"``). + + +Compatibility notes +=================== + +``float16`` subnormal rounding +------------------------------ +Casting from a different floating point precision to ``float16`` used incorrect +rounding in some edge cases. This means in rare cases, subnormal results will +now be rounded up instead of down, changing the last bit (ULP) of the result. + +Signed zero when using divmod +----------------------------- +Starting in version `1.12.0`, numpy incorrectly returned a negatively signed zero +when using the ``divmod`` and ``floor_divide`` functions when the result was +zero. For example:: + + >>> np.zeros(10)//1 + array([-0., -0., -0., -0., -0., -0., -0., -0., -0., -0.]) + +With this release, the result is correctly returned as a positively signed +zero:: + + >>> np.zeros(10)//1 + array([0., 0., 0., 0., 0., 0., 0., 0., 0., 0.]) + +``MaskedArray.mask`` now returns a view of the mask, not the mask itself +------------------------------------------------------------------------ +Returning the mask itself was unsafe, as it could be reshaped in place which +would violate expectations of the masked array code. The behavior of `mask +` is now consistent with `data `, +which also returns a view. + +The underlying mask can still be accessed with ``._mask`` if it is needed. +Tests that contain ``assert x.mask is not y.mask`` or similar will need to be +updated. + +Do not lookup ``__buffer__`` attribute in `numpy.frombuffer` +------------------------------------------------------------ +Looking up ``__buffer__`` attribute in `numpy.frombuffer` was undocumented and +non-functional. This code was removed. If needed, use +``frombuffer(memoryview(obj), ...)`` instead. + +``out`` is buffered for memory overlaps in `take`, `choose`, `put` +------------------------------------------------------------------ +If the out argument to these functions is provided and has memory overlap with +the other arguments, it is now buffered to avoid order-dependent behavior. + +Unpickling while loading requires explicit opt-in +------------------------------------------------- +The functions `load`, and ``lib.format.read_array`` take an +``allow_pickle`` keyword which now defaults to ``False`` in response to +`CVE-2019-6446 `_. + + +.. currentmodule:: numpy.random.mtrand + +Potential changes to the random stream in old random module +----------------------------------------------------------- +Due to bugs in the application of ``log`` to random floating point numbers, +the stream may change when sampling from `~RandomState.beta`, `~RandomState.binomial`, +`~RandomState.laplace`, `~RandomState.logistic`, `~RandomState.logseries` or +`~RandomState.multinomial` if a ``0`` is generated in the underlying `MT19937 +<~numpy.random.mt11937.MT19937>` random stream. There is a ``1`` in +:math:`10^{53}` chance of this occurring, so the probability that the stream +changes for any given seed is extremely small. If a ``0`` is encountered in the +underlying generator, then the incorrect value produced (either `numpy.inf` or +`numpy.nan`) is now dropped. + +.. currentmodule:: numpy + +`i0` now always returns a result with the same shape as the input +----------------------------------------------------------------- +Previously, the output was squeezed, such that, e.g., input with just a single +element would lead to an array scalar being returned, and inputs with shapes +such as ``(10, 1)`` would yield results that would not broadcast against the +input. + +Note that we generally recommend the SciPy implementation over the numpy one: +it is a proper ufunc written in C, and more than an order of magnitude faster. + +`can_cast` no longer assumes all unsafe casting is allowed +---------------------------------------------------------- +Previously, `can_cast` returned `True` for almost all inputs for +``casting='unsafe'``, even for cases where casting was not possible, such as +from a structured dtype to a regular one. This has been fixed, making it +more consistent with actual casting using, e.g., the `.astype ` +method. + +``ndarray.flags.writeable`` can be switched to true slightly more often +----------------------------------------------------------------------- + +In rare cases, it was not possible to switch an array from not writeable +to writeable, although a base array is writeable. This can happen if an +intermediate `ndarray.base` object is writeable. Previously, only the deepest +base object was considered for this decision. However, in rare cases this +object does not have the necessary information. In that case switching to +writeable was never allowed. This has now been fixed. + + +C API changes +============= + +dimension or stride input arguments are now passed by ``npy_intp const*`` +------------------------------------------------------------------------- +Previously these function arguments were declared as the more strict +``npy_intp*``, which prevented the caller passing constant data. +This change is backwards compatible, but now allows code like:: + + npy_intp const fixed_dims[] = {1, 2, 3}; + // no longer complains that the const-qualifier is discarded + npy_intp size = PyArray_MultiplyList(fixed_dims, 3); + + +New Features +============ + +.. currentmodule:: numpy.random + +New extensible `numpy.random` module with selectable random number generators +----------------------------------------------------------------------------- +A new extensible `numpy.random` module along with four selectable random number +generators and improved seeding designed for use in parallel processes has been +added. The currently available :ref:`Bit Generators ` are +`~mt19937.MT19937`, `~pcg64.PCG64`, `~philox.Philox`, and `~sfc64.SFC64`. +``PCG64`` is the new default while ``MT19937`` is retained for backwards +compatibility. Note that the legacy random module is unchanged and is now +frozen, your current results will not change. More information is available in +the :ref:`API change description ` and in the `top-level view +` documentation. + +.. currentmodule:: numpy + +libFLAME +-------- +Support for building NumPy with the libFLAME linear algebra package as the LAPACK, +implementation, see +`libFLAME `_ for details. + +User-defined BLAS detection order +--------------------------------- +`distutils` now uses an environment variable, comma-separated and case +insensitive, to determine the detection order for BLAS libraries. +By default ``NPY_BLAS_ORDER=mkl,blis,openblas,atlas,accelerate,blas``. +However, to force the use of OpenBLAS simply do:: + + NPY_BLAS_ORDER=openblas python setup.py build + +which forces the use of OpenBLAS. +This may be helpful for users which have a MKL installation but wishes to try +out different implementations. + +User-defined LAPACK detection order +----------------------------------- +``numpy.distutils`` now uses an environment variable, comma-separated and case +insensitive, to determine the detection order for LAPACK libraries. +By default ``NPY_LAPACK_ORDER=mkl,openblas,flame,atlas,accelerate,lapack``. +However, to force the use of OpenBLAS simply do:: + + NPY_LAPACK_ORDER=openblas python setup.py build + +which forces the use of OpenBLAS. +This may be helpful for users which have a MKL installation but wishes to try +out different implementations. + +`ufunc.reduce` and related functions now accept a ``where`` mask +---------------------------------------------------------------- +`ufunc.reduce`, `sum`, `prod`, `min`, `max` all +now accept a ``where`` keyword argument, which can be used to tell which +elements to include in the reduction. For reductions that do not have an +identity, it is necessary to also pass in an initial value (e.g., +``initial=np.inf`` for `min`). For instance, the equivalent of +`nansum` would be ``np.sum(a, where=~np.isnan(a))``. + +Timsort and radix sort have replaced mergesort for stable sorting +----------------------------------------------------------------- +Both radix sort and timsort have been implemented and are now used in place of +mergesort. Due to the need to maintain backward compatibility, the sorting +``kind`` options ``"stable"`` and ``"mergesort"`` have been made aliases of +each other with the actual sort implementation depending on the array type. +Radix sort is used for small integer types of 16 bits or less and timsort for +the remaining types. Timsort features improved performace on data containing +already or nearly sorted data and performs like mergesort on random data and +requires :math:`O(n/2)` working space. Details of the timsort algorithm can be +found at `CPython listsort.txt +`_. + +`packbits` and `unpackbits` accept an ``order`` keyword +------------------------------------------------------- +The ``order`` keyword defaults to ``big``, and will order the **bits** +accordingly. For ``'order=big'`` 3 will become ``[0, 0, 0, 0, 0, 0, 1, 1]``, +and ``[1, 1, 0, 0, 0, 0, 0, 0]`` for ``order=little`` + +`unpackbits` now accepts a ``count`` parameter +---------------------------------------------- +``count`` allows subsetting the number of bits that will be unpacked up-front, +rather than reshaping and subsetting later, making the `packbits` operation +invertible, and the unpacking less wasteful. Counts larger than the number of +available bits add zero padding. Negative counts trim bits off the end instead +of counting from the beginning. None counts implement the existing behavior of +unpacking everything. + +`linalg.svd` and `linalg.pinv` can be faster on hermitian inputs +---------------------------------------------------------------- +These functions now accept a ``hermitian`` argument, matching the one added +to `linalg.matrix_rank` in 1.14.0. + +divmod operation is now supported for two ``timedelta64`` operands +------------------------------------------------------------------ +The divmod operator now handles two ``timedelta64`` operands, with +type signature ``mm->qm``. + +`fromfile` now takes an ``offset`` argument +------------------------------------------- +This function now takes an ``offset`` keyword argument for binary files, +which specifics the offset (in bytes) from the file's current position. +Defaults to ``0``. + +New mode "empty" for `pad` +-------------------------- +This mode pads an array to a desired shape without initializing the new +entries. + +`empty_like` and related functions now accept a ``shape`` argument +------------------------------------------------------------------ +`empty_like`, `full_like`, `ones_like` and `zeros_like` now accept a ``shape`` +keyword argument, which can be used to create a new array +as the prototype, overriding its shape as well. This is particularly useful +when combined with the ``__array_function__`` protocol, allowing the creation +of new arbitrary-shape arrays from NumPy-like libraries when such an array +is used as the prototype. + +Floating point scalars implement ``as_integer_ratio`` to match the builtin float +-------------------------------------------------------------------------------- +This returns a (numerator, denominator) pair, which can be used to construct a +`fractions.Fraction`. + +Structured ``dtype`` objects can be indexed with multiple fields names +---------------------------------------------------------------------- +``arr.dtype[['a', 'b']]`` now returns a dtype that is equivalent to +``arr[['a', 'b']].dtype``, for consistency with +``arr.dtype['a'] == arr['a'].dtype``. + +Like the dtype of structured arrays indexed with a list of fields, this dtype +has the same ``itemsize`` as the original, but only keeps a subset of the fields. + +This means that ``arr[['a', 'b']]`` and ``arr.view(arr.dtype[['a', 'b']])`` are +equivalent. + +``.npy`` files support unicode field names +------------------------------------------ +A new format version of 3.0 has been introduced, which enables structured types +with non-latin1 field names. This is used automatically when needed. + + +Improvements +============ + +Array comparison assertions include maximum differences +------------------------------------------------------- +Error messages from array comparison tests such as +`testing.assert_allclose` now include "max absolute difference" and +"max relative difference," in addition to the previous "mismatch" percentage. +This information makes it easier to update absolute and relative error +tolerances. + +Replacement of the fftpack based `fft` module by the pocketfft library +---------------------------------------------------------------------- +Both implementations have the same ancestor (Fortran77 FFTPACK by Paul N. +Swarztrauber), but pocketfft contains additional modifications which improve +both accuracy and performance in some circumstances. For FFT lengths containing +large prime factors, pocketfft uses Bluestein's algorithm, which maintains +:math:`O(N log N)` run time complexity instead of deteriorating towards +:math:`O(N*N)` for prime lengths. Also, accuracy for real valued FFTs with near +prime lengths has improved and is on par with complex valued FFTs. + +Further improvements to ``ctypes`` support in `numpy.ctypeslib` +--------------------------------------------------------------- +A new `numpy.ctypeslib.as_ctypes_type` function has been added, which can be +used to converts a `dtype` into a best-guess `ctypes` type. Thanks to this +new function, `numpy.ctypeslib.as_ctypes` now supports a much wider range of +array types, including structures, booleans, and integers of non-native +endianness. + +`numpy.errstate` is now also a function decorator +------------------------------------------------- +Currently, if you have a function like:: + + def foo(): + pass + +and you want to wrap the whole thing in `errstate`, you have to rewrite it +like so:: + + def foo(): + with np.errstate(...): + pass + +but with this change, you can do:: + + @np.errstate(...) + def foo(): + pass + +thereby saving a level of indentation + +`numpy.exp` and `numpy.log` speed up for float32 implementation +--------------------------------------------------------------- +float32 implementation of `exp` and `log` now benefit from AVX2/AVX512 +instruction set which are detected during runtime. `exp` has a max ulp +error of 2.52 and `log` has a max ulp error or 3.83. + +Improve performance of `numpy.pad` +---------------------------------- +The performance of the function has been improved for most cases by filling in +a preallocated array with the desired padded shape instead of using +concatenation. + +`numpy.interp` handles infinities more robustly +----------------------------------------------- +In some cases where `interp` would previously return `nan`, it now +returns an appropriate infinity. + +Pathlib support for `fromfile`, `tofile` and `ndarray.dump` +----------------------------------------------------------- +`fromfile`, `ndarray.ndarray.tofile` and `ndarray.dump` now support +the `pathlib.Path` type for the ``file``/``fid`` parameter. + +Specialized `isnan`, `isinf`, and `isfinite` ufuncs for bool and int types +-------------------------------------------------------------------------- +The boolean and integer types are incapable of storing `nan` and `inf` values, +which allows us to provide specialized ufuncs that are up to 250x faster than +the previous approach. + +`isfinite` supports ``datetime64`` and ``timedelta64`` types +----------------------------------------------------------------- +Previously, `isfinite` used to raise a `TypeError` on being used on these +two types. + +New keywords added to `nan_to_num` +---------------------------------- +`nan_to_num` now accepts keywords ``nan``, ``posinf`` and ``neginf`` +allowing the user to define the value to replace the ``nan``, positive and +negative ``np.inf`` values respectively. + +MemoryErrors caused by allocated overly large arrays are more descriptive +------------------------------------------------------------------------- +Often the cause of a MemoryError is incorrect broadcasting, which results in a +very large and incorrect shape. The message of the error now includes this +shape to help diagnose the cause of failure. + +`floor`, `ceil`, and `trunc` now respect builtin magic methods +-------------------------------------------------------------- +These ufuncs now call the ``__floor__``, ``__ceil__``, and ``__trunc__`` +methods when called on object arrays, making them compatible with +`decimal.Decimal` and `fractions.Fraction` objects. + +`quantile` now works on `fraction.Fraction` and `decimal.Decimal` objects +------------------------------------------------------------------------- +In general, this handles object arrays more gracefully, and avoids floating- +point operations if exact arithmetic types are used. + +Support of object arrays in `matmul` +------------------------------------ +It is now possible to use `matmul` (or the ``@`` operator) with object arrays. +For instance, it is now possible to do:: + + from fractions import Fraction + a = np.array([[Fraction(1, 2), Fraction(1, 3)], [Fraction(1, 3), Fraction(1, 2)]]) + b = a @ a + + +Changes +======= + +`median` and `percentile` family of functions no longer warn about ``nan`` +-------------------------------------------------------------------------- +`numpy.median`, `numpy.percentile`, and `numpy.quantile` used to emit a +``RuntimeWarning`` when encountering an `nan`. Since they return the +``nan`` value, the warning is redundant and has been removed. + +``timedelta64 % 0`` behavior adjusted to return ``NaT`` +------------------------------------------------------- +The modulus operation with two ``np.timedelta64`` operands now returns +``NaT`` in the case of division by zero, rather than returning zero + +NumPy functions now always support overrides with ``__array_function__`` +------------------------------------------------------------------------ +NumPy now always checks the ``__array_function__`` method to implement overrides +of NumPy functions on non-NumPy arrays, as described in `NEP 18`_. The feature +was available for testing with NumPy 1.16 if appropriate environment variables +are set, but is now always enabled. + +.. _`NEP 18` : http://www.numpy.org/neps/nep-0018-array-function-protocol.html + +``lib.recfunctions.structured_to_unstructured`` does not squeeze single-field views +----------------------------------------------------------------------------------- +Previously ``structured_to_unstructured(arr[['a']])`` would produce a squeezed +result inconsistent with ``structured_to_unstructured(arr[['a', b']])``. This +was accidental. The old behavior can be retained with +``structured_to_unstructured(arr[['a']]).squeeze(axis=-1)`` or far more simply, +``arr['a']``. + +`clip` now uses a ufunc under the hood +-------------------------------------- +This means that registering clip functions for custom dtypes in C via +``descr->f->fastclip`` is deprecated - they should use the ufunc registration +mechanism instead, attaching to the ``np.core.umath.clip`` ufunc. + +It also means that ``clip`` accepts ``where`` and ``casting`` arguments, +and can be override with ``__array_ufunc__``. + +A consequence of this change is that some behaviors of the old ``clip`` have +been deprecated: + +* Passing ``nan`` to mean "do not clip" as one or both bounds. This didn't work + in all cases anyway, and can be better handled by passing infinities of the + appropriate sign. +* Using "unsafe" casting by default when an ``out`` argument is passed. Using + ``casting="unsafe"`` explicitly will silence this warning. + +Additionally, there are some corner cases with behavior changes: + +* Padding ``max < min`` has changed to be more consistent across dtypes, but + should not be relied upon. +* Scalar ``min`` and ``max`` take part in promotion rules like they do in all + other ufuncs. + +``__array_interface__`` offset now works as documented +------------------------------------------------------ +The interface may use an ``offset`` value that was mistakenly ignored. + +Pickle protocol in `savez` set to 3 for ``force zip64`` flag +----------------------------------------------------------------- +`savez` was not using the ``force_zip64`` flag, which limited the size of +the archive to 2GB. But using the flag requires us to use pickle protocol 3 to +write ``object`` arrays. The protocol used was bumped to 3, meaning the archive +will be unreadable by Python2. + +Structured arrays indexed with non-existent fields raise ``KeyError`` not ``ValueError`` +---------------------------------------------------------------------------------------- +``arr['bad_field']`` on a structured type raises ``KeyError``, for consistency +with ``dict['bad_field']``. + diff --git a/doc/release/template.rst b/doc/release/template.rst index db9458ac1..fdfec2be9 100644 --- a/doc/release/template.rst +++ b/doc/release/template.rst @@ -11,16 +11,16 @@ New functions ============= -New deprecations -================ +Deprecations +============ -Expired deprecations -==================== +Future Changes +============== -Future changes -============== +Expired deprecations +==================== Compatibility notes diff --git a/doc/source/_templates/indexcontent.html b/doc/source/_templates/indexcontent.html index 008eaaa7c..294d39233 100644 --- a/doc/source/_templates/indexcontent.html +++ b/doc/source/_templates/indexcontent.html @@ -7,6 +7,8 @@ start here

+