From 6d5345f81af29bc7653be95c4e08e4fd7b0f0d47 Mon Sep 17 00:00:00 2001 From: DongHun Kwak Date: Fri, 15 Jul 2022 11:14:44 +0900 Subject: [PATCH] Imported Upstream version 1.20.0 --- INSTALL.rst.txt | 20 +- LICENSE.txt | 10 - MANIFEST.in | 2 +- PKG-INFO | 10 +- README.md | 6 +- benchmarks/asv_compare.conf.json.tpl | 95 + benchmarks/benchmarks/bench_avx.py | 36 +- benchmarks/benchmarks/bench_core.py | 16 + benchmarks/benchmarks/bench_indexing.py | 30 + benchmarks/benchmarks/bench_linalg.py | 73 + benchmarks/benchmarks/bench_reduce.py | 9 + benchmarks/benchmarks/bench_scalar.py | 33 + benchmarks/benchmarks/bench_trim_zeros.py | 27 + benchmarks/benchmarks/common.py | 2 +- doc/C_STYLE_GUIDE.rst.txt | 212 +- doc/DISTUTILS.rst.txt | 62 +- doc/HOWTO_RELEASE.rst.txt | 30 +- doc/Makefile | 9 +- doc/RELEASE_WALKTHROUGH.rst.txt | 173 +- doc/TESTS.rst.txt | 27 +- doc/changelog/1.19.0-changelog.rst | 3 +- doc/changelog/1.20.0-changelog.rst | 881 +++++ doc/neps/_static/casting_flow.svg | 2212 ++++++++++++ doc/neps/_static/dtype_hierarchy.svg | 935 +++++ .../_static/nep-0041-type-sketch-no-fonts.svg | 1110 ++++++ doc/neps/_static/nep-0041-type-sketch.svg | 523 +++ doc/neps/_static/nep43-sketch-with-text.svg | 1304 +++++++ doc/neps/_static/nep43-sketch.svg | 3009 +++++++++++++++++ doc/neps/conf.py | 78 +- doc/neps/content.rst | 25 + doc/neps/index.rst.tmpl | 5 + doc/neps/nep-0000.rst | 10 +- doc/neps/nep-0001-npy-format.rst | 2 + doc/neps/nep-0002-warnfix.rst | 12 +- doc/neps/nep-0003-math_config_clean.rst | 2 + doc/neps/nep-0004-datetime-proposal3.rst | 2 + doc/neps/nep-0005-generalized-ufuncs.rst | 2 + doc/neps/nep-0006-newbugtracker.rst | 2 + doc/neps/nep-0007-datetime-proposal.rst | 2 + doc/neps/nep-0008-groupby_additions.rst | 2 + .../nep-0009-structured_array_extensions.rst | 2 + doc/neps/nep-0010-new-iterator-ufunc.rst | 50 +- .../nep-0011-deferred-ufunc-evaluation.rst | 10 +- doc/neps/nep-0012-missing-data.rst | 58 +- doc/neps/nep-0013-ufunc-overrides.rst | 4 +- .../nep-0014-dropping-python2.7-proposal.rst | 2 + doc/neps/nep-0015-merge-multiarray-umath.rst | 2 + doc/neps/nep-0016-abstract-array.rst | 2 + doc/neps/nep-0017-split-out-maskedarray.rst | 2 + doc/neps/nep-0018-array-function-protocol.rst | 4 +- doc/neps/nep-0019-rng-policy.rst | 2 + .../nep-0020-gufunc-signature-enhancement.rst | 2 + doc/neps/nep-0021-advanced-indexing.rst | 2 + .../nep-0022-ndarray-duck-typing-overview.rst | 4 +- doc/neps/nep-0023-backwards-compatibility.rst | 2 + doc/neps/nep-0024-missing-data-2.rst | 2 + doc/neps/nep-0025-missing-data-3.rst | 6 + doc/neps/nep-0026-missing-data-summary.rst | 20 +- doc/neps/nep-0027-zero-rank-arrarys.rst | 2 + doc/neps/nep-0028-website-redesign.rst | 2 + doc/neps/nep-0029-deprecation_policy.rst | 28 +- doc/neps/nep-0030-duck-array-protocol.rst | 2 + doc/neps/nep-0031-uarray.rst | 2 + .../nep-0032-remove-financial-functions.rst | 2 + doc/neps/nep-0034-infer-dtype-is-object.rst | 2 + ...-creation-dispatch-with-array-function.rst | 397 ++- doc/neps/nep-0036-fair-play.rst | 177 + doc/neps/nep-0037-array-module.rst | 2 + doc/neps/nep-0038-SIMD-optimizations.rst | 2 + doc/neps/nep-0040-legacy-datatype-impl.rst | 30 +- doc/neps/nep-0041-improved-dtype-support.rst | 152 +- doc/neps/nep-0042-new-dtypes.rst | 1417 ++++++++ doc/neps/nep-0043-extensible-ufuncs.rst | 1309 +++++++ .../nep-0044-restructuring-numpy-docs.rst | 2 + doc/neps/nep-0045-c_style_guide.rst | 266 ++ doc/neps/roadmap.rst | 105 +- doc/neps/tools/build_index.py | 5 +- doc/release/upcoming_changes/README.rst | 8 +- doc/source/_static/numpy.css | 40 + doc/source/_static/numpy_logo.png | Bin 6103 -> 0 bytes doc/source/_static/numpylogo.svg | 23 + .../_templates/autosummary/attribute.rst | 5 +- doc/source/_templates/autosummary/base.rst | 5 +- doc/source/_templates/autosummary/member.rst | 6 +- doc/source/_templates/autosummary/method.rst | 5 +- doc/source/_templates/defindex.html | 35 - doc/source/_templates/indexcontent.html | 40 +- doc/source/_templates/layout.html | 30 +- doc/source/about.rst | 62 - doc/source/conf.py | 159 +- doc/source/contents.rst | 25 +- doc/source/dev/conduct/code_of_conduct.rst | 163 - .../dev/conduct/report_handling_manual.rst | 220 -- doc/source/dev/development_environment.rst | 2 +- doc/source/dev/development_workflow.rst | 45 +- doc/source/dev/gitwash/development_setup.rst | 231 +- doc/source/dev/gitwash/forked_page.png | Bin 0 -> 3345 bytes doc/source/dev/gitwash/forking_button.png | Bin 13092 -> 8066 bytes doc/source/dev/gitwash/forking_message.png | Bin 0 -> 14880 bytes doc/source/dev/gitwash/git_links.inc | 18 +- doc/source/dev/governance/governance.rst | 3 +- doc/source/dev/governance/people.rst | 23 +- doc/source/dev/howto-docs.rst | 265 +- doc/source/dev/index.rst | 39 +- doc/source/dev/reviewer_guidelines.rst | 119 + doc/source/dev/style_guide.rst | 8 - doc/source/doc_conventions.rst | 23 + doc/source/docs/howto_document.rst | 66 +- doc/source/f2py/allocarr_session.dat | 9 +- doc/source/f2py/common_session.dat | 6 +- doc/source/f2py/distutils.rst | 2 + doc/source/f2py/moddata_session.dat | 14 +- doc/source/f2py/python-usage.rst | 2 +- doc/source/glossary.rst | 518 ++- doc/source/license.rst | 35 +- doc/source/reference/arrays.classes.rst | 15 +- doc/source/reference/arrays.datetime.rst | 2 +- doc/source/reference/arrays.dtypes.rst | 55 +- doc/source/reference/arrays.indexing.rst | 21 +- doc/source/reference/arrays.interface.rst | 115 +- doc/source/reference/arrays.ndarray.rst | 20 +- doc/source/reference/arrays.nditer.cython.rst | 2 +- doc/source/reference/arrays.nditer.rst | 8 + doc/source/reference/arrays.rst | 2 +- doc/source/reference/arrays.scalars.rst | 374 +- doc/source/reference/c-api/array.rst | 426 +-- doc/source/reference/c-api/config.rst | 79 +- doc/source/reference/c-api/coremath.rst | 46 +- doc/source/reference/c-api/deprecations.rst | 4 +- doc/source/reference/c-api/dtype.rst | 45 +- doc/source/reference/c-api/iterator.rst | 60 +- .../reference/c-api/types-and-structures.rst | 586 ++-- doc/source/reference/c-api/ufunc.rst | 169 +- doc/source/reference/distutils.rst | 1 + doc/source/reference/figures/opt-infra.odg | Bin 0 -> 13809 bytes doc/source/reference/figures/opt-infra.png | Bin 0 -> 54081 bytes doc/source/reference/global_state.rst | 19 +- doc/source/reference/index.rst | 2 + .../reference/internals.code-explanations.rst | 7 +- doc/source/reference/internals.rst | 158 +- .../reference/maskedarray.baseclass.rst | 4 +- doc/source/reference/maskedarray.generic.rst | 18 +- doc/source/reference/random/c-api.rst | 23 +- doc/source/reference/random/generator.rst | 94 + doc/source/reference/random/index.rst | 76 +- .../reference/random/new-or-different.rst | 4 +- .../reference/routines.array-manipulation.rst | 1 + doc/source/reference/routines.char.rst | 2 +- doc/source/reference/routines.ctypeslib.rst | 1 - doc/source/reference/routines.dual.rst | 2 +- doc/source/reference/routines.financial.rst | 21 - doc/source/reference/routines.indexing.rst | 1 + doc/source/reference/routines.io.rst | 4 +- doc/source/reference/routines.ma.rst | 5 +- doc/source/reference/routines.other.rst | 1 + .../routines.polynomials.classes.rst | 21 +- .../routines.polynomials.package.rst | 8 + doc/source/reference/routines.rst | 1 - doc/source/reference/routines.set.rst | 5 + .../simd/simd-optimizations-tables-diff.inc | 37 + .../simd/simd-optimizations-tables.inc | 103 + .../reference/simd/simd-optimizations.py | 190 ++ .../reference/simd/simd-optimizations.rst | 527 +++ doc/source/reference/typing.rst | 2 + doc/source/reference/ufuncs.rst | 24 +- doc/source/release.rst | 1 + doc/source/release/1.16.0-notes.rst | 4 +- doc/source/release/1.17.0-notes.rst | 7 +- doc/source/release/1.20.0-notes.rst | 1002 ++++++ doc/source/release/1.5.0-notes.rst | 4 +- doc/source/user/absolute_beginners.rst | 25 +- doc/source/user/basics.broadcasting.rst | 176 +- doc/source/user/basics.byteswapping.rst | 150 +- doc/source/user/basics.creation.rst | 139 +- doc/source/user/basics.dispatch.rst | 266 +- doc/source/user/basics.indexing.rst | 452 ++- doc/source/user/basics.io.genfromtxt.rst | 26 +- doc/source/user/basics.rec.rst | 646 +++- doc/source/user/basics.subclassing.rst | 749 +++- doc/source/user/basics.types.rst | 339 +- doc/source/user/building.rst | 43 +- doc/source/user/c-info.beyond-basics.rst | 2 +- doc/source/user/c-info.how-to-extend.rst | 10 - doc/source/user/c-info.python-as-glue.rst | 51 +- doc/source/user/how-to-how-to.rst | 118 + doc/source/user/how-to-io.rst | 328 ++ doc/source/user/howtos_index.rst | 3 +- doc/source/user/index.rst | 31 +- doc/source/user/install.rst | 17 +- doc/source/user/ionumpy.rst | 20 - doc/source/user/misc.rst | 222 +- doc/source/user/numpy-for-matlab-users.rst | 765 +++-- doc/source/user/quickstart.rst | 26 +- doc/source/user/setting-up.rst | 10 - .../user/troubleshooting-importerror.rst | 10 +- doc/source/user/tutorial-ma.rst | 386 +++ doc/source/user/tutorial-svd.rst | 33 +- doc/source/user/tutorials_index.rst | 7 +- doc/source/user/whatisnumpy.rst | 2 +- .../user/who_covid_19_sit_rep_time_series.csv | 115 + doc_requirements.txt | 3 + numpy/__init__.cython-30.pxd | 27 +- numpy/__init__.pxd | 123 +- numpy/__init__.py | 167 +- numpy/__init__.pyi | 2254 ++++++++++++ numpy/_build_utils/README | 8 - numpy/_build_utils/apple_accelerate.py | 26 - numpy/_build_utils/src/apple_sgemv_fix.c | 253 -- numpy/_pytesttester.py | 29 +- numpy/char.pyi | 53 + numpy/compat/py3k.py | 62 +- numpy/conftest.py | 30 +- numpy/core/__init__.py | 19 +- .../__init__.py => core/__init__.pyi} | 0 numpy/core/_add_newdocs.py | 1106 ++---- numpy/core/_add_newdocs_scalars.py | 251 ++ numpy/core/_asarray.py | 113 +- numpy/core/_asarray.pyi | 77 + numpy/core/_dtype.py | 12 +- numpy/core/_internal.py | 43 +- numpy/core/_internal.pyi | 18 + numpy/core/_methods.py | 86 +- numpy/core/_type_aliases.py | 59 +- numpy/core/_type_aliases.pyi | 19 + numpy/core/_ufunc_config.pyi | 43 + numpy/core/arrayprint.py | 38 +- numpy/core/code_generators/cversions.txt | 5 + numpy/core/code_generators/genapi.py | 24 +- .../code_generators/generate_numpy_api.py | 4 +- numpy/core/code_generators/generate_umath.py | 65 +- numpy/core/code_generators/numpy_api.py | 4 +- .../core/code_generators/ufunc_docstrings.py | 232 +- numpy/core/defchararray.py | 24 +- numpy/core/einsumfunc.py | 22 +- numpy/core/fromnumeric.py | 233 +- numpy/core/fromnumeric.pyi | 483 +++ numpy/core/function_base.py | 42 +- numpy/core/function_base.pyi | 56 + numpy/core/getlimits.py | 29 +- numpy/core/include/numpy/arrayscalars.h | 5 +- numpy/core/include/numpy/ndarraytypes.h | 140 +- .../include/numpy/npy_1_7_deprecated_api.h | 3 +- numpy/core/include/numpy/npy_3kcompat.h | 31 +- numpy/core/include/numpy/npy_common.h | 30 +- numpy/core/include/numpy/npy_cpu.h | 3 - numpy/core/include/numpy/npy_math.h | 6 +- numpy/core/include/numpy/numpyconfig.h | 1 + numpy/core/include/numpy/utils.h | 34 +- numpy/core/machar.py | 4 +- numpy/core/memmap.py | 11 +- numpy/core/multiarray.py | 25 +- numpy/core/numeric.py | 92 +- numpy/core/numeric.pyi | 189 ++ numpy/core/numerictypes.py | 44 +- numpy/core/numerictypes.pyi | 29 + numpy/core/overrides.py | 25 +- numpy/core/records.py | 116 +- numpy/core/setup.py | 108 +- numpy/core/setup_common.py | 21 +- numpy/core/shape_base.py | 3 +- numpy/core/shape_base.pyi | 41 + numpy/core/src/_simd/_simd.c | 73 + numpy/core/src/_simd/_simd.dispatch.c.src | 583 ++++ numpy/core/src/_simd/_simd.h | 30 + numpy/core/src/_simd/_simd_arg.inc | 85 + numpy/core/src/_simd/_simd_convert.inc | 210 ++ numpy/core/src/_simd/_simd_data.inc.src | 93 + numpy/core/src/_simd/_simd_easyintrin.inc | 214 ++ numpy/core/src/_simd/_simd_inc.h.src | 421 +++ numpy/core/src/_simd/_simd_vector.inc | 178 + numpy/core/src/common/array_assign.c | 28 +- .../core/src/common/lowlevel_strided_loops.h | 37 +- numpy/core/src/common/npy_binsearch.h.src | 8 +- numpy/core/src/common/npy_config.h | 12 +- numpy/core/src/common/npy_cpu_dispatch.h | 265 ++ numpy/core/src/common/npy_cpu_features.c.src | 266 +- numpy/core/src/common/npy_cpu_features.h | 58 +- numpy/core/src/common/npy_cpuinfo_parser.h | 262 ++ numpy/core/src/common/npy_import.h | 2 +- numpy/core/src/common/npy_partition.h.src | 4 +- numpy/core/src/common/npy_sort.h.src | 52 +- numpy/core/src/common/simd/avx2/arithmetic.h | 142 + numpy/core/src/common/simd/avx2/avx2.h | 70 + numpy/core/src/common/simd/avx2/conversion.h | 32 + numpy/core/src/common/simd/avx2/math.h | 40 + numpy/core/src/common/simd/avx2/memory.h | 356 ++ numpy/core/src/common/simd/avx2/misc.h | 223 ++ numpy/core/src/common/simd/avx2/operators.h | 200 ++ numpy/core/src/common/simd/avx2/reorder.h | 97 + numpy/core/src/common/simd/avx2/utils.h | 21 + .../core/src/common/simd/avx512/arithmetic.h | 175 + numpy/core/src/common/simd/avx512/avx512.h | 75 + .../core/src/common/simd/avx512/conversion.h | 138 + numpy/core/src/common/simd/avx512/math.h | 49 + numpy/core/src/common/simd/avx512/memory.h | 332 ++ numpy/core/src/common/simd/avx512/misc.h | 252 ++ numpy/core/src/common/simd/avx512/operators.h | 324 ++ numpy/core/src/common/simd/avx512/reorder.h | 170 + numpy/core/src/common/simd/avx512/utils.h | 70 + numpy/core/src/common/simd/neon/arithmetic.h | 146 + numpy/core/src/common/simd/neon/conversion.h | 32 + numpy/core/src/common/simd/neon/math.h | 86 + numpy/core/src/common/simd/neon/memory.h | 336 ++ numpy/core/src/common/simd/neon/misc.h | 255 ++ numpy/core/src/common/simd/neon/neon.h | 75 + numpy/core/src/common/simd/neon/operators.h | 218 ++ numpy/core/src/common/simd/neon/reorder.h | 110 + numpy/core/src/common/simd/simd.h | 105 + numpy/core/src/common/simd/simd_utils.h | 48 + numpy/core/src/common/simd/sse/arithmetic.h | 177 + numpy/core/src/common/simd/sse/conversion.h | 32 + numpy/core/src/common/simd/sse/math.h | 40 + numpy/core/src/common/simd/sse/memory.h | 498 +++ numpy/core/src/common/simd/sse/misc.h | 230 ++ numpy/core/src/common/simd/sse/operators.h | 258 ++ numpy/core/src/common/simd/sse/reorder.h | 84 + numpy/core/src/common/simd/sse/sse.h | 67 + numpy/core/src/common/simd/vsx/arithmetic.h | 131 + numpy/core/src/common/simd/vsx/conversion.h | 32 + numpy/core/src/common/simd/vsx/math.h | 36 + numpy/core/src/common/simd/vsx/memory.h | 346 ++ numpy/core/src/common/simd/vsx/misc.h | 190 ++ numpy/core/src/common/simd/vsx/operators.h | 216 ++ numpy/core/src/common/simd/vsx/reorder.h | 65 + numpy/core/src/common/simd/vsx/vsx.h | 65 + numpy/core/src/multiarray/_datetime.h | 17 +- .../src/multiarray/_multiarray_tests.c.src | 272 +- numpy/core/src/multiarray/abstractdtypes.c | 168 + numpy/core/src/multiarray/abstractdtypes.h | 19 + numpy/core/src/multiarray/alloc.c | 5 - .../core/src/multiarray/array_assign_array.c | 15 +- .../core/src/multiarray/array_assign_scalar.c | 15 +- numpy/core/src/multiarray/array_coercion.c | 1510 +++++++++ numpy/core/src/multiarray/array_coercion.h | 58 + numpy/core/src/multiarray/array_method.c | 614 ++++ numpy/core/src/multiarray/array_method.h | 150 + .../src/multiarray/arrayfunction_override.c | 187 +- .../src/multiarray/arrayfunction_override.h | 4 + numpy/core/src/multiarray/arrayobject.c | 188 +- numpy/core/src/multiarray/arraytypes.c.src | 67 +- numpy/core/src/multiarray/buffer.c | 482 ++- numpy/core/src/multiarray/calculation.c | 4 +- numpy/core/src/multiarray/common.c | 500 +-- numpy/core/src/multiarray/common.h | 24 +- numpy/core/src/multiarray/compiled_base.c | 116 +- numpy/core/src/multiarray/conversion_utils.c | 64 +- numpy/core/src/multiarray/convert.c | 9 +- numpy/core/src/multiarray/convert_datatype.c | 2602 ++++++++------ numpy/core/src/multiarray/convert_datatype.h | 69 +- numpy/core/src/multiarray/ctors.c | 1431 ++++---- numpy/core/src/multiarray/ctors.h | 13 +- numpy/core/src/multiarray/datetime.c | 841 +++-- numpy/core/src/multiarray/datetime_busday.c | 21 +- .../core/src/multiarray/datetime_busdaycal.c | 30 +- numpy/core/src/multiarray/datetime_strings.c | 43 +- numpy/core/src/multiarray/descriptor.c | 211 +- numpy/core/src/multiarray/dragon4.c | 4 +- numpy/core/src/multiarray/dtype_transfer.c | 791 +++-- numpy/core/src/multiarray/dtypemeta.c | 684 ++++ numpy/core/src/multiarray/dtypemeta.h | 25 + numpy/core/src/multiarray/einsum.c.src | 1760 +--------- numpy/core/src/multiarray/einsum_debug.h | 28 + .../core/src/multiarray/einsum_sumprod.c.src | 1897 +++++++++++ numpy/core/src/multiarray/einsum_sumprod.h | 12 + numpy/core/src/multiarray/flagsobject.c | 4 +- numpy/core/src/multiarray/getset.c | 46 +- numpy/core/src/multiarray/hashdescr.c | 6 +- numpy/core/src/multiarray/item_selection.c | 4 +- numpy/core/src/multiarray/iterators.c | 17 +- .../multiarray/legacy_dtype_implementation.c | 716 ++++ .../multiarray/legacy_dtype_implementation.h | 40 + .../multiarray/lowlevel_strided_loops.c.src | 173 +- numpy/core/src/multiarray/mapping.c | 214 +- numpy/core/src/multiarray/methods.c | 189 +- numpy/core/src/multiarray/multiarraymodule.c | 560 +-- numpy/core/src/multiarray/multiarraymodule.h | 2 + numpy/core/src/multiarray/nditer_api.c | 198 +- numpy/core/src/multiarray/nditer_constr.c | 694 ++-- numpy/core/src/multiarray/nditer_impl.h | 44 +- numpy/core/src/multiarray/nditer_pywrap.c | 48 +- numpy/core/src/multiarray/nditer_templ.c.src | 20 +- numpy/core/src/multiarray/npy_buffer.h | 6 +- numpy/core/src/multiarray/number.c | 19 +- numpy/core/src/multiarray/refcount.c | 38 +- numpy/core/src/multiarray/scalarapi.c | 124 +- numpy/core/src/multiarray/scalartypes.c.src | 483 ++- numpy/core/src/multiarray/sequence.c | 17 +- numpy/core/src/multiarray/shape.c | 65 +- numpy/core/src/multiarray/shape.h | 7 - numpy/core/src/multiarray/strfuncs.c | 186 +- numpy/core/src/multiarray/temp_elide.c | 4 - numpy/core/src/multiarray/usertypes.c | 226 +- numpy/core/src/multiarray/usertypes.h | 10 + .../core/src/npymath/npy_math_internal.h.src | 102 +- numpy/core/src/npymath/npy_math_private.h | 1 - numpy/core/src/npysort/binsearch.c.src | 8 +- numpy/core/src/npysort/heapsort.c.src | 12 +- numpy/core/src/npysort/mergesort.c.src | 12 +- numpy/core/src/npysort/quicksort.c.src | 12 +- numpy/core/src/npysort/radixsort.c.src | 8 +- numpy/core/src/npysort/selection.c.src | 5 +- numpy/core/src/npysort/timsort.c.src | 16 +- numpy/core/src/umath/_rational_tests.c.src | 39 +- numpy/core/src/umath/_umath_tests.c.src | 67 +- numpy/core/src/umath/_umath_tests.dispatch.c | 33 + numpy/core/src/umath/extobj.c | 8 +- numpy/core/src/umath/funcs.inc.src | 4 +- numpy/core/src/umath/loops.c.src | 211 +- numpy/core/src/umath/loops.h.src | 50 +- .../src/umath/loops_unary_fp.dispatch.c.src | 219 ++ numpy/core/src/umath/loops_utils.h | 42 + numpy/core/src/umath/matmul.c.src | 2 +- numpy/core/src/umath/npy_simd_data.h | 154 + numpy/core/src/umath/override.c | 2 +- numpy/core/src/umath/reduction.c | 517 +-- numpy/core/src/umath/reduction.h | 5 +- numpy/core/src/umath/scalarmath.c.src | 194 +- numpy/core/src/umath/simd.inc.src | 842 ++++- numpy/core/src/umath/ufunc_object.c | 194 +- numpy/core/src/umath/ufunc_type_resolution.c | 60 +- numpy/core/src/umath/umathmodule.c | 74 +- .../core/tests/data/umath-validation-set-log | 153 + numpy/core/tests/examples/checks.pyx | 30 + numpy/core/tests/examples/setup.py | 25 + numpy/core/tests/test_api.py | 24 +- numpy/core/tests/test_array_coercion.py | 733 ++++ numpy/core/tests/test_arrayprint.py | 75 + numpy/core/tests/test_casting_unittests.py | 301 ++ numpy/core/tests/test_conversion_utils.py | 61 +- numpy/core/tests/test_cpu_dispatcher.py | 42 + numpy/core/tests/test_cython.py | 134 + numpy/core/tests/test_datetime.py | 46 +- numpy/core/tests/test_defchararray.py | 6 + numpy/core/tests/test_deprecations.py | 293 +- numpy/core/tests/test_dtype.py | 121 + numpy/core/tests/test_einsum.py | 39 + numpy/core/tests/test_function_base.py | 41 +- numpy/core/tests/test_half.py | 15 + numpy/core/tests/test_indexing.py | 79 +- numpy/core/tests/test_memmap.py | 7 +- numpy/core/tests/test_multiarray.py | 463 ++- numpy/core/tests/test_nditer.py | 80 + numpy/core/tests/test_numeric.py | 243 +- numpy/core/tests/test_overrides.py | 154 + numpy/core/tests/test_records.py | 18 +- numpy/core/tests/test_regression.py | 41 +- numpy/core/tests/test_scalar_ctors.py | 36 +- numpy/core/tests/test_scalarbuffer.py | 45 +- numpy/core/tests/test_scalarinherit.py | 16 +- numpy/core/tests/test_scalarmath.py | 7 + numpy/core/tests/test_shape_base.py | 80 +- numpy/core/tests/test_simd.py | 638 ++++ numpy/core/tests/test_simd_module.py | 97 + numpy/core/tests/test_ufunc.py | 160 +- numpy/core/tests/test_umath.py | 250 +- numpy/core/tests/test_umath_complex.py | 36 +- numpy/ctypeslib.py | 16 +- numpy/ctypeslib.pyi | 7 + numpy/distutils/__init__.pyi | 4 + numpy/distutils/ccompiler.py | 8 - numpy/distutils/ccompiler_opt.py | 2535 ++++++++++++++ numpy/distutils/checks/cpu_asimd.c | 25 + numpy/distutils/checks/cpu_asimddp.c | 15 + numpy/distutils/checks/cpu_asimdfhm.c | 17 + numpy/distutils/checks/cpu_asimdhp.c | 14 + numpy/distutils/checks/cpu_avx.c | 7 + numpy/distutils/checks/cpu_avx2.c | 7 + numpy/distutils/checks/cpu_avx512_clx.c | 8 + numpy/distutils/checks/cpu_avx512_cnl.c | 10 + numpy/distutils/checks/cpu_avx512_icl.c | 12 + numpy/distutils/checks/cpu_avx512_knl.c | 11 + numpy/distutils/checks/cpu_avx512_knm.c | 17 + numpy/distutils/checks/cpu_avx512_skx.c | 12 + numpy/distutils/checks/cpu_avx512cd.c | 7 + numpy/distutils/checks/cpu_avx512f.c | 7 + numpy/distutils/checks/cpu_f16c.c | 9 + numpy/distutils/checks/cpu_fma3.c | 8 + numpy/distutils/checks/cpu_fma4.c | 12 + numpy/distutils/checks/cpu_neon.c | 15 + numpy/distutils/checks/cpu_neon_fp16.c | 11 + numpy/distutils/checks/cpu_neon_vfpv4.c | 19 + numpy/distutils/checks/cpu_popcnt.c | 23 + numpy/distutils/checks/cpu_sse.c | 7 + numpy/distutils/checks/cpu_sse2.c | 7 + numpy/distutils/checks/cpu_sse3.c | 7 + numpy/distutils/checks/cpu_sse41.c | 7 + numpy/distutils/checks/cpu_sse42.c | 7 + numpy/distutils/checks/cpu_ssse3.c | 7 + numpy/distutils/checks/cpu_vsx.c | 21 + numpy/distutils/checks/cpu_vsx2.c | 13 + numpy/distutils/checks/cpu_vsx3.c | 13 + numpy/distutils/checks/cpu_xop.c | 12 + numpy/distutils/checks/extra_avx512bw_mask.c | 18 + numpy/distutils/checks/extra_avx512dq_mask.c | 16 + numpy/distutils/checks/extra_avx512f_reduce.c | 41 + numpy/distutils/checks/test_flags.c | 1 + numpy/distutils/command/build.py | 21 + numpy/distutils/command/build_clib.py | 87 +- numpy/distutils/command/build_ext.py | 94 +- numpy/distutils/fcompiler/__init__.py | 61 +- numpy/distutils/fcompiler/environment.py | 5 +- numpy/distutils/fcompiler/fujitsu.py | 46 + numpy/distutils/fcompiler/gnu.py | 17 +- numpy/distutils/fcompiler/pg.py | 2 +- numpy/distutils/mingw32ccompiler.py | 24 +- numpy/distutils/misc_util.py | 26 +- numpy/distutils/setup.py | 2 + numpy/distutils/system_info.py | 187 +- numpy/distutils/tests/test_ccompiler_opt.py | 787 +++++ .../tests/test_ccompiler_opt_conf.py | 176 + numpy/distutils/tests/test_system_info.py | 35 +- numpy/distutils/unixccompiler.py | 10 +- numpy/doc/basics.py | 341 -- numpy/doc/broadcasting.py | 180 - numpy/doc/byteswapping.py | 155 - numpy/doc/constants.py | 4 - numpy/doc/creation.py | 143 - numpy/doc/dispatch.py | 271 -- numpy/doc/glossary.py | 475 --- numpy/doc/indexing.py | 456 --- numpy/doc/internals.py | 162 - numpy/doc/misc.py | 226 -- numpy/doc/structured_arrays.py | 646 ---- numpy/doc/subclassing.py | 752 ---- numpy/dual.py | 22 +- numpy/emath.pyi | 11 + numpy/f2py/__init__.py | 71 +- numpy/f2py/__init__.pyi | 5 + numpy/f2py/cb_rules.py | 339 +- numpy/f2py/cfuncs.py | 299 +- numpy/f2py/crackfortran.py | 54 +- numpy/f2py/f2py2e.py | 6 +- numpy/f2py/rules.py | 93 +- numpy/f2py/setup.py | 1 + numpy/f2py/src/fortranobject.c | 69 +- numpy/f2py/src/fortranobject.h | 3 + numpy/f2py/src/test/foomodule.c | 2 +- .../tests/src/array_from_pyobj/wrapmodule.c | 29 +- numpy/f2py/tests/src/module_data/mod.mod | Bin 0 -> 412 bytes .../src/module_data/module_data_docstring.f90 | 12 + numpy/f2py/tests/test_block_docstring.py | 2 +- numpy/f2py/tests/test_callback.py | 50 + numpy/f2py/tests/test_module_doc.py | 30 + numpy/f2py/tests/test_regression.py | 22 +- numpy/f2py/tests/util.py | 2 - numpy/fft/__init__.py | 19 +- numpy/fft/__init__.pyi | 20 + numpy/fft/_pocketfft.py | 277 +- numpy/fft/helper.py | 3 +- numpy/fft/setup.py | 1 + numpy/fft/tests/test_helper.py | 5 +- numpy/fft/tests/test_pocketfft.py | 82 +- numpy/lib/__init__.py | 2 - numpy/lib/__init__.pyi | 177 + numpy/lib/_datasource.py | 10 +- numpy/lib/_iotools.py | 9 +- numpy/lib/arraypad.py | 31 +- numpy/lib/arraysetops.py | 47 +- numpy/lib/financial.py | 967 ------ numpy/lib/format.py | 38 +- numpy/lib/function_base.py | 336 +- numpy/lib/index_tricks.py | 51 +- numpy/lib/mixins.py | 2 +- numpy/lib/nanfunctions.py | 18 +- numpy/lib/npyio.py | 320 +- numpy/lib/polynomial.py | 87 +- numpy/lib/recfunctions.py | 6 +- numpy/lib/scimath.py | 16 + numpy/lib/setup.py | 1 + numpy/lib/shape_base.py | 12 +- numpy/lib/stride_tricks.py | 286 +- numpy/lib/tests/test_arraysetops.py | 18 +- numpy/lib/tests/test_financial.py | 380 --- numpy/lib/tests/test_financial_expired.py | 13 + numpy/lib/tests/test_format.py | 138 +- numpy/lib/tests/test_function_base.py | 207 +- numpy/lib/tests/test_index_tricks.py | 27 + numpy/lib/tests/test_io.py | 83 +- numpy/lib/tests/test_nanfunctions.py | 2 +- numpy/lib/tests/test_polynomial.py | 23 + numpy/lib/tests/test_stride_tricks.py | 172 +- numpy/lib/tests/test_utils.py | 19 + numpy/lib/twodim_base.py | 39 +- numpy/lib/utils.py | 50 +- numpy/linalg/__init__.pyi | 23 + numpy/linalg/lapack_lite/make_lite.py | 18 +- numpy/linalg/linalg.py | 25 +- numpy/linalg/setup.py | 9 +- numpy/linalg/tests/test_build.py | 4 +- numpy/linalg/tests/test_linalg.py | 6 +- numpy/linalg/umath_linalg.c.src | 2 +- numpy/ma/__init__.pyi | 225 ++ numpy/ma/bench.py | 10 +- numpy/ma/core.py | 54 +- numpy/ma/extras.py | 21 +- numpy/ma/mrecords.py | 18 +- numpy/ma/setup.py | 1 + numpy/ma/tests/test_core.py | 79 +- numpy/ma/tests/test_old_ma.py | 2 +- numpy/ma/tests/test_subclassing.py | 8 +- numpy/ma/testutils.py | 10 +- numpy/ma/timer_comparison.py | 22 +- numpy/matrixlib/__init__.pyi | 6 + numpy/matrixlib/defmatrix.py | 6 +- numpy/matrixlib/setup.py | 1 + numpy/matrixlib/tests/test_masked_matrix.py | 4 +- numpy/polynomial/__init__.py | 151 + numpy/polynomial/__init__.pyi | 9 + numpy/polynomial/_polybase.py | 135 +- numpy/polynomial/chebyshev.py | 35 +- numpy/polynomial/hermite.py | 29 +- numpy/polynomial/hermite_e.py | 31 +- numpy/polynomial/laguerre.py | 36 +- numpy/polynomial/legendre.py | 29 +- numpy/polynomial/polynomial.py | 38 +- numpy/polynomial/polyutils.py | 4 +- numpy/polynomial/setup.py | 1 + numpy/polynomial/tests/test_printing.py | 315 +- numpy/py.typed | 0 numpy/random/__init__.pyi | 61 + numpy/random/_common.pyx | 2 +- numpy/random/_examples/numba/extending.py | 4 +- numpy/random/_generator.pyx | 409 ++- numpy/random/bit_generator.pxd | 2 +- numpy/random/bit_generator.pyx | 2 +- numpy/random/mtrand.pyx | 37 +- numpy/random/setup.py | 1 + .../random/src/distributions/distributions.c | 22 +- numpy/random/tests/test_direct.py | 4 +- numpy/random/tests/test_extending.py | 1 - numpy/random/tests/test_generator_mt19937.py | 115 +- .../test_generator_mt19937_regressions.py | 4 +- numpy/random/tests/test_random.py | 24 +- numpy/random/tests/test_randomstate.py | 70 +- .../tests/test_randomstate_regression.py | 4 +- numpy/random/tests/test_regression.py | 4 +- numpy/random/tests/test_smoke.py | 9 +- numpy/rec.pyi | 5 + numpy/setup.py | 3 + numpy/testing/__init__.pyi | 44 + numpy/testing/_private/decorators.py | 2 +- numpy/testing/_private/noseclasses.py | 4 +- numpy/testing/_private/nosetester.py | 20 +- numpy/testing/_private/parameterized.py | 2 +- numpy/testing/_private/utils.py | 112 +- numpy/testing/print_coercion_tables.py | 110 +- numpy/testing/setup.py | 1 + numpy/testing/tests/test_utils.py | 2 +- numpy/tests/test_public_api.py | 63 +- numpy/typing/__init__.py | 232 ++ numpy/typing/_add_docstring.py | 96 + numpy/typing/_array_like.py | 40 + numpy/typing/_callable.py | 336 ++ numpy/typing/_dtype_like.py | 81 + numpy/typing/_scalars.py | 26 + numpy/typing/_shape.py | 6 + numpy/typing/setup.py | 11 + numpy/typing/tests/__init__.py | 0 numpy/typing/tests/data/fail/arithmetic.py | 16 + .../tests/data/fail/array_constructors.py | 31 + numpy/typing/tests/data/fail/array_like.py | 16 + numpy/typing/tests/data/fail/bitwise_ops.py | 20 + numpy/typing/tests/data/fail/constants.py | 6 + numpy/typing/tests/data/fail/dtype.py | 16 + numpy/typing/tests/data/fail/flatiter.py | 25 + numpy/typing/tests/data/fail/fromnumeric.py | 154 + numpy/typing/tests/data/fail/modules.py | 10 + numpy/typing/tests/data/fail/ndarray.py | 11 + numpy/typing/tests/data/fail/ndarray_misc.py | 21 + numpy/typing/tests/data/fail/numerictypes.py | 13 + numpy/typing/tests/data/fail/scalars.py | 76 + numpy/typing/tests/data/fail/ufunc_config.py | 21 + numpy/typing/tests/data/fail/ufuncs.py | 7 + .../tests/data/fail/warnings_and_errors.py | 7 + numpy/typing/tests/data/mypy.ini | 8 + numpy/typing/tests/data/pass/arithmetic.py | 293 ++ .../tests/data/pass/array_constructors.py | 128 + numpy/typing/tests/data/pass/array_like.py | 39 + numpy/typing/tests/data/pass/bitwise_ops.py | 131 + numpy/typing/tests/data/pass/dtype.py | 35 + numpy/typing/tests/data/pass/flatiter.py | 14 + numpy/typing/tests/data/pass/fromnumeric.py | 260 ++ numpy/typing/tests/data/pass/literal.py | 45 + numpy/typing/tests/data/pass/mod.py | 149 + .../tests/data/pass/ndarray_conversion.py | 94 + numpy/typing/tests/data/pass/ndarray_misc.py | 159 + .../data/pass/ndarray_shape_manipulation.py | 47 + numpy/typing/tests/data/pass/numeric.py | 89 + numpy/typing/tests/data/pass/numerictypes.py | 29 + numpy/typing/tests/data/pass/scalars.py | 165 + numpy/typing/tests/data/pass/simple.py | 165 + numpy/typing/tests/data/pass/simple_py3.py | 6 + numpy/typing/tests/data/pass/ufunc_config.py | 50 + numpy/typing/tests/data/pass/ufuncs.py | 16 + .../tests/data/pass/warnings_and_errors.py | 7 + numpy/typing/tests/data/reveal/arithmetic.py | 291 ++ .../tests/data/reveal/array_constructors.py | 102 + numpy/typing/tests/data/reveal/bitwise_ops.py | 131 + numpy/typing/tests/data/reveal/constants.py | 52 + numpy/typing/tests/data/reveal/dtype.py | 33 + numpy/typing/tests/data/reveal/flatiter.py | 14 + numpy/typing/tests/data/reveal/fromnumeric.py | 278 ++ numpy/typing/tests/data/reveal/mod.py | 149 + numpy/typing/tests/data/reveal/modules.py | 20 + .../tests/data/reveal/nbit_base_example.py | 18 + .../tests/data/reveal/ndarray_conversion.py | 54 + .../typing/tests/data/reveal/ndarray_misc.py | 150 + .../data/reveal/ndarray_shape_manipulation.py | 35 + numpy/typing/tests/data/reveal/numeric.py | 89 + .../typing/tests/data/reveal/numerictypes.py | 18 + numpy/typing/tests/data/reveal/scalars.py | 28 + .../typing/tests/data/reveal/ufunc_config.py | 25 + .../tests/data/reveal/warnings_and_errors.py | 10 + numpy/typing/tests/test_isfile.py | 33 + numpy/typing/tests/test_typing.py | 182 + numpy/version.py | 10 +- pyproject.toml | 5 + pytest.ini | 1 + release_requirements.txt | 17 + runtests.py | 164 +- setup.py | 63 +- site.cfg.example | 8 - test_requirements.txt | 12 +- tools/changelog.py | 5 +- tools/download-wheels.py | 46 +- tools/functions_missing_types.py | 133 + tools/openblas_support.py | 2 +- tools/pypy-test.sh | 4 +- tools/refguide_check.py | 16 +- tools/swig/numpy.i | 50 +- tools/swig/pyfragments.swg | 11 +- tools/travis-before-install.sh | 8 + tools/travis-sorter.py | 287 ++ tools/travis-test.sh | 11 +- tools/travis-upload-wheel.sh | 13 - tox.ini | 2 +- 736 files changed, 72123 insertions(+), 19827 deletions(-) create mode 100644 benchmarks/asv_compare.conf.json.tpl create mode 100644 benchmarks/benchmarks/bench_scalar.py create mode 100644 benchmarks/benchmarks/bench_trim_zeros.py create mode 100644 doc/changelog/1.20.0-changelog.rst create mode 100644 doc/neps/_static/casting_flow.svg create mode 100644 doc/neps/_static/dtype_hierarchy.svg create mode 100644 doc/neps/_static/nep-0041-type-sketch-no-fonts.svg create mode 100644 doc/neps/_static/nep-0041-type-sketch.svg create mode 100644 doc/neps/_static/nep43-sketch-with-text.svg create mode 100644 doc/neps/_static/nep43-sketch.svg create mode 100644 doc/neps/content.rst create mode 100644 doc/neps/nep-0036-fair-play.rst create mode 100644 doc/neps/nep-0042-new-dtypes.rst create mode 100644 doc/neps/nep-0043-extensible-ufuncs.rst create mode 100644 doc/neps/nep-0045-c_style_guide.rst create mode 100644 doc/source/_static/numpy.css delete mode 100644 doc/source/_static/numpy_logo.png create mode 100644 doc/source/_static/numpylogo.svg delete mode 100644 doc/source/_templates/defindex.html delete mode 100644 doc/source/about.rst delete mode 100644 doc/source/dev/conduct/code_of_conduct.rst delete mode 100644 doc/source/dev/conduct/report_handling_manual.rst create mode 100644 doc/source/dev/gitwash/forked_page.png mode change 100644 => 100755 doc/source/dev/gitwash/forking_button.png create mode 100644 doc/source/dev/gitwash/forking_message.png create mode 100644 doc/source/dev/reviewer_guidelines.rst delete mode 100644 doc/source/dev/style_guide.rst create mode 100644 doc/source/doc_conventions.rst create mode 100644 doc/source/reference/figures/opt-infra.odg create mode 100644 doc/source/reference/figures/opt-infra.png delete mode 100644 doc/source/reference/routines.financial.rst create mode 100644 doc/source/reference/simd/simd-optimizations-tables-diff.inc create mode 100644 doc/source/reference/simd/simd-optimizations-tables.inc create mode 100644 doc/source/reference/simd/simd-optimizations.py create mode 100644 doc/source/reference/simd/simd-optimizations.rst create mode 100644 doc/source/reference/typing.rst create mode 100644 doc/source/release/1.20.0-notes.rst create mode 100644 doc/source/user/how-to-how-to.rst create mode 100644 doc/source/user/how-to-io.rst delete mode 100644 doc/source/user/ionumpy.rst delete mode 100644 doc/source/user/setting-up.rst create mode 100644 doc/source/user/tutorial-ma.rst create mode 100644 doc/source/user/who_covid_19_sit_rep_time_series.csv create mode 100644 numpy/__init__.pyi delete mode 100644 numpy/_build_utils/README delete mode 100644 numpy/_build_utils/apple_accelerate.py delete mode 100644 numpy/_build_utils/src/apple_sgemv_fix.c create mode 100644 numpy/char.pyi rename numpy/{_build_utils/__init__.py => core/__init__.pyi} (100%) create mode 100644 numpy/core/_add_newdocs_scalars.py create mode 100644 numpy/core/_asarray.pyi create mode 100644 numpy/core/_internal.pyi create mode 100644 numpy/core/_type_aliases.pyi create mode 100644 numpy/core/_ufunc_config.pyi create mode 100644 numpy/core/fromnumeric.pyi create mode 100644 numpy/core/function_base.pyi create mode 100644 numpy/core/numeric.pyi create mode 100644 numpy/core/numerictypes.pyi create mode 100644 numpy/core/shape_base.pyi create mode 100644 numpy/core/src/_simd/_simd.c create mode 100644 numpy/core/src/_simd/_simd.dispatch.c.src create mode 100644 numpy/core/src/_simd/_simd.h create mode 100644 numpy/core/src/_simd/_simd_arg.inc create mode 100644 numpy/core/src/_simd/_simd_convert.inc create mode 100644 numpy/core/src/_simd/_simd_data.inc.src create mode 100644 numpy/core/src/_simd/_simd_easyintrin.inc create mode 100644 numpy/core/src/_simd/_simd_inc.h.src create mode 100644 numpy/core/src/_simd/_simd_vector.inc create mode 100644 numpy/core/src/common/npy_cpu_dispatch.h create mode 100644 numpy/core/src/common/npy_cpuinfo_parser.h create mode 100644 numpy/core/src/common/simd/avx2/arithmetic.h create mode 100644 numpy/core/src/common/simd/avx2/avx2.h create mode 100644 numpy/core/src/common/simd/avx2/conversion.h create mode 100644 numpy/core/src/common/simd/avx2/math.h create mode 100644 numpy/core/src/common/simd/avx2/memory.h create mode 100644 numpy/core/src/common/simd/avx2/misc.h create mode 100644 numpy/core/src/common/simd/avx2/operators.h create mode 100644 numpy/core/src/common/simd/avx2/reorder.h create mode 100644 numpy/core/src/common/simd/avx2/utils.h create mode 100644 numpy/core/src/common/simd/avx512/arithmetic.h create mode 100644 numpy/core/src/common/simd/avx512/avx512.h create mode 100644 numpy/core/src/common/simd/avx512/conversion.h create mode 100644 numpy/core/src/common/simd/avx512/math.h create mode 100644 numpy/core/src/common/simd/avx512/memory.h create mode 100644 numpy/core/src/common/simd/avx512/misc.h create mode 100644 numpy/core/src/common/simd/avx512/operators.h create mode 100644 numpy/core/src/common/simd/avx512/reorder.h create mode 100644 numpy/core/src/common/simd/avx512/utils.h create mode 100644 numpy/core/src/common/simd/neon/arithmetic.h create mode 100644 numpy/core/src/common/simd/neon/conversion.h create mode 100644 numpy/core/src/common/simd/neon/math.h create mode 100644 numpy/core/src/common/simd/neon/memory.h create mode 100644 numpy/core/src/common/simd/neon/misc.h create mode 100644 numpy/core/src/common/simd/neon/neon.h create mode 100644 numpy/core/src/common/simd/neon/operators.h create mode 100644 numpy/core/src/common/simd/neon/reorder.h create mode 100644 numpy/core/src/common/simd/simd.h create mode 100644 numpy/core/src/common/simd/simd_utils.h create mode 100644 numpy/core/src/common/simd/sse/arithmetic.h create mode 100644 numpy/core/src/common/simd/sse/conversion.h create mode 100644 numpy/core/src/common/simd/sse/math.h create mode 100644 numpy/core/src/common/simd/sse/memory.h create mode 100644 numpy/core/src/common/simd/sse/misc.h create mode 100644 numpy/core/src/common/simd/sse/operators.h create mode 100644 numpy/core/src/common/simd/sse/reorder.h create mode 100644 numpy/core/src/common/simd/sse/sse.h create mode 100644 numpy/core/src/common/simd/vsx/arithmetic.h create mode 100644 numpy/core/src/common/simd/vsx/conversion.h create mode 100644 numpy/core/src/common/simd/vsx/math.h create mode 100644 numpy/core/src/common/simd/vsx/memory.h create mode 100644 numpy/core/src/common/simd/vsx/misc.h create mode 100644 numpy/core/src/common/simd/vsx/operators.h create mode 100644 numpy/core/src/common/simd/vsx/reorder.h create mode 100644 numpy/core/src/common/simd/vsx/vsx.h create mode 100644 numpy/core/src/multiarray/abstractdtypes.c create mode 100644 numpy/core/src/multiarray/abstractdtypes.h create mode 100644 numpy/core/src/multiarray/array_coercion.c create mode 100644 numpy/core/src/multiarray/array_coercion.h create mode 100644 numpy/core/src/multiarray/array_method.c create mode 100644 numpy/core/src/multiarray/array_method.h create mode 100644 numpy/core/src/multiarray/dtypemeta.c create mode 100644 numpy/core/src/multiarray/dtypemeta.h create mode 100644 numpy/core/src/multiarray/einsum_debug.h create mode 100644 numpy/core/src/multiarray/einsum_sumprod.c.src create mode 100644 numpy/core/src/multiarray/einsum_sumprod.h create mode 100644 numpy/core/src/multiarray/legacy_dtype_implementation.c create mode 100644 numpy/core/src/multiarray/legacy_dtype_implementation.h create mode 100644 numpy/core/src/umath/_umath_tests.dispatch.c create mode 100644 numpy/core/src/umath/loops_unary_fp.dispatch.c.src create mode 100644 numpy/core/src/umath/loops_utils.h create mode 100644 numpy/core/tests/examples/checks.pyx create mode 100644 numpy/core/tests/examples/setup.py create mode 100644 numpy/core/tests/test_array_coercion.py create mode 100644 numpy/core/tests/test_casting_unittests.py create mode 100644 numpy/core/tests/test_cpu_dispatcher.py create mode 100644 numpy/core/tests/test_cython.py create mode 100644 numpy/core/tests/test_simd.py create mode 100644 numpy/core/tests/test_simd_module.py create mode 100644 numpy/ctypeslib.pyi create mode 100644 numpy/distutils/__init__.pyi create mode 100644 numpy/distutils/ccompiler_opt.py create mode 100644 numpy/distutils/checks/cpu_asimd.c create mode 100644 numpy/distutils/checks/cpu_asimddp.c create mode 100644 numpy/distutils/checks/cpu_asimdfhm.c create mode 100644 numpy/distutils/checks/cpu_asimdhp.c create mode 100644 numpy/distutils/checks/cpu_avx.c create mode 100644 numpy/distutils/checks/cpu_avx2.c create mode 100644 numpy/distutils/checks/cpu_avx512_clx.c create mode 100644 numpy/distutils/checks/cpu_avx512_cnl.c create mode 100644 numpy/distutils/checks/cpu_avx512_icl.c create mode 100644 numpy/distutils/checks/cpu_avx512_knl.c create mode 100644 numpy/distutils/checks/cpu_avx512_knm.c create mode 100644 numpy/distutils/checks/cpu_avx512_skx.c create mode 100644 numpy/distutils/checks/cpu_avx512cd.c create mode 100644 numpy/distutils/checks/cpu_avx512f.c create mode 100644 numpy/distutils/checks/cpu_f16c.c create mode 100644 numpy/distutils/checks/cpu_fma3.c create mode 100644 numpy/distutils/checks/cpu_fma4.c create mode 100644 numpy/distutils/checks/cpu_neon.c create mode 100644 numpy/distutils/checks/cpu_neon_fp16.c create mode 100644 numpy/distutils/checks/cpu_neon_vfpv4.c create mode 100644 numpy/distutils/checks/cpu_popcnt.c create mode 100644 numpy/distutils/checks/cpu_sse.c create mode 100644 numpy/distutils/checks/cpu_sse2.c create mode 100644 numpy/distutils/checks/cpu_sse3.c create mode 100644 numpy/distutils/checks/cpu_sse41.c create mode 100644 numpy/distutils/checks/cpu_sse42.c create mode 100644 numpy/distutils/checks/cpu_ssse3.c create mode 100644 numpy/distutils/checks/cpu_vsx.c create mode 100644 numpy/distutils/checks/cpu_vsx2.c create mode 100644 numpy/distutils/checks/cpu_vsx3.c create mode 100644 numpy/distutils/checks/cpu_xop.c create mode 100644 numpy/distutils/checks/extra_avx512bw_mask.c create mode 100644 numpy/distutils/checks/extra_avx512dq_mask.c create mode 100644 numpy/distutils/checks/extra_avx512f_reduce.c create mode 100644 numpy/distutils/checks/test_flags.c create mode 100644 numpy/distutils/fcompiler/fujitsu.py create mode 100644 numpy/distutils/tests/test_ccompiler_opt.py create mode 100644 numpy/distutils/tests/test_ccompiler_opt_conf.py delete mode 100644 numpy/doc/basics.py delete mode 100644 numpy/doc/broadcasting.py delete mode 100644 numpy/doc/byteswapping.py delete mode 100644 numpy/doc/creation.py delete mode 100644 numpy/doc/dispatch.py delete mode 100644 numpy/doc/glossary.py delete mode 100644 numpy/doc/indexing.py delete mode 100644 numpy/doc/internals.py delete mode 100644 numpy/doc/misc.py delete mode 100644 numpy/doc/structured_arrays.py delete mode 100644 numpy/doc/subclassing.py create mode 100644 numpy/emath.pyi create mode 100644 numpy/f2py/__init__.pyi create mode 100644 numpy/f2py/tests/src/module_data/mod.mod create mode 100644 numpy/f2py/tests/src/module_data/module_data_docstring.f90 create mode 100644 numpy/f2py/tests/test_module_doc.py create mode 100644 numpy/fft/__init__.pyi create mode 100644 numpy/lib/__init__.pyi delete mode 100644 numpy/lib/financial.py delete mode 100644 numpy/lib/tests/test_financial.py create mode 100644 numpy/lib/tests/test_financial_expired.py create mode 100644 numpy/linalg/__init__.pyi create mode 100644 numpy/ma/__init__.pyi create mode 100644 numpy/matrixlib/__init__.pyi create mode 100644 numpy/polynomial/__init__.pyi create mode 100644 numpy/py.typed create mode 100644 numpy/random/__init__.pyi create mode 100644 numpy/rec.pyi create mode 100644 numpy/testing/__init__.pyi create mode 100644 numpy/typing/__init__.py create mode 100644 numpy/typing/_add_docstring.py create mode 100644 numpy/typing/_array_like.py create mode 100644 numpy/typing/_callable.py create mode 100644 numpy/typing/_dtype_like.py create mode 100644 numpy/typing/_scalars.py create mode 100644 numpy/typing/_shape.py create mode 100644 numpy/typing/setup.py create mode 100644 numpy/typing/tests/__init__.py create mode 100644 numpy/typing/tests/data/fail/arithmetic.py create mode 100644 numpy/typing/tests/data/fail/array_constructors.py create mode 100644 numpy/typing/tests/data/fail/array_like.py create mode 100644 numpy/typing/tests/data/fail/bitwise_ops.py create mode 100644 numpy/typing/tests/data/fail/constants.py create mode 100644 numpy/typing/tests/data/fail/dtype.py create mode 100644 numpy/typing/tests/data/fail/flatiter.py create mode 100644 numpy/typing/tests/data/fail/fromnumeric.py create mode 100644 numpy/typing/tests/data/fail/modules.py create mode 100644 numpy/typing/tests/data/fail/ndarray.py create mode 100644 numpy/typing/tests/data/fail/ndarray_misc.py create mode 100644 numpy/typing/tests/data/fail/numerictypes.py create mode 100644 numpy/typing/tests/data/fail/scalars.py create mode 100644 numpy/typing/tests/data/fail/ufunc_config.py create mode 100644 numpy/typing/tests/data/fail/ufuncs.py create mode 100644 numpy/typing/tests/data/fail/warnings_and_errors.py create mode 100644 numpy/typing/tests/data/mypy.ini create mode 100644 numpy/typing/tests/data/pass/arithmetic.py create mode 100644 numpy/typing/tests/data/pass/array_constructors.py create mode 100644 numpy/typing/tests/data/pass/array_like.py create mode 100644 numpy/typing/tests/data/pass/bitwise_ops.py create mode 100644 numpy/typing/tests/data/pass/dtype.py create mode 100644 numpy/typing/tests/data/pass/flatiter.py create mode 100644 numpy/typing/tests/data/pass/fromnumeric.py create mode 100644 numpy/typing/tests/data/pass/literal.py create mode 100644 numpy/typing/tests/data/pass/mod.py create mode 100644 numpy/typing/tests/data/pass/ndarray_conversion.py create mode 100644 numpy/typing/tests/data/pass/ndarray_misc.py create mode 100644 numpy/typing/tests/data/pass/ndarray_shape_manipulation.py create mode 100644 numpy/typing/tests/data/pass/numeric.py create mode 100644 numpy/typing/tests/data/pass/numerictypes.py create mode 100644 numpy/typing/tests/data/pass/scalars.py create mode 100644 numpy/typing/tests/data/pass/simple.py create mode 100644 numpy/typing/tests/data/pass/simple_py3.py create mode 100644 numpy/typing/tests/data/pass/ufunc_config.py create mode 100644 numpy/typing/tests/data/pass/ufuncs.py create mode 100644 numpy/typing/tests/data/pass/warnings_and_errors.py create mode 100644 numpy/typing/tests/data/reveal/arithmetic.py create mode 100644 numpy/typing/tests/data/reveal/array_constructors.py create mode 100644 numpy/typing/tests/data/reveal/bitwise_ops.py create mode 100644 numpy/typing/tests/data/reveal/constants.py create mode 100644 numpy/typing/tests/data/reveal/dtype.py create mode 100644 numpy/typing/tests/data/reveal/flatiter.py create mode 100644 numpy/typing/tests/data/reveal/fromnumeric.py create mode 100644 numpy/typing/tests/data/reveal/mod.py create mode 100644 numpy/typing/tests/data/reveal/modules.py create mode 100644 numpy/typing/tests/data/reveal/nbit_base_example.py create mode 100644 numpy/typing/tests/data/reveal/ndarray_conversion.py create mode 100644 numpy/typing/tests/data/reveal/ndarray_misc.py create mode 100644 numpy/typing/tests/data/reveal/ndarray_shape_manipulation.py create mode 100644 numpy/typing/tests/data/reveal/numeric.py create mode 100644 numpy/typing/tests/data/reveal/numerictypes.py create mode 100644 numpy/typing/tests/data/reveal/scalars.py create mode 100644 numpy/typing/tests/data/reveal/ufunc_config.py create mode 100644 numpy/typing/tests/data/reveal/warnings_and_errors.py create mode 100644 numpy/typing/tests/test_isfile.py create mode 100644 numpy/typing/tests/test_typing.py create mode 100644 release_requirements.txt create mode 100755 tools/functions_missing_types.py create mode 100755 tools/travis-sorter.py delete mode 100755 tools/travis-upload-wheel.sh diff --git a/INSTALL.rst.txt b/INSTALL.rst.txt index 1c33060a..1bc97c4b 100644 --- a/INSTALL.rst.txt +++ b/INSTALL.rst.txt @@ -14,7 +14,7 @@ Prerequisites Building NumPy requires the following installed software: -1) Python__ 3.6.x or newer. +1) Python__ 3.7.x or newer. Please note that the Python development headers also need to be installed, e.g., on Debian/Ubuntu one needs to install both `python3` and @@ -30,8 +30,8 @@ Building NumPy requires the following installed software: This is required for testing NumPy, but not for using it. -Python__ http://www.python.org -pytest__ http://pytest.readthedocs.io +Python__ https://www.python.org/ +pytest__ https://docs.pytest.org/en/stable/ Hypothesis__ https://hypothesis.readthedocs.io/en/latest/ @@ -39,12 +39,12 @@ Hypothesis__ https://hypothesis.readthedocs.io/en/latest/ If you want to build NumPy in order to work on NumPy itself, use ``runtests.py``. For more details, see - https://docs.scipy.org/doc/numpy/dev/development_environment.html + https://numpy.org/devdocs/dev/development_environment.html .. note:: - More extensive information on building NumPy (and SciPy) is maintained at - https://scipy.github.io/devdocs/building/ + More extensive information on building NumPy is maintained at + https://numpy.org/devdocs/user/building.html#building-from-source Basic Installation @@ -69,7 +69,7 @@ NPY_NUM_BUILD_JOBS. Choosing compilers ================== -NumPy needs a C compiler, and for development versions also Cython. A Fortran +NumPy needs a C compiler, and for development versions also needs Cython. A Fortran compiler isn't needed to build NumPy itself; the ``numpy.f2py`` tests will be skipped when running the test suite if no Fortran compiler is available. For building Scipy a Fortran compiler is needed though, so we include some details @@ -87,7 +87,7 @@ Windows ------- On Windows, building from source can be difficult (in particular if you need to -build SciPy as well, because that requires a Fortran compiler). Currently, the +build SciPy as well, because that requires a Fortran compiler). Currently, the most robust option is to use MSVC (for NumPy only). If you also need SciPy, you can either use MSVC + Intel Fortran or the Intel compiler suite. Intel itself maintains a good `application note @@ -151,7 +151,7 @@ Or by preloading a specific BLAS library with:: Build issues ============ -If you run into build issues and need help, the NumPy +If you run into build issues and need help, the NumPy and SciPy `mailing list `_ is the best -place to ask. If the issue is clearly a bug in NumPy, please file an issue (or +place to ask. If the issue is clearly a bug in NumPy, please file an issue (or even better, a pull request) at https://github.com/numpy/numpy. diff --git a/LICENSE.txt b/LICENSE.txt index 84461a14..4f7884fb 100644 --- a/LICENSE.txt +++ b/LICENSE.txt @@ -33,16 +33,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. The NumPy repository and source distributions bundle several libraries that are compatibly licensed. We list these here. -Name: Numpydoc -Files: doc/sphinxext/numpydoc/* -License: BSD-2-Clause - For details, see doc/sphinxext/LICENSE.txt - -Name: scipy-sphinx-theme -Files: doc/scipy-sphinx-theme/* -License: BSD-3-Clause AND PSF-2.0 AND Apache-2.0 - For details, see doc/scipy-sphinx-theme/LICENSE.txt - Name: lapack-lite Files: numpy/linalg/lapack_lite/* License: BSD-3-Clause diff --git a/MANIFEST.in b/MANIFEST.in index 9392b811..35eb05a6 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -15,13 +15,13 @@ include tox.ini include .coveragerc include test_requirements.txt recursive-include numpy/random *.pyx *.pxd *.pyx.in *.pxd.in +include numpy/py.typed include numpy/random/include/* include numpy/*.pxd # Add build support that should go in sdist, but not go in bdist/be installed # Note that sub-directories that don't have __init__ are apparently not # included by 'recursive-include', so list those separately recursive-include numpy * -recursive-include numpy/_build_utils * recursive-include numpy/linalg/lapack_lite * recursive-include tools * # Add sdist files whose use depends on local configuration. diff --git a/PKG-INFO b/PKG-INFO index ab58ce06..c6693742 100644 --- a/PKG-INFO +++ b/PKG-INFO @@ -1,6 +1,6 @@ Metadata-Version: 1.2 Name: numpy -Version: 1.19.5 +Version: 1.20.0 Summary: NumPy is the fundamental package for array computing with Python. Home-page: https://www.numpy.org Author: Travis E. Oliphant et al. @@ -9,7 +9,7 @@ Maintainer-email: numpy-discussion@python.org License: BSD Download-URL: https://pypi.python.org/pypi/numpy Project-URL: Bug Tracker, https://github.com/numpy/numpy/issues -Project-URL: Documentation, https://numpy.org/doc/1.19 +Project-URL: Documentation, https://numpy.org/doc/1.20 Project-URL: Source Code, https://github.com/numpy/numpy Description: It provides: @@ -35,11 +35,10 @@ Platform: Unix Classifier: Development Status :: 5 - Production/Stable Classifier: Intended Audience :: Science/Research Classifier: Intended Audience :: Developers -Classifier: License :: OSI Approved +Classifier: License :: OSI Approved :: BSD License Classifier: Programming Language :: C Classifier: Programming Language :: Python Classifier: Programming Language :: Python :: 3 -Classifier: Programming Language :: Python :: 3.6 Classifier: Programming Language :: Python :: 3.7 Classifier: Programming Language :: Python :: 3.8 Classifier: Programming Language :: Python :: 3.9 @@ -47,8 +46,9 @@ Classifier: Programming Language :: Python :: 3 :: Only Classifier: Programming Language :: Python :: Implementation :: CPython Classifier: Topic :: Software Development Classifier: Topic :: Scientific/Engineering +Classifier: Typing :: Typed Classifier: Operating System :: Microsoft :: Windows Classifier: Operating System :: POSIX Classifier: Operating System :: Unix Classifier: Operating System :: MacOS -Requires-Python: >=3.6 +Requires-Python: >=3.7 diff --git a/README.md b/README.md index 276261a9..9271a5d2 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ -# NumPy +# NumPy -[![Travis](https://img.shields.io/travis/numpy/numpy/master.svg?label=Travis%20CI)]( - https://travis-ci.org/numpy/numpy) +[![Travis CI](https://img.shields.io/travis/com/numpy/numpy/master?label=Travis%20CI)]( + https://travis-ci.com/github/numpy/numpy) [![Azure](https://dev.azure.com/numpy/numpy/_apis/build/status/azure-pipeline%20numpy.numpy)]( https://dev.azure.com/numpy/numpy/_build/latest?definitionId=5) [![codecov](https://codecov.io/gh/numpy/numpy/branch/master/graph/badge.svg)]( diff --git a/benchmarks/asv_compare.conf.json.tpl b/benchmarks/asv_compare.conf.json.tpl new file mode 100644 index 00000000..1f339077 --- /dev/null +++ b/benchmarks/asv_compare.conf.json.tpl @@ -0,0 +1,95 @@ +// This config file is almost similar to 'asv.conf.json' except it contains +// custom tokens that can be substituted by 'runtests.py' and ASV, +// due to the necessity to add custom build options when `--bench-compare` +// is used. +{ + // The version of the config file format. Do not change, unless + // you know what you are doing. + "version": 1, + + // The name of the project being benchmarked + "project": "numpy", + + // The project's homepage + "project_url": "https://www.numpy.org/", + + // The URL or local path of the source code repository for the + // project being benchmarked + "repo": "..", + + // List of branches to benchmark. If not provided, defaults to "master" + // (for git) or "tip" (for mercurial). + "branches": ["HEAD"], + + // The DVCS being used. If not set, it will be automatically + // determined from "repo" by looking at the protocol in the URL + // (if remote), or by looking for special directories, such as + // ".git" (if local). + "dvcs": "git", + + // The tool to use to create environments. May be "conda", + // "virtualenv" or other value depending on the plugins in use. + // If missing or the empty string, the tool will be automatically + // determined by looking for tools on the PATH environment + // variable. + "environment_type": "virtualenv", + + // the base URL to show a commit for the project. + "show_commit_url": "https://github.com/numpy/numpy/commit/", + + // The Pythons you'd like to test against. If not provided, defaults + // to the current version of Python used to run `asv`. + "pythons": ["3.7"], + + // The matrix of dependencies to test. Each key is the name of a + // package (in PyPI) and the values are version numbers. An empty + // list indicates to just test against the default (latest) + // version. + "matrix": { + "Cython": [], + }, + + // The directory (relative to the current directory) that benchmarks are + // stored in. If not provided, defaults to "benchmarks" + "benchmark_dir": "benchmarks", + + // The directory (relative to the current directory) to cache the Python + // environments in. If not provided, defaults to "env" + // NOTE: changes dir name will requires update `generate_asv_config()` in + // runtests.py + "env_dir": "env", + + + // The directory (relative to the current directory) that raw benchmark + // results are stored in. If not provided, defaults to "results". + "results_dir": "results", + + // The directory (relative to the current directory) that the html tree + // should be written to. If not provided, defaults to "html". + "html_dir": "html", + + // The number of characters to retain in the commit hashes. + // "hash_length": 8, + + // `asv` will cache wheels of the recent builds in each + // environment, making them faster to install next time. This is + // number of builds to keep, per environment. + "build_cache_size": 8, + + "build_command" : [ + "python setup.py build {numpy_build_options}", + "PIP_NO_BUILD_ISOLATION=false python -mpip wheel --no-deps --no-index -w {build_cache_dir} {build_dir}" + ], + // The commits after which the regression search in `asv publish` + // should start looking for regressions. Dictionary whose keys are + // regexps matching to benchmark names, and values corresponding to + // the commit (exclusive) after which to start looking for + // regressions. The default is to start from the first commit + // with results. If the commit is `null`, regression detection is + // skipped for the matching benchmark. + // + // "regressions_first_commits": { + // "some_benchmark": "352cdf", // Consider regressions only after this commit + // "another_benchmark": null, // Skip regression detection altogether + // } +} diff --git a/benchmarks/benchmarks/bench_avx.py b/benchmarks/benchmarks/bench_avx.py index 2a128b3f..82866c17 100644 --- a/benchmarks/benchmarks/bench_avx.py +++ b/benchmarks/benchmarks/bench_avx.py @@ -13,7 +13,12 @@ avx_ufuncs = ['sin', 'rint', 'floor', 'ceil' , - 'trunc'] + 'trunc', + 'frexp', + 'isnan', + 'isfinite', + 'isinf', + 'signbit'] stride = [1, 2, 4] dtype = ['f', 'd'] @@ -34,6 +39,19 @@ class AVX_UFunc(Benchmark): def time_ufunc(self, ufuncname, stride, dtype): self.f(self.arr[::stride]) +class AVX_UFunc_log(Benchmark): + params = [stride, dtype] + param_names = ['stride', 'dtype'] + timeout = 10 + + def setup(self, stride, dtype): + np.seterr(all='ignore') + N = 10000 + self.arr = np.array(np.random.random_sample(stride*N), dtype=dtype) + + def time_log(self, stride, dtype): + np.log(self.arr[::stride]) + avx_bfuncs = ['maximum', 'minimum'] @@ -56,6 +74,22 @@ class AVX_BFunc(Benchmark): def time_ufunc(self, ufuncname, dtype, stride): self.f(self.arr1[::stride], self.arr2[::stride]) +class AVX_ldexp(Benchmark): + + params = [dtype, stride] + param_names = ['dtype', 'stride'] + timeout = 10 + + def setup(self, dtype, stride): + np.seterr(all='ignore') + self.f = getattr(np, 'ldexp') + N = 10000 + self.arr1 = np.array(np.random.rand(stride*N), dtype=dtype) + self.arr2 = np.array(np.random.rand(stride*N), dtype='i') + + def time_ufunc(self, dtype, stride): + self.f(self.arr1[::stride], self.arr2[::stride]) + cmplx_bfuncs = ['add', 'subtract', 'multiply', diff --git a/benchmarks/benchmarks/bench_core.py b/benchmarks/benchmarks/bench_core.py index 060d0f7d..0c2a18c1 100644 --- a/benchmarks/benchmarks/bench_core.py +++ b/benchmarks/benchmarks/bench_core.py @@ -7,9 +7,13 @@ class Core(Benchmark): def setup(self): self.l100 = range(100) self.l50 = range(50) + self.float_l1000 = [float(i) for i in range(1000)] + self.float64_l1000 = [np.float64(i) for i in range(1000)] + self.int_l1000 = list(range(1000)) self.l = [np.arange(1000), np.arange(1000)] self.l_view = [memoryview(a) for a in self.l] self.l10x10 = np.ones((10, 10)) + self.float64_dtype = np.dtype(np.float64) def time_array_1(self): np.array(1) @@ -23,6 +27,18 @@ class Core(Benchmark): def time_array_l100(self): np.array(self.l100) + def time_array_float_l1000(self): + np.array(self.float_l1000) + + def time_array_float_l1000_dtype(self): + np.array(self.float_l1000, dtype=self.float64_dtype) + + def time_array_float64_l1000(self): + np.array(self.float64_l1000) + + def time_array_int_l1000(self): + np.array(self.int_l1000) + def time_array_l(self): np.array(self.l) diff --git a/benchmarks/benchmarks/bench_indexing.py b/benchmarks/benchmarks/bench_indexing.py index 9ee0d1fb..3206392e 100644 --- a/benchmarks/benchmarks/bench_indexing.py +++ b/benchmarks/benchmarks/bench_indexing.py @@ -31,6 +31,36 @@ class Indexing(Benchmark): self.func() +class ScalarIndexing(Benchmark): + params = [[0, 1, 2]] + param_names = ["ndim"] + + def setup(self, ndim): + self.array = np.ones((5,) * ndim) + + def time_index(self, ndim): + # time indexing. + arr = self.array + indx = (1,) * ndim + for i in range(100): + arr[indx] + + def time_assign(self, ndim): + # time assignment from a python scalar + arr = self.array + indx = (1,) * ndim + for i in range(100): + arr[indx] = 5. + + def time_assign_cast(self, ndim): + # time an assignment which may use a cast operation + arr = self.array + indx = (1,) * ndim + val = np.int16(43) + for i in range(100): + arr[indx] = val + + class IndexingSeparate(Benchmark): def setup(self): self.tmp_dir = mkdtemp() diff --git a/benchmarks/benchmarks/bench_linalg.py b/benchmarks/benchmarks/bench_linalg.py index 3abbe367..a72cccb5 100644 --- a/benchmarks/benchmarks/bench_linalg.py +++ b/benchmarks/benchmarks/bench_linalg.py @@ -105,3 +105,76 @@ class Lstsq(Benchmark): def time_numpy_linalg_lstsq_a__b_float64(self): np.linalg.lstsq(self.a, self.b, rcond=-1) + +class Einsum(Benchmark): + param_names = ['dtype'] + params = [[np.float32, np.float64]] + def setup(self, dtype): + self.one_dim_small = np.arange(600, dtype=dtype) + self.one_dim = np.arange(3000, dtype=dtype) + self.one_dim_big = np.arange(480000, dtype=dtype) + self.two_dim_small = np.arange(1200, dtype=dtype).reshape(30, 40) + self.two_dim = np.arange(240000, dtype=dtype).reshape(400, 600) + self.three_dim_small = np.arange(10000, dtype=dtype).reshape(10,100,10) + self.three_dim = np.arange(24000, dtype=dtype).reshape(20, 30, 40) + # non_contigous arrays + self.non_contigous_dim1_small = np.arange(1, 80, 2, dtype=dtype) + self.non_contigous_dim1 = np.arange(1, 4000, 2, dtype=dtype) + self.non_contigous_dim2 = np.arange(1, 2400, 2, dtype=dtype).reshape(30, 40) + self.non_contigous_dim3 = np.arange(1, 48000, 2, dtype=dtype).reshape(20, 30, 40) + + # outer(a,b): trigger sum_of_products_contig_stride0_outcontig_two + def time_einsum_outer(self, dtype): + np.einsum("i,j", self.one_dim, self.one_dim, optimize=True) + + # multiply(a, b):trigger sum_of_products_contig_two + def time_einsum_multiply(self, dtype): + np.einsum("..., ...", self.two_dim_small, self.three_dim , optimize=True) + + # sum and multiply:trigger sum_of_products_contig_stride0_outstride0_two + def time_einsum_sum_mul(self, dtype): + np.einsum(",i...->", 300, self.three_dim_small, optimize=True) + + # sum and multiply:trigger sum_of_products_stride0_contig_outstride0_two + def time_einsum_sum_mul2(self, dtype): + np.einsum("i...,->", self.three_dim_small, 300, optimize=True) + + # scalar mul: trigger sum_of_products_stride0_contig_outcontig_two + def time_einsum_mul(self, dtype): + np.einsum("i,->i", self.one_dim_big, 300, optimize=True) + + # trigger contig_contig_outstride0_two + def time_einsum_contig_contig(self, dtype): + np.einsum("ji,i->", self.two_dim, self.one_dim_small, optimize=True) + + # trigger sum_of_products_contig_outstride0_one + def time_einsum_contig_outstride0(self, dtype): + np.einsum("i->", self.one_dim_big, optimize=True) + + # outer(a,b): non_contigous arrays + def time_einsum_noncon_outer(self, dtype): + np.einsum("i,j", self.non_contigous_dim1, self.non_contigous_dim1, optimize=True) + + # multiply(a, b):non_contigous arrays + def time_einsum_noncon_multiply(self, dtype): + np.einsum("..., ...", self.non_contigous_dim2, self.non_contigous_dim3 , optimize=True) + + # sum and multiply:non_contigous arrays + def time_einsum_noncon_sum_mul(self, dtype): + np.einsum(",i...->", 300, self.non_contigous_dim3, optimize=True) + + # sum and multiply:non_contigous arrays + def time_einsum_noncon_sum_mul2(self, dtype): + np.einsum("i...,->", self.non_contigous_dim3, 300, optimize=True) + + # scalar mul: non_contigous arrays + def time_einsum_noncon_mul(self, dtype): + np.einsum("i,->i", self.non_contigous_dim1, 300, optimize=True) + + # contig_contig_outstride0_two: non_contigous arrays + def time_einsum_noncon_contig_contig(self, dtype): + np.einsum("ji,i->", self.non_contigous_dim2, self.non_contigous_dim1_small, optimize=True) + + # sum_of_products_contig_outstride0_one:non_contigous arrays + def time_einsum_noncon_contig_outstride0(self, dtype): + np.einsum("i->", self.non_contigous_dim1, optimize=True) diff --git a/benchmarks/benchmarks/bench_reduce.py b/benchmarks/benchmarks/bench_reduce.py index 76c573a5..7b05f4fc 100644 --- a/benchmarks/benchmarks/bench_reduce.py +++ b/benchmarks/benchmarks/bench_reduce.py @@ -58,6 +58,15 @@ class MinMax(Benchmark): def time_max(self, dtype): np.max(self.d) +class ArgMax(Benchmark): + params = [np.float32, bool] + param_names = ['dtype'] + + def setup(self, dtype): + self.d = np.zeros(200000, dtype=dtype) + + def time_argmax(self, dtype): + np.argmax(self.d) class SmallReduction(Benchmark): def setup(self): diff --git a/benchmarks/benchmarks/bench_scalar.py b/benchmarks/benchmarks/bench_scalar.py new file mode 100644 index 00000000..219e48be --- /dev/null +++ b/benchmarks/benchmarks/bench_scalar.py @@ -0,0 +1,33 @@ +from .common import Benchmark, TYPES1 + +import numpy as np + + +class ScalarMath(Benchmark): + # Test scalar math, note that each of these is run repeatedly to offset + # the function call overhead to some degree. + params = [TYPES1] + param_names = ["type"] + def setup(self, typename): + self.num = np.dtype(typename).type(2) + + def time_addition(self, typename): + n = self.num + res = n + n + n + n + n + n + n + n + n + n + + def time_addition_pyint(self, typename): + n = self.num + res = n + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + + def time_multiplication(self, typename): + n = self.num + res = n * n * n * n * n * n * n * n * n * n + + def time_power_of_two(self, typename): + n = self.num + res = n**2, n**2, n**2, n**2, n**2, n**2, n**2, n**2, n**2, n**2 + + def time_abs(self, typename): + n = self.num + res = abs(abs(abs(abs(abs(abs(abs(abs(abs(abs(n)))))))))) + diff --git a/benchmarks/benchmarks/bench_trim_zeros.py b/benchmarks/benchmarks/bench_trim_zeros.py new file mode 100644 index 00000000..4e25a8b0 --- /dev/null +++ b/benchmarks/benchmarks/bench_trim_zeros.py @@ -0,0 +1,27 @@ +from .common import Benchmark + +import numpy as np + +_FLOAT = np.dtype('float64') +_COMPLEX = np.dtype('complex128') +_INT = np.dtype('int64') +_BOOL = np.dtype('bool') + + +class TrimZeros(Benchmark): + param_names = ["dtype", "size"] + params = [ + [_INT, _FLOAT, _COMPLEX, _BOOL], + [3000, 30_000, 300_000] + ] + + def setup(self, dtype, size): + n = size // 3 + self.array = np.hstack([ + np.zeros(n), + np.random.uniform(size=n), + np.zeros(n), + ]).astype(dtype) + + def time_trim_zeros(self, dtype, size): + np.trim_zeros(self.array) diff --git a/benchmarks/benchmarks/common.py b/benchmarks/benchmarks/common.py index 3fd81a16..b65cc5fd 100644 --- a/benchmarks/benchmarks/common.py +++ b/benchmarks/benchmarks/common.py @@ -111,4 +111,4 @@ def get_indexes_rand_(): class Benchmark: - goal_time = 0.25 + pass diff --git a/doc/C_STYLE_GUIDE.rst.txt b/doc/C_STYLE_GUIDE.rst.txt index 07f4b99d..4e2f27fb 100644 --- a/doc/C_STYLE_GUIDE.rst.txt +++ b/doc/C_STYLE_GUIDE.rst.txt @@ -1,211 +1,3 @@ -=================== -NumPy C Style Guide -=================== -The NumPy C coding conventions are based on Python PEP-0007 by Guido van -Rossum with a few added strictures. There are many C coding conventions and -it must be emphasized that the primary goal of the NumPy conventions isn't -to choose the 'best', about which there is certain to be disagreement, but -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. - -Introduction ------------- - -This document gives coding conventions for the C code comprising -the C implementation of NumPy. Note, rules are there to be broken. -Two good reasons to break a particular rule: - -1. When applying the rule would make the code less readable, even - for someone who is used to reading code that follows the rules. - -2. To be consistent with surrounding code that also breaks it - (maybe for historic reasons) -- although this is also an - opportunity to clean up someone else's mess. - - -C dialect ---------- - -* 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 - up onto separate lines like so:: - - "blah blah" - "blah blah" - - This will work with MSVC, which otherwise chokes on very long - strings. - -* All function declarations and definitions must use full - prototypes (i.e. specify the types of all arguments). - -* No compiler warnings with major compilers (gcc, VC++, a few others). - Note: NumPy still produces compiler warnings that need to be addressed. - - -Code lay-out ------------- - -* Use 4-space indents and no tabs at all. - -* No line should be longer than 80 characters. If this and the - previous rule together don't give you enough room to code, your code is - too complicated, consider using subroutines. - -* No line should end in whitespace. If you think you need - significant trailing whitespace, think again, somebody's editor might - delete it as a matter of routine. - -* Function definition style: function name in column 1, outermost - curly braces in column 1, blank line after local variable declarations:: - - static int - extra_ivars(PyTypeObject *type, PyTypeObject *base) - { - int t_size = PyType_BASICSIZE(type); - int b_size = PyType_BASICSIZE(base); - - assert(t_size >= b_size); /* type smaller than base! */ - ... - return 1; - } - - If the transition to C++ goes through it is possible that this form will - be relaxed so that short class methods meant to be inlined can have the - return type on the same line as the function name. However, that is yet to - be determined. - -* Code structure: one space between keywords like ``if``, ``for`` and - the following left parenthesis; no spaces inside the parenthesis; braces - around all ``if`` branches and no statements on the same line as the - ``if``. They should be formatted as shown:: - - if (mro != NULL) { - one_line_statement; - } - else { - ... - } - - - for (i = 0; i < n; i++) { - one_line_statement; - } - - - while (isstuff) { - dostuff; - } - - - do { - stuff; - } while (isstuff); - - - switch (kind) { - /* Boolean kind */ - case 'b': - return 0; - /* Unsigned int kind */ - case 'u': - ... - /* Anything else */ - default: - return 3; - } - - -* The return statement should *not* get redundant parentheses:: - - return Py_None; /* correct */ - return(Py_None); /* incorrect */ - -* Function and macro call style: ``foo(a, b, c)``, no space before - the open paren, no spaces inside the parens, no spaces before - commas, one space after each comma. - -* 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. - -* Breaking long lines: if you can, break after commas in the - outermost argument list. Always indent continuation lines - appropriately, e.g., :: - - PyErr_SetString(PyExc_TypeError, - "Oh dear, you messed up."); - - Here appropriately means at least two tabs. It isn't necessary to - line everything up with the opening parenthesis of the function - call. - -* When you break a long expression at a binary operator, the - operator goes at the end of the previous line, e.g., :: - - if (type > tp_dictoffset != 0 && - base > tp_dictoffset == 0 && - type > tp_dictoffset == b_size && - (size_t)t_size == b_size + sizeof(PyObject *)) { - return 0; - } - - Note that the terms in the multi-line Boolean expression are indented so - as to make the beginning of the code block clearly visible. - -* Put blank lines around functions, structure definitions, and - major sections inside functions. - -* Comments go before the code they describe. Multi-line comments should - be like so:: - - /* - * This would be a long - * explanatory comment. - */ - - Trailing comments should be used sparingly. Instead of :: - - if (yes) { // Success! - - do :: - - if (yes) { - // Success! - -* All functions and global variables should be declared static - when they aren't needed outside the current compilation unit. - -* Declare external functions and variables in a header file. - - -Naming conventions ------------------- - -* There has been no consistent prefix for NumPy public functions, but - they all begin with a prefix of some sort, followed by an underscore, and - are in camel case: ``PyArray_DescrAlignConverter``, ``NpyIter_GetIterNext``. - 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, - for example, ``NPY_DOUBLE``. - -* Private functions should be lower case with underscores, for example: - ``array_real_get``. Single leading underscores should not be used, but - some current function names violate that rule due to historical accident. - Those functions should be renamed at some point. - - -Function documentation ----------------------- - -NumPy doesn't have a C function documentation standard at this time, but -needs one. Most numpy functions are not documented in the code and that -should change. One possibility is Doxygen with a plugin so that the same -NumPy style used for Python functions can also be used for documenting -C functions, see the files in doc/cdoc/. +The "NumPy C Style Guide" at this page has been supserseded by +"NEP 45 — C Style Guide" at https://numpy.org/neps/nep-0045-c_style_guide.html diff --git a/doc/DISTUTILS.rst.txt b/doc/DISTUTILS.rst.txt index 15073f75..c58a423c 100644 --- a/doc/DISTUTILS.rst.txt +++ b/doc/DISTUTILS.rst.txt @@ -385,46 +385,46 @@ 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 +in a custom templating language to generate C code. The ``@`` 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**/`: +The template language blocks are delimited by ``/**begin repeat`` +and ``/**end repeat**/`` lines, which may also be nested using +consecutively numbered delimiting lines such as ``/**begin repeat1`` +and ``/**end repeat1**/``: -1. "/\**begin repeat "on a line by itself marks the beginning of -a segment that should be repeated. +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. + ..., 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# + 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. +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@`` + 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. +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. + 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: @@ -464,13 +464,13 @@ The above rules may be clearer in the following template source example: /**end repeat**/ -The preprocessing of generically typed C source files (whether in NumPy +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) +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). +to produce ``.h`` files). .. _conv_template.py: https://github.com/numpy/numpy/blob/master/numpy/distutils/conv_template.py @@ -587,10 +587,6 @@ The header of a typical SciPy ``__init__.py`` is:: test = Tester().test bench = Tester().bench -Note that NumPy submodules still use a file named ``info.py`` in which the -module docstring and ``__all__`` dict are defined. These files will be removed -at some point. - Extra features in NumPy Distutils ''''''''''''''''''''''''''''''''' diff --git a/doc/HOWTO_RELEASE.rst.txt b/doc/HOWTO_RELEASE.rst.txt index 6af8d9ca..5a9c4d50 100644 --- a/doc/HOWTO_RELEASE.rst.txt +++ b/doc/HOWTO_RELEASE.rst.txt @@ -19,18 +19,11 @@ Source tree NumPy Docs ---------- - https://github.com/numpy/numpy/blob/master/doc/HOWTO_RELEASE.rst.txt -- http://projects.scipy.org/numpy/wiki/MicrosoftToolchainSupport (dead link) SciPy.org wiki -------------- - https://www.scipy.org/Installing_SciPy and links on that page. -- http://new.scipy.org/building/windows.html (dead link) - - -Doc wiki --------- -- http://docs.scipy.org/numpy/docs/numpy-docs/user/install.rst/ (dead link) Release Scripts @@ -40,16 +33,17 @@ Release Scripts Supported platforms and versions ================================ -`NEP 29`_ outlines which Python versions are supported; For the first half of -2020, this will be Python >= 3.6. 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). +:ref:`NEP 29 ` outlines which Python versions +are supported; For the first half of 2020, this will be Python >= 3.6. 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 ---- -OS X versions >= 10.9 are supported, for Python version support see `NEP 29`_. -We build binary wheels for OSX that are compatible with Python.org Python, -system Python, homebrew and macports - see this `OSX wheel building summary +OS X versions >= 10.9 are supported, for Python version support see +:ref:`NEP 29 `. We build binary wheels for +OSX that are compatible with Python.org Python, system Python, homebrew and +macports - see this `OSX wheel building summary `_ for details. @@ -95,7 +89,6 @@ You will need Cython for building the binaries. Cython compiles the ``.pyx`` files in the NumPy distribution to ``.c`` files. .. _mingw-w64 toolchain : https://mingwpy.github.io -.. _NEP 29 : https://numpy.org/neps/nep-0029-deprecation_policy.html OpenBLAS ------------ @@ -397,8 +390,11 @@ create an archive of the documentation in the numpy/doc repo:: # This checks out github.com/numpy/doc and adds (``git add``) the # documentation to the checked out repo. make merge-doc - # Now edit the ``index.html`` file in the repo to reflect the new content, - # and commit the changes + # Now edit the ``index.html`` file in the repo to reflect the new content. + # If the documentation is for a non-patch release (e.g. 1.19 -> 1.20), + # make sure to update the ``stable`` symlink to point to the new directory. + ln -sfn stable + # Commit the changes git -C build/merge commit -am "Add documentation for " # Push to numpy/doc repo git -C build/merge push diff --git a/doc/Makefile b/doc/Makefile index 31bd96a9..dd63702d 100644 --- a/doc/Makefile +++ b/doc/Makefile @@ -29,7 +29,7 @@ ALLSPHINXOPTS = -WT --keep-going -d build/doctrees $(PAPEROPT_$(PAPER)) \ .PHONY: help clean html web pickle htmlhelp latex changes linkcheck \ dist dist-build gitwash-update version-check html-build latex-build \ - merge-doc + merge-doc show #------------------------------------------------------------------------------ @@ -46,6 +46,7 @@ help: @echo " gitwash-update GITWASH=path/to/gitwash update gitwash developer docs" @echo " upload USERNAME=... RELEASE=... to upload built docs to docs.scipy.org" @echo " merge-doc TAG=... to clone numpy/doc and archive documentation into it" + @echo " show to show the html output in a browser" clean: -rm -rf build/* @@ -185,7 +186,7 @@ html-scipyorg: mkdir -p build/html build/doctrees $(SPHINXBUILD) -t scipyorg -b html $(ALLSPHINXOPTS) build/html-scipyorg $(FILES) @echo - @echo "Build finished. The HTML pages are in build/html." + @echo "Build finished. The HTML pages are in build/html-scipyorg." pickle: generate version-check mkdir -p build/pickle build/doctrees @@ -253,3 +254,7 @@ info: @echo "Running Texinfo files through makeinfo..." make -C build/texinfo info @echo "makeinfo finished; the Info files are in build/texinfo." + +show: + @python -c "import webbrowser; webbrowser.open_new_tab('file://$(PWD)/build/html/index.html')" + diff --git a/doc/RELEASE_WALKTHROUGH.rst.txt b/doc/RELEASE_WALKTHROUGH.rst.txt index 0ff9ff93..733f681a 100644 --- a/doc/RELEASE_WALKTHROUGH.rst.txt +++ b/doc/RELEASE_WALKTHROUGH.rst.txt @@ -1,41 +1,37 @@ -This file contains a walkthrough of the NumPy 1.14.5 release on Linux, modified +This file contains a walkthrough of the NumPy 1.19.0 release on Linux, modified for building on azure and uploading to anaconda.org The commands can be copied into the command line, but be sure to -replace 1.14.5 by the correct version. +replace 1.19.0 by the correct version. This should be read together with the general directions in `releasing`. -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. - +Release Preparation +=================== Backport Pull Requests ---------------------- Changes that have been marked for this release must be backported to the -maintenance/1.14.x branch. +maintenance/1.19.x branch. Update Release documentation ---------------------------- -The file ``doc/changelog/1.14.5-changelog.rst`` should be updated to reflect +The file ``doc/changelog/1.19.0-changelog.rst`` should be updated to reflect the final list of changes and contributors. This text can be generated by:: - $ python tools/changelog.py $GITHUB v1.14.4..maintenance/1.14.x > doc/changelog/1.14.5-changelog.rst + $ python tools/changelog.py $GITHUB v1.18.0..maintenance/1.19.x > doc/changelog/1.19.0-changelog.rst where ``GITHUB`` contains your github access token. This text may also be -appended to ``doc/release/1.14.5-notes.rst`` for release updates, though not -for new releases like ``1.14.0``, as the changelogs for ``*.0`` releases tend to be -excessively long. The ``doc/source/release.rst`` file should also be -updated with a link to the new release notes. These changes should be committed -to the maintenance branch, and later will be forward ported to master. +appended to ``doc/release/1.19.0-notes.rst`` for patch release, though not for +new releases like ``1.19.0``, as the changelogs for ``*.0`` releases tend to be +excessively long. The ``doc/source/release.rst`` file should also be updated +with a link to the new release notes. These changes should be committed to the +maintenance branch, and later will be forward ported to master. The changelog +should be reviewed for name duplicates or short names and the ``.mailmap`` file +updated if needed. Finish the Release Note @@ -46,25 +42,33 @@ Finish the Release Note This has changed now that we use ``towncrier``. See the instructions for creating the release note in ``doc/release/upcoming_changes/README.rst``. -Fill out the release note ``doc/release/1.14.5-notes.rst`` calling out +Fill out the release note ``doc/release/1.19.0-notes.rst`` calling out significant changes. +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. + Prepare the release commit -------------------------- Checkout the branch for the release, make sure it is up to date, and clean the repository:: - $ git checkout maintenance/1.14.x - $ git pull upstream maintenance/1.14.x + $ git checkout maintenance/1.19.x + $ git pull upstream maintenance/1.19.x $ git submodule update $ git clean -xdfq Edit pavement.py and setup.py as detailed in HOWTO_RELEASE:: - $ gvim pavement.py setup.py - $ git commit -a -m"REL: NumPy 1.14.5 release." + $ gvim pavement.py setup.py # Generally only setup.py needs updating + $ git commit -a -m"REL: NumPy 1.19.0 release." Sanity check:: @@ -73,9 +77,7 @@ Sanity check:: Push this release directly onto the end of the maintenance branch. This requires write permission to the numpy repository:: - $ git push upstream maintenance/1.14.x - -As an example, see the 1.14.3 REL commit: ``_. + $ git push upstream HEAD Build source releases @@ -86,7 +88,7 @@ Paver is used to build the source releases. It will create the ``release`` and source releases in the latter. :: $ python3 -m cython --version # check for correct cython version - $ paver sdist # sdist will do a git clean -xdf, so we omit that + $ paver sdist # sdist will do a git clean -xdfq, so we omit that Build wheels @@ -94,55 +96,46 @@ Build wheels Trigger the wheels build by pointing the numpy-wheels repository at this commit. This can take up to an hour. The numpy-wheels repository is cloned from -``_. Start with a pull as the repo -may have been accessed and changed by someone else and a push will fail:: +``_. If this is the first release in +a series, start with a pull as the repo may have been accessed and changed by +someone else, then create a new branch for the series. If the branch already +exists skip this:: $ cd ../numpy-wheels + $ git co 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 + $ git branch v1.19.x -Edit the ``azure/posix.yml`` and ``azure/windows.yml`` files to make sure they -have the correct version, and put in the commit hash for the ``REL`` commit -created above for ``BUILD_COMMIT``, see an _example:: +Checkout the new branch and edit the ``azure-pipelines.yml`` and +``.travis.yml`` files to make sure they have the correct version, and put in +the commit hash for the ``REL`` commit created above for ``BUILD_COMMIT``. The +``azure/posix.yml`` and ``.travis.yml`` files may also need the Cython versions +updated to keep up with Python releases, but generally just do:: - $ gvim azure/posix.yml azure/windows.yml - $ git commit -a + $ git checkout v1.19.x + $ gvim azure-pipelines .travis.yml + $ git commit -a -m"NumPy 1.19.0 release." $ git push upstream HEAD Now wait. If you get nervous at the amount of time taken -- the builds can take a while -- you can check the build progress by following the links -provided at ``_ to check the +provided at ``_ to check the build status. Check if all the needed wheels have been built and -uploaded before proceeding. There should currently be 21 of them at -``_, 3 for Mac, 6 -for Windows, and 12 for Linux. +uploaded to the staging repository before proceeding. -.. example_: https://github.com/MacPython/numpy-wheels/pull/80/commits/cbf4af4 - -Note that sometimes builds, like tests, fail for unrelated reasons and -you will need to restart them. +Note that sometimes builds, like tests, fail for unrelated reasons and you will +need to rerun them. You will need to be logged in under 'numpy' to do this +on azure. Download wheels --------------- -When the wheels have all been successfully built, download them using the ``wheel-uploader`` -in the ``terryfy`` repository. The terryfy repository may be cloned from -``_ if you don't already have it. The -wheels can also be uploaded using the ``wheel-uploader``, but we prefer to -download all the wheels to the ``../numpy/release/installers`` directory and -upload later using ``twine``:: +When the wheels have all been successfully built and staged, download them from the +Anaconda staging directory using the ``tools/download-wheels.py`` script:: - $ cd ../terryfy - $ git pull upstream master - $ CDN_URL=https://anaconda.org/multibuild-wheels-staging/numpy/files - $ NPY_WHLS=../numpy/release/installers - $ ./wheel-uploader -u $CDN_URL -n -v -w $NPY_WHLS -t win numpy 1.14.5 - $ ./wheel-uploader -u $CDN_URL -n -v -w $NPY_WHLS -t manylinux1 numpy 1.14.5 - $ ./wheel-uploader -u $CDN_URL -n -v -w $NPY_WHLS -t macosx numpy 1.14.5 + $ cd ../numpy + $ python3 tools/download-wheels.py 1.19.0 -If you do this often, consider making CDN_URL and NPY_WHLS part of your default -environment. Generate the README files ------------------------- @@ -150,18 +143,16 @@ Generate the README files 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 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 +Once the wheels have been built and downloaded without errors tag the ``REL`` commit, signing it with your gpg key:: - $ git tag -s v1.14.5 + $ git tag -s -m"NumPy 1.19.0 release" v1.19.0 You should upload your public gpg key to github, so that the tag will appear "verified" there. @@ -169,7 +160,7 @@ You should upload your public gpg key to github, so that the tag will appear Check that the files in ``release/installers`` have the correct versions, then push the tag upstream:: - $ git push upstream v1.14.5 + $ git push upstream v1.19.0 We wait until this point to push the tag because it is public and should not be changed after it has been pushed. @@ -185,9 +176,9 @@ Add another ``REL`` commit to the numpy maintenance branch, which resets the Create release notes for next release and edit them to set the version:: - $ cp doc/source/release/template.rst doc/source/release/1.14.6-notes.rst - $ gvim doc/source/release/1.14.6-notes.rst - $ git add doc/source/release/1.14.6-notes.rst + $ cp doc/source/release/template.rst doc/source/release/1.19.1-notes.rst + $ gvim doc/source/release/1.19.1-notes.rst + $ git add doc/source/release/1.19.1-notes.rst Add new release notes to the documentation release list:: @@ -195,26 +186,24 @@ Add new release notes to the documentation release list:: Commit the result:: - $ git commit -a -m"REL: prepare 1.14.x for further development" - $ git push upstream maintenance/1.14.x + $ git commit -a -m"REL: prepare 1.19.x for further development" + $ git push upstream HEAD 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. - -.. code-block:: sh +after recent PyPI changes, version ``3.1.1`` was used here:: $ cd ../numpy $ twine upload release/installers/*.whl - $ twine upload release/installers/numpy-1.14.5.zip # Upload last. + $ twine upload release/installers/numpy-1.19.0.zip # Upload last. -If one of the commands breaks in the middle, which is not uncommon, you may -need to selectively upload the remaining files because PyPI does not allow the -same file to be uploaded twice. The source file should be uploaded last to -avoid synchronization problems if pip users access the files while this is in +If one of the commands breaks in the middle, you may need to selectively upload +the remaining files because PyPI does not allow the same file to be uploaded +twice. The source file should be uploaded last to avoid synchronization +problems that might occur if pip users access the files while this is in process. Note that PyPI only allows a single source distribution, here we have chosen the zip archive. @@ -222,15 +211,16 @@ chosen the zip archive. Upload files to github ---------------------- -Go to ``_, there should be a ``v1.14.5 +Go to ``_, there should be a ``v1.19.0 tag``, click on it and hit the edit button for that tag. There are two ways to -add files, using an editable text window and as binary uploads. +add files, using an editable text window and as binary uploads. Cut and paste +the ``release/README.md`` file contents into the text window. You will probably +need to make some edits to get it to look right. Then -- Cut and paste the ``release/README.md`` file contents into the text window. -- Upload ``release/installers/numpy-1.14.5.tar.gz`` as a binary file. -- Upload ``release/installers/numpy-1.14.5.zip`` as a binary file. +- Upload ``release/installers/numpy-1.19.0.tar.gz`` as a binary file. +- Upload ``release/installers/numpy-1.19.0.zip`` as a binary file. - Upload ``release/README.rst`` as a binary file. -- Upload ``doc/changelog/1.14.5-changelog.rst`` as a binary file. +- Upload ``doc/changelog/1.19.0-changelog.rst`` as a binary file. - Check the pre-release button if this is a pre-releases. - Hit the ``{Publish,Update} release`` button at the bottom. @@ -255,7 +245,7 @@ If the release series is a new one, you will need to add a new section to the Otherwise, only the ``zip`` and ``pdf`` links should be updated with the new tag name:: - $ gvim doc/build/merge/index.html +/'tag v1.14' + $ gvim doc/build/merge/index.html +/'tag v1.19' You can "test run" the new documentation in a browser to make sure the links work:: @@ -265,7 +255,7 @@ work:: Once everything seems satisfactory, commit and upload the changes:: $ pushd doc/build/merge - $ git commit -am"Add documentation for v1.14.5" + $ git commit -am"Add documentation for v1.19.0" $ git push $ popd @@ -277,7 +267,7 @@ This assumes that you have forked ``_:: $ cd ../scipy.org $ git checkout master $ git pull upstream master - $ git checkout -b numpy-1.14.5 + $ git checkout -b numpy-1.19.0 $ gvim www/index.rst # edit the News section $ git commit -a $ git push origin HEAD @@ -300,13 +290,14 @@ Post-Release Tasks Checkout master and forward port the documentation changes:: - $ git checkout -b update-after-1.14.5-release - $ git checkout maintenance/1.14.x doc/source/release/1.14.5-notes.rst - $ git checkout maintenance/1.14.x doc/changelog/1.14.5-changelog.rst + $ git checkout -b post-1.19.0-release-update + $ git checkout maintenance/1.19.x doc/source/release/1.19.0-notes.rst + $ git checkout maintenance/1.19.x doc/changelog/1.19.0-changelog.rst + $ git checkout maintenance/1.19.x .mailmap # only if updated for release. $ gvim doc/source/release.rst # Add link to new notes - $ git add doc/changelog/1.14.5-changelog.rst doc/source/release/1.14.5-notes.rst + $ git add doc/changelog/1.19.0-changelog.rst doc/source/release/1.19.0-notes.rst $ git status # check status before commit - $ git commit -a -m"REL: Update master after 1.14.5 release." + $ git commit -a -m"REL: Update master after 1.19.0 release." $ git push origin HEAD Go to github and make a PR. diff --git a/doc/TESTS.rst.txt b/doc/TESTS.rst.txt index 4ab39c58..d1af7017 100644 --- a/doc/TESTS.rst.txt +++ b/doc/TESTS.rst.txt @@ -136,43 +136,24 @@ modules and develop tests for it. Labeling tests -------------- -As an alternative to ``pytest.mark.