Skip to content

Commit 4deb1d2

Browse files
committed
Merge branch 'main' into trim_zeros
2 parents fa9a0a7 + cecc005 commit 4deb1d2

File tree

2,362 files changed

+484504
-246917
lines changed

Some content is hidden

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

2,362 files changed

+484504
-246917
lines changed

.circleci/config.yml

Lines changed: 120 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -1,115 +1,171 @@
1-
# Python CircleCI 2.0 configuration file
1+
# Python CircleCI 2.1 configuration file
22
#
3-
# Check https://circleci.com/docs/2.0/language-python/ for more details
3+
# Check https://circleci.com/docs/2.1/language-python/ for more details
44
#
5-
version: 2
6-
jobs:
7-
build:
8-
docker:
9-
# CircleCI maintains a library of pre-built images
10-
# documented at https://circleci.com/docs/2.0/circleci-images/
11-
- image: circleci/python:3.6.6
5+
version: 2.1
126

13-
working_directory: ~/repo
7+
# Aliases to reuse
8+
_defaults: &defaults
9+
docker:
10+
# CircleCI maintains a library of pre-built images
11+
# documented at https://circleci.com/developer/images/image/cimg/python
12+
- image: cimg/python:3.11.8
13+
working_directory: ~/repo
1414

15+
16+
jobs:
17+
build:
18+
<<: *defaults
1519
steps:
1620
- checkout
1721

1822
- run:
19-
name: install dependencies
23+
name: check skip
2024
command: |
21-
python3 -m venv venv
22-
ln -s $(which python3) venv/bin/python3.6
23-
. venv/bin/activate
24-
pip install cython sphinx==2.2.0 matplotlib ipython
25-
sudo apt-get update
26-
sudo apt-get install -y graphviz texlive-fonts-recommended texlive-latex-recommended texlive-latex-extra texlive-generic-extra latexmk texlive-xetex
25+
export git_log=$(git log --max-count=1 --pretty=format:"%B" | tr "\n" " ")
26+
echo "Got commit message:"
27+
echo "${git_log}"
28+
if [[ -v CIRCLE_PULL_REQUEST ]] && \
29+
([[ "$git_log" == *"[skip circle]"* ]] || \
30+
[[ "$git_log" == *"[circle skip]"* ]])
31+
then
32+
echo "Skip detected, exiting job ${CIRCLE_JOB} for PR ${CIRCLE_PULL_REQUEST}."
33+
circleci-agent step halt;
34+
fi
35+
- run:
36+
name: pull changes from merge
37+
command: |
38+
if [[ -v CI_PULL_REQUEST ]] ; then git pull --ff-only origin "refs/pull/${CI_PULL_REQUEST//*pull\//}/merge" ; fi
2739
2840
- run:
29-
name: build numpy
41+
name: update submodules
3042
command: |
31-
. venv/bin/activate
32-
pip install --upgrade pip setuptools
33-
pip install cython
34-
pip install .
35-
pip install scipy
43+
git submodule update --init
44+
45+
- run:
46+
name: install system dependencies
47+
command: |
48+
sudo apt-get update
49+
sudo apt-get install -y graphviz texlive-fonts-recommended texlive-latex-recommended \
50+
texlive-latex-extra latexmk texlive-xetex texlive-lang-chinese doxygen
3651
3752
- run:
38-
name: create release notes
53+
name: build NumPy
3954
command: |
55+
python3.11 -m venv venv
4056
. venv/bin/activate
41-
pip install git+https://github.com/hawkowl/towncrier.git@master
42-
VERSION=$(python -c "import setup; print(setup.VERSION)")
43-
towncrier --version $VERSION --yes
44-
./tools/ci/test_all_newsfragments_used.py
57+
pip install --progress-bar=off -r requirements/test_requirements.txt \
58+
-r requirements/build_requirements.txt \
59+
-r requirements/ci_requirements.txt
60+
# get newer, pre-release versions of critical packages
61+
pip install --progress-bar=off --pre --extra-index-url https://pypi.anaconda.org/scientific-python-nightly-wheels/simple -r requirements/doc_requirements.txt
62+
# then install numpy HEAD, which will override the version installed above
63+
spin build --with-scipy-openblas=64
64+
4565
- run:
46-
name: build devdocs
66+
name: build devdocs w/ref warnings
4767
command: |
4868
. venv/bin/activate
49-
cd doc
50-
git submodule update --init
51-
SPHINXOPTS=-q make -e html
69+
# Don't use -q, show warning summary"
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"
73+
exit -1
74+
fi
5275
5376
- run:
5477
name: build neps
5578
command: |
5679
. venv/bin/activate
5780
cd doc/neps
58-
SPHINXOPTS=-q make -e html
81+
SPHINXOPTS="-n" make -e html || echo "ignoring errors for now"
5982
6083
- store_artifacts:
6184
path: doc/build/html/
6285

