Skip to content

Commit 4c13f5e

Browse files
committed
Merge remote-tracking branch 'upstream/main' into gh26406
2 parents 346f5fa + a5cb327 commit 4c13f5e

File tree

764 files changed

+29516
-13688
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

764 files changed

+29516
-13688
lines changed

.circleci/config.yml

Lines changed: 17 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -54,29 +54,22 @@ jobs:
5454
command: |
5555
python3.11 -m venv venv
5656
. venv/bin/activate
57-
pip install --progress-bar=off -r requirements/test_requirements.txt
57+
pip install --progress-bar=off -r requirements/test_requirements.txt \
58+
-r requirements/build_requirements.txt \
59+
-r requirements/ci_requirements.txt
5860
# get newer, pre-release versions of critical packages
59-
pip install --progress-bar=off --pre --extra-index-url https://pypi.anaconda.org/scientific-python-nightly-wheels/simple -r requirements/doc_requirements.txt
61+
pip install --progress-bar=off --pre -r requirements/doc_requirements.txt
6062
# then install numpy HEAD, which will override the version installed above
61-
pip install . --config-settings=setup-args="-Dallow-noblas=true"
62-
63-
- run:
64-
name: create release notes
65-
command: |
66-
. venv/bin/activate
67-
VERSION=$(pip show numpy | grep Version: | cut -d ' ' -f 2 | cut -c 1-5)
68-
towncrier build --version $VERSION --yes
69-
./tools/ci/test_all_newsfragments_used.py
63+
spin build --with-scipy-openblas=64
7064
7165
- run:
7266
name: build devdocs w/ref warnings
7367
command: |
7468
. venv/bin/activate
75-
cd doc
7669
# Don't use -q, show warning summary"
77-
SPHINXOPTS="-n" make -e html
78-
if [[ $(find build/html -type f | wc -l) -lt 1000 ]]; then
79-
echo "doc build failed: build/html is empty"
70+
SPHINXOPTS="-W -n" spin docs
71+
if [[ $(find doc/build/html -type f | wc -l) -lt 1000 ]]; then
72+
echo "doc build failed: doc/build/html is empty"
8073
exit -1
8174
fi
8275
@@ -95,14 +88,17 @@ jobs:
9588
# destination: neps
9689

9790
- run:
98-
name: run doctests on documentation
91+
name: check doctests
9992
command: |
10093
. venv/bin/activate
101-
# Note: keep these two checks separate, because they seem to
102-
# influence each other through changing global state (e.g., via
103-
# `np.polynomial.set_default_printstyle`)
104-
python tools/refguide_check.py --rst
105-
python tools/refguide_check.py --doctests
94+
spin check-docs -v
95+
spin check-tutorials -v
96+
# Currently, this does two checks not done by check-docs:
97+
# - validates ReST blocks (via validate_rst_syntax)
98+
# - checks that all of a module's `__all__` is reflected in the
99+
# module-level docstring autosummary
100+
echo calling python tools/refguide_check.py -v
101+
python tools/refguide_check.py -v
106102
107103
- persist_to_workspace:
108104
root: ~/repo

.editorconfig

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,21 @@ indent_size = 4
66
indent_style = space
77
max_line_length = 80
88
trim_trailing_whitespace = true
9+
10+
[*.{py,pyi,pxd}]
11+
# https://peps.python.org/pep-0008/
12+
charset = utf-8
13+
end_of_line = lf
14+
indent_size = 4
15+
indent_style = space
16+
insert_final_newline = true
17+
trim_trailing_whitespace = true
18+
19+
[*.py]
20+
# Keep in sync with `tools/lint_diff.ini` and `tools/linter.py`
21+
# https://pycodestyle.pycqa.org/en/latest/intro.html#configuration
22+
max_line_length = 88
23+
24+
[*.pyi]
25+
# https://typing.readthedocs.io/en/latest/guides/writing_stubs.html#style-guide
26+
max_line_length = 130