63-
64-
# - store_artifacts:
65-
# path: doc/neps/_build/html/
86+
- store_artifacts:
87+
path: doc/neps/_build/html/
6688
# destination: neps
6789

90+
- run:
91+
name: check doctests
92+
command: |
93+
. venv/bin/activate
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
102+
103+
- persist_to_workspace:
104+
root: ~/repo
105+
paths:
106+
- doc/build/html
107+
- doc/neps/_build
108+
- tools/ci/push_docs_to_repo.py
109+
110+
deploy:
111+
<<: *defaults
112+
steps:
113+
- checkout
114+
115+
- attach_workspace:
116+
at: ~/repo
117+
68118
- add_ssh_keys:
69119
fingerprints:
70-
- "9f:8c:e5:3f:53:40:0b:ee:c9:c3:0f:fd:0f:3c:cc:55"
120+
- "45:d8:d1:d6:f7:53:47:c5:d0:9e:35:19:79:e7:ff:24"
71121

72122
- run:
73123
name: deploy devdocs
74124
command: |
75-
if [ "${CIRCLE_BRANCH}" == "master" ]; then
76-
touch doc/build/html/.nojekyll
77-
78-
./tools/ci/push_docs_to_repo.py doc/build/html \
79-
[email protected]:numpy/devdocs.git \
80-
--committer "numpy-circleci-bot" \
81-
--email "numpy-circleci-bot@nomail" \
82-
--message "Docs build of $CIRCLE_SHA1" \
83-
--force
84-
else
85-
echo "Not on the master branch; skipping deployment"
86-
fi
125+
touch doc/build/html/.nojekyll
126+
127+
./tools/ci/push_docs_to_repo.py doc/build/html \
128+
--committer "numpy-circleci-bot" \
129+
--email "numpy-circleci-bot@nomail" \
130+
--message "Docs build of $CIRCLE_SHA1" \
131+
--count 5 \
132+
--force \
133+
[email protected]:numpy/devdocs.git
87134
88135
- add_ssh_keys:
89136
fingerprints:
90-
- "11:fb:19:69:80:3a:6d:37:9c:d1:ac:20:17:cd:c8:17"
137+
- "df:8b:fb:34:2d:38:7d:49:fc:1b:e8:44:4f:bd:2c:0e"
91138

92139
- run:
93140
name: select SSH key for neps repo
94141
command: |
95-
cat <<\EOF > ~/.ssh/config
142+
cat \<<\EOF > ~/.ssh/config
96143
Host github.com
97144
IdentitiesOnly yes
98-
IdentityFile /home/circleci/.ssh/id_rsa_11fb1969803a6d379cd1ac2017cdc817
145+
IdentityFile /home/circleci/.ssh/id_rsa_df8bfb342d387d49fc1be8444fbd2c0e
99146
EOF
100147
101148
- run:
102149
name: deploy neps
103150
command: |
104-
if [ "${CIRCLE_BRANCH}" == "master" ]; then
105-
touch doc/neps/_build/html/.nojekyll
106-
107-
./tools/ci/push_docs_to_repo.py doc/neps/_build/html \
108-
[email protected]:numpy/neps.git \
109-
--committer "numpy-circleci-bot" \
110-
--email "numpy-circleci-bot@nomail" \
111-
--message "Docs build of $CIRCLE_SHA1" \
112-
--force
113-
else
114-
echo "Not on the master branch; skipping deployment"
115-
fi
151+
touch doc/neps/_build/html/.nojekyll
152+
153+
./tools/ci/push_docs_to_repo.py doc/neps/_build/html \
154+
--committer "numpy-circleci-bot" \
155+
--email "numpy-circleci-bot@nomail" \
156+
--message "Docs build of $CIRCLE_SHA1" \
157+
--count 5 \
158+
--force \
159+
[email protected]:numpy/neps.git \
160+
161+
workflows:
162+
version: 2
163+
default:
164+
jobs:
165+
- build
166+
- deploy:
167+
requires:
168+
- build
169+
filters:
170+
branches:
171+
only: main