.github/ISSUE_TEMPLATE/bug-report.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ body:
5656
label: "Runtime Environment:"
5757
description: |
5858
1. Install `threadpoolctl` (e.g. with `pip` or `conda`)
59-
2. Paste the output of `import numpy; print(numpy.show_runtime())`.
59+
2. Paste the output of `import numpy; numpy.show_runtime()`.
6060
6161
Note: Only valid for NumPy 1.24 or newer.
6262
validations:

.github/ISSUE_TEMPLATE/typing.yml

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
name: Static Typing
2+
description: Report an issue with the NumPy typing hints.
3+
title: "TYP: <Please write a comprehensive title after the 'TYP: ' prefix>"
4+
labels: [Static typing]
5+
6+
body:
7+
- type: markdown
8+
attributes:
9+
value: >
10+
Thank you for taking the time to report this issue.
11+
Please make sure that this issue hasn't already been reported before.
12+
13+
- type: textarea
14+
attributes:
15+
label: "Describe the issue:"
16+
validations:
17+
required: true
18+
19+
- type: textarea
20+
attributes:
21+
label: "Reproduce the code example:"
22+
description: >
23+
A short code example that reproduces the error in your type-checker. It
24+
should be self-contained, i.e., can be run as-is via e.g.
25+
`mypy myproblem.py` or `pyright myproblem.py`.
26+
placeholder: |
27+
import numpy as np
28+
import numpy.typing as npt
29+
<< your code here >>
30+
render: python
31+
validations:
32+
required: true
33+
34+
- type: textarea
35+
attributes:
36+
label: "Error message:"
37+
description: >
38+
Please include all relevant error messages from your type-checker or IDE.
39+
render: shell
40+
41+
- type: textarea
42+
attributes:
43+
label: "Python and NumPy Versions:"
44+
description: >
45+
Output from `import sys, numpy; print(numpy.__version__); print(sys.version)`.
46+
validations:
47+
required: true
48+
49+
- type: textarea
50+
attributes:
51+
label: "Type-checker version and settings:"
52+
description: >
53+
Please include the exact version of the type-checker you are using.
54+
Popular (static) type checkers include Mypy, Pyright / Pylance, Pytype,
55+
Pyre, PyCharm, etc.
56+
Also include the full CLI command used to run the type-checker, and
57+
all of the relevant configuration options.
58+
validations:
59+
required: true
60+
61+
- type: textarea
62+
attributes:
63+
label: "Additional typing packages."
64+
description: |
65+
If you are using `typing-extensions` or typing-stub packages, please
66+
list their versions here.
67+
validations:
68+
required: false

.github/pr-prefix-labeler.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
11
"API": "30 - API"
22
"BENCH": "28 - Benchmark"
3-
"BUG": "00 - Bug"
43
"BLD": "36 - Build"
4+
"BUG": "00 - Bug"
55
"DEP": "07 - Deprecation"
66
"DEV": "16 - Development"
77
"DOC": "04 - Documentation"
88
"ENH": "01 - Enhancement"
99
"MAINT": "03 - Maintenance"
10+
"MNT": "03 - Maintenance"
11+
"REL": "14 - Release"
1012
"REV": "34 - Reversion"
1113
"STY": "03 - Maintenance"
1214
"TST": "05 - Testing"
13-
"REL": "14 - Release"
14-
"WIP": "25 - WIP"
1515
"TYP": "static typing"
16+
"WIP": "25 - WIP"

.github/workflows/codeql.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ jobs:
4545

4646
# Initializes the CodeQL tools for scanning.
4747
- name: Initialize CodeQL
48-
uses: github/codeql-action/init@cdcdbb579706841c47f7063dda365e292e5cad7a # v2.13.4
48+
uses: github/codeql-action/init@c36620d31ac7c881962c3d9dd939c40ec9434f2b # v3.26.12
4949
with:
5050
languages: ${{ matrix.language }}
5151
# If you wish to specify custom queries, you can do so here or in a config file.
@@ -55,7 +55,7 @@ jobs:
5555
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
5656
# If this step fails, then you should remove it and run the build manually (see below)
5757
- name: Autobuild
58-
uses: github/codeql-action/autobuild@cdcdbb579706841c47f7063dda365e292e5cad7a # v2.13.4
58+
uses: github/codeql-action/autobuild@c36620d31ac7c881962c3d9dd939c40ec9434f2b # v3.26.12
5959