.cirrus.star

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# The guide to programming cirrus-ci tasks using starlark is found at
2+
# https://cirrus-ci.org/guide/programming-tasks/
3+
#
4+
# In this simple starlark script we simply check conditions for whether
5+
# a CI run should go ahead. If the conditions are met, then we just
6+
# return the yaml containing the tasks to be run.
7+
8+
load("cirrus", "env", "fs", "http")
9+
10+
def main(ctx):
11+
######################################################################
12+
# Should wheels be built?
13+
# Only test on the numpy/numpy repository
14+
######################################################################
15+
16+
if env.get("CIRRUS_REPO_FULL_NAME") != "numpy/numpy":
17+
return []
18+
19+
# only run the wheels entry on a cron job
20+
if env.get("CIRRUS_CRON", "") == "nightly":
21+
return fs.read("tools/ci/cirrus_wheels.yml")
22+
23+
# Obtain commit message for the event. Unfortunately CIRRUS_CHANGE_MESSAGE
24+
# only contains the actual commit message on a non-PR trigger event.
25+
# For a PR event it contains the PR title and description.
26+
SHA = env.get("CIRRUS_CHANGE_IN_REPO")
27+
url = "https://api.github.com/repos/numpy/numpy/git/commits/" + SHA
28+
dct = http.get(url).json()
29+
30+
commit_msg = dct["message"]
31+
if "[skip cirrus]" in commit_msg or "[skip ci]" in commit_msg:
32+
return []
33+
34+
wheel = False
35+
labels = env.get("CIRRUS_PR_LABELS", "")
36+
pr_number = env.get("CIRRUS_PR", "-1")
37+
tag = env.get("CIRRUS_TAG", "")
38+
39+
if "[wheel build]" in commit_msg:
40+
wheel = True
41+
42+
# if int(pr_number) > 0 and ("14 - Release" in labels or "36 - Build" in labels):
43+
# wheel = True
44+
45+
if tag.startswith("v") and "dev0" not in tag:
46+
wheel = True
47+
48+
if wheel:
49+
return fs.read("tools/ci/cirrus_wheels.yml")
50+
51+
if int(pr_number) < 0:
52+
return []
53+
54+
return fs.read("tools/ci/cirrus_arm.yml")

.clang-format

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# A clang-format style that approximates Python's PEP 7
2+
# Useful for IDE integration
3+
#
4+
# Based on Paul Ganssle's version at
5+
# https://gist.github.com/pganssle/0e3a5f828b4d07d79447f6ced8e7e4db
6+
# and modified for NumPy
7+
BasedOnStyle: Google
8+
AlignAfterOpenBracket: Align
9+
AllowShortEnumsOnASingleLine: false
10+
AllowShortIfStatementsOnASingleLine: false
11+
AlwaysBreakAfterReturnType: TopLevel
12+
BreakBeforeBraces: Stroustrup
13+
ColumnLimit: 79
14+
ContinuationIndentWidth: 8
15+
DerivePointerAlignment: false
16+
IndentWidth: 4
17+
IncludeBlocks: Regroup
18+
IncludeCategories:
19+
- Regex: '^[<"](Python|structmember|pymem)\.h'
20+
Priority: -3
21+
CaseSensitive: true
22+
- Regex: '^"numpy/'
23+
Priority: -2
24+
- Regex: '^"(npy_pycompat|npy_config)'
25+
Priority: -1
26+
- Regex: '^"[[:alnum:]_.]+"'
27+
Priority: 1
28+
- Regex: '^<[[:alnum:]_.]+"'
29+
Priority: 2
30+
Language: Cpp
31+
PointerAlignment: Right
32+
ReflowComments: true
33+
SpaceBeforeParens: ControlStatements
34+
SpacesInParentheses: false
35+
StatementMacros: [PyObject_HEAD, PyObject_VAR_HEAD, PyObject_HEAD_EXTRA]
36+
TabWidth: 4
37+
UseTab: Never

.codecov.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@ coverage:
66
status:
77
project:
88
default:
9-
# Require 1% coverage, i.e., always succeed
10-
target: 1
11-
patch: false
9+
informational: true
10+
patch:
11+
default:
12+
informational: true
1213
changes: false
1314
comment: off

.dependabot/config.yml

Lines changed: 0 additions & 9 deletions
This file was deleted.

.devcontainer/devcontainer.json

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
// More info about Features: https://containers.dev/features
3+
"image": "mcr.microsoft.com/devcontainers/universal:2",
4+
"features": {},
5+
6+
"onCreateCommand": ".devcontainer/setup.sh",
7+
"postCreateCommand": "",
8+
9+
"customizations": {
10+
"vscode": {
11+
"extensions": [
12+
"ms-python.python"
13+
],
14+
"settings": {}
15+
}
16+
}
17+
}

.devcontainer/setup.sh

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/bin/bash
2+
3+
set -e
4+
5+
"${SHELL}" <(curl -Ls micro.mamba.pm/install.sh) < /dev/null
6+
7+
conda init --all
8+
micromamba shell init -s bash
9+
micromamba env create -f environment.yml --yes
10+
# Note that `micromamba activate numpy-dev` doesn't work, it must be run by the
11+
# user (same applies to `conda activate`)
12+
13+
git submodule update --init
14+
15+
# Enables users to activate environment without having to specify the full path
16+
echo "envs_dirs:
17+
- /home/codespace/micromamba/envs" > /opt/conda/.condarc

0 commit comments

Comments
 (0)