6060
# ℹ️ Command-line programs to run using the OS shell.
6161
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
@@ -68,6 +68,6 @@ jobs:
6868
# ./location_of_script_within_repo/buildscript.sh
6969

7070
- name: Perform CodeQL Analysis
71-
uses: github/codeql-action/analyze@cdcdbb579706841c47f7063dda365e292e5cad7a # v2.13.4
71+
uses: github/codeql-action/analyze@c36620d31ac7c881962c3d9dd939c40ec9434f2b # v3.26.12
7272
with:
7373
category: "/language:${{matrix.language}}"

.github/workflows/cygwin.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ jobs:
6262
cd tools
6363
/usr/bin/python3.9 -m pytest --pyargs numpy -n2 -m "not slow"
6464
- name: Upload wheel if tests fail
65-
uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3
65+
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
6666
if: failure()
6767
with:
6868
name: numpy-cygwin-wheel

.github/workflows/dependency-review.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,4 @@ jobs:
1717
- name: 'Checkout Repository'
1818
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
1919
- name: 'Dependency Review'
20-
uses: actions/dependency-review-action@0c155c5e8556a497adf53f2c18edabf945ed8e70 # v4.3.2
20+
uses: actions/dependency-review-action@5a2ce3f5b92ee19cbb1541a4984c76d921601d7c # v4.3.4

.github/workflows/emscripten.yml

Lines changed: 31 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,7 @@ on:
66
- main
77
- maintenance/**
88
# Note: this workflow gets triggered on the same schedule as the
9-
# wheels.yml workflow, with the exception that this workflow runs
10-
# the test suite for the Pyodide wheel too, prior to uploading it.
11-
#
12-
# Run on schedule to upload to Anaconda.org
9+
# wheels.yml workflow to upload WASM wheels to Anaconda.org.
1310
schedule:
1411
# ┌───────────── minute (0 - 59)
1512
# │ ┌───────────── hour (0 - 23)
@@ -35,92 +32,53 @@ concurrency:
3532
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
3633
cancel-in-progress: true
3734

38-
permissions:
39-
contents: read # to fetch code (actions/checkout)
4035

4136
jobs:
4237
build-wasm-emscripten:
38+
permissions:
39+
contents: read # to fetch code (actions/checkout)
4340
name: Build NumPy distribution for Pyodide
4441
runs-on: ubuntu-22.04
4542
# To enable this workflow on a fork, comment out:
4643
if: github.repository == 'numpy/numpy'
47-
env:
48-
PYODIDE_VERSION: 0.25.1
49-
# PYTHON_VERSION and EMSCRIPTEN_VERSION are determined by PYODIDE_VERSION.
50-
# The appropriate versions can be found in the Pyodide repodata.json
51-
# "info" field, or in Makefile.envs:
52-
# https://github.com/pyodide/pyodide/blob/main/Makefile.envs#L2
53-
PYTHON_VERSION: 3.11.3
54-
EMSCRIPTEN_VERSION: 3.1.46
55-
NODE_VERSION: 18
5644
steps:
5745
- name: Checkout NumPy
58-
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
46+
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
5947
with:
6048
submodules: recursive
61-
# This input shall fetch tags without the need to fetch the
62-
# entire VCS history, see https://github.com/actions/checkout#usage
6349
fetch-tags: true
6450

65-
- name: Set up Python ${{ env.PYTHON_VERSION }}
66-
id: setup-python
67-
uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5.1.0
68-
with:
69-
python-version: ${{ env.PYTHON_VERSION }}
51+
- uses: pypa/cibuildwheel@7940a4c0e76eb2030e473a5f864f291f63ee879b # v2.21.3
52+
env:
53+
CIBW_PLATFORM: pyodide
7054

71-
- name: Set up Emscripten toolchain
72-
uses: mymindstorm/setup-emsdk@6ab9eb1bda2574c4ddb79809fc9247783eaf9021 # v14
55+
- name: Upload wheel artifact(s)
56+
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
7357
with:
74-
version: ${{ env.EMSCRIPTEN_VERSION }}
75-
actions-cache-folder: emsdk-cache
76-
77-
- name: Install pyodide-build
78-
run: pip install "pydantic<2" pyodide-build==${{ env.PYODIDE_VERSION }}
79-
80-
- name: Find installation for pyodide-build
81-
shell: python
82-
run: |
83-
import os
84-
import pyodide_build
85-
from pathlib import Path
86-
87-
pyodide_build_path = Path(pyodide_build.__file__).parent
88-
89-
env_file = os.getenv('GITHUB_ENV')
90-
91-
with open(env_file, "a") as myfile:
92-
myfile.write(f"PYODIDE_BUILD_PATH={pyodide_build_path}\n")
93-
94-
- name: Build NumPy for Pyodide
95-
run: |
96-
pyodide build -Cbuild-dir=build -Csetup-args="--cross-file=$PWD/tools/ci/emscripten/emscripten.meson.cross" -Csetup-args="-Dblas=none" -Csetup-args="-Dlapack=none"
97-
98-
- name: Set up Node.js
99-
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
58+
name: cp312-pyodide_wasm32
59+
path: ./wheelhouse/*.whl
60+
if-no-files-found: error
61+
62+
# Push to https://anaconda.org/scientific-python-nightly-wheels/numpy
63+
# WARNING: this job will overwrite any existing WASM wheels.
64+
upload-wheels:
65+
name: Upload NumPy WASM wheels to Anaconda.org
66+
runs-on: ubuntu-22.04
67+
permissions: {}
68+
needs: [build-wasm-emscripten]
69+
if: >-
70+
(github.repository == 'numpy/numpy') &&
71+
(github.event_name == 'workflow_dispatch' && github.event.inputs.push_wheels == 'true') ||
72+
(github.event_name == 'schedule')
73+
steps:
74+
- name: Download wheel artifact(s)
75+
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
10076
with:
101-
node-version: ${{ env.NODE_VERSION }}
102-
103-
- name: Set up Pyodide virtual environment
104-
run: |
105-
pyodide venv .venv-pyodide
106-
source .venv-pyodide/bin/activate
107-
pip install dist/*.whl
108-
pip install -r requirements/emscripten_test_requirements.txt
109-
110-
- name: Test NumPy for Pyodide
111-
run: |
112-
source .venv-pyodide/bin/activate
113-
cd ..
114-
pytest --pyargs numpy -m "not slow"
77+
path: wheelhouse/
78+
merge-multiple: true
11579

116-
# Push to https://anaconda.org/scientific-python-nightly-wheels/numpy
117-
# WARNING: this job will overwrite any existing WASM wheels.
11880
- name: Push to Anaconda PyPI index
119-
if: >-
120-
(github.repository == 'numpy/numpy') &&
121-
(github.event_name == 'workflow_dispatch' && github.event.inputs.push_wheels == 'true') ||
122-
(github.event_name == 'schedule')
123-
uses: scientific-python/upload-nightly-action@b67d7fcc0396e1128a474d1ab2b48aa94680f9fc # v0.5.0
81+
uses: scientific-python/upload-nightly-action@82396a2ed4269ba06c6b2988bb4fd568ef3c3d6b # v0.6.1
12482
with:
125-
artifacts_path: dist/
83+
artifacts_path: wheelhouse/
12684
anaconda_nightly_upload_token: ${{ secrets.NUMPY_NIGHTLY_UPLOAD_TOKEN }}

0 commit comments

Comments
 (0)