Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main' into metadata_update
Browse files Browse the repository at this point in the history
  • Loading branch information
mdhaber committed Oct 15, 2023
2 parents 41c6503 + dbd30ce commit 24d9a89
Show file tree
Hide file tree
Showing 1,576 changed files with 136,856 additions and 81,307 deletions.
168 changes: 99 additions & 69 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,23 +1,37 @@
# Python CircleCI 2.0 configuration file
# Python CircleCI 2.1 configuration file
#
# Check https://circleci.com/docs/2.0/language-python/ for more details
# Check https://circleci.com/docs/2.1/language-python/ for more details
#
version: 2
jobs:
build:
docker:
# CircleCI maintains a library of pre-built images
# documented at https://circleci.com/docs/2.0/circleci-images/
# circleci/python3.8 images come with old versions of Doxygen(1.6.x),
# therefore a new base image chose instead to guarantee to
# have a newer version >= 1.8.10 to avoid warnings
# that related to the default behaviors or non-exist config options
- image: cimg/base:2021.05
version: 2.1

# Aliases to reuse
_defaults: &defaults
docker:
# CircleCI maintains a library of pre-built images
# documented at https://circleci.com/developer/images/image/cimg/python
- image: cimg/python:3.11.4
working_directory: ~/repo

working_directory: ~/repo

jobs:
build:
<<: *defaults
steps:
- checkout:
- checkout

- run:
name: check skip
command: |
export git_log=$(git log --max-count=1 --pretty=format:"%B" | tr "\n" " ")
echo "Got commit message:"
echo "${git_log}"
if [[ -v CIRCLE_PULL_REQUEST ]] && \
([[ "$git_log" == *"[skip circle]"* ]] || \
[[ "$git_log" == *"[circle skip]"* ]])
then
echo "Skip detected, exiting job ${CIRCLE_JOB} for PR ${CIRCLE_PULL_REQUEST}."
circleci-agent step halt;
fi
- run:
name: pull changes from merge
command: |
Expand All @@ -26,120 +40,136 @@ jobs:
- run:
name: update submodules
command: |
git submodule init
git submodule update
git submodule update --init
- run:
name: create virtual environment, install dependencies
name: install system dependencies
command: |
sudo apt-get update
sudo apt-get install -y python3.8 python3.8-dev python3-venv graphviz texlive-fonts-recommended texlive-latex-recommended \
texlive-latex-extra latexmk texlive-xetex doxygen
python3.8 -m venv venv
. venv/bin/activate
sudo apt-get install -y graphviz texlive-fonts-recommended texlive-latex-recommended \
texlive-latex-extra latexmk texlive-xetex texlive-lang-chinese doxygen
- run:
name: build numpy
name: build NumPy
command: |
python3.11 -m venv venv
. venv/bin/activate
pip install --progress-bar=off --upgrade pip 'setuptools<49.2.0'
pip install --progress-bar=off -r test_requirements.txt
pip install .
pip install --progress-bar=off -r doc_requirements.txt
# get newer, pre-release versions of critical packages
pip install --progress-bar=off --pre --extra-index-url https://pypi.anaconda.org/scientific-python-nightly-wheels/simple -r doc_requirements.txt
# then install numpy HEAD, which will override the version installed above
pip install . --config-settings=setup-args="-Dallow-noblas=true"
- run:
name: create release notes
command: |
. venv/bin/activate
pip install towncrier
VERSION=$(python -c "import setup; print(setup.VERSION)")
VERSION=$(pip show numpy | grep Version: | cut -d ' ' -f 2 | cut -c 1-5)
towncrier build --version $VERSION --yes
./tools/ci/test_all_newsfragments_used.py
- run:
name: run doctests on documentation
command: |
. venv/bin/activate
(cd doc ; git submodule update --init)
# Note: keep these two checks separate, because they seem to
# influence each other through changing global state (e.g., via
# `np.polynomial.set_default_printstyle`)
python tools/refguide_check.py --rst
python tools/refguide_check.py --doctests
- run:
name: build devdocs w/ref warnings
command: |
. venv/bin/activate
cd doc
# Don't use -q, show warning summary"
SPHINXOPTS="-j4 -n" make -e html || echo "ignoring errors for now, see gh-13114"
- run:
name: build devdocs
no_output_timeout: 30m
command: |
. venv/bin/activate
cd doc
make clean
SPHINXOPTS="-j4 -q" make -e html
SPHINXOPTS="-j2 -n" make -e html || echo "ignoring errors for now, see gh-13114"
if [[ $(find build/html -type f | wc -l) -lt 1000 ]]; then
echo "doc build failed: build/html is empty"
exit -1
fi
- run:
name: build neps
command: |
. venv/bin/activate
cd doc/neps
SPHINXOPTS="-j4 -q" make -e html
SPHINXOPTS="-j2 -q" make -e html
- store_artifacts:
path: doc/build/html/


- store_artifacts:
path: doc/neps/_build/html/
# destination: neps

- persist_to_workspace:
root: ~/repo
paths:
- doc/build/html
- doc/neps/_build
- tools/ci/push_docs_to_repo.py

deploy:
<<: *defaults
steps:
- checkout

- attach_workspace:
at: ~/repo

- add_ssh_keys:
fingerprints:
- "9f:8c:e5:3f:53:40:0b:ee:c9:c3:0f:fd:0f:3c:cc:55"
- "45:d8:d1:d6:f7:53:47:c5:d0:9e:35:19:79:e7:ff:24"

- run:
name: deploy devdocs
command: |
if [ "${CIRCLE_BRANCH}" == "main" ]; then
touch doc/build/html/.nojekyll
./tools/ci/push_docs_to_repo.py doc/build/html \
[email protected]:numpy/devdocs.git \
--committer "numpy-circleci-bot" \
--email "numpy-circleci-bot@nomail" \
--message "Docs build of $CIRCLE_SHA1" \
--force
else
echo "Not on the main branch; skipping deployment"
fi
touch doc/build/html/.nojekyll
./tools/ci/push_docs_to_repo.py doc/build/html \
--committer "numpy-circleci-bot" \
--email "numpy-circleci-bot@nomail" \
--message "Docs build of $CIRCLE_SHA1" \
--count 5 \
--force \
[email protected]:numpy/devdocs.git
- add_ssh_keys:
fingerprints:
- "11:fb:19:69:80:3a:6d:37:9c:d1:ac:20:17:cd:c8:17"
- "df:8b:fb:34:2d:38:7d:49:fc:1b:e8:44:4f:bd:2c:0e"

- run:
name: select SSH key for neps repo
command: |
cat <<\EOF > ~/.ssh/config
cat \<<\EOF > ~/.ssh/config
Host github.com
IdentitiesOnly yes
IdentityFile /home/circleci/.ssh/id_rsa_11fb1969803a6d379cd1ac2017cdc817
IdentityFile /home/circleci/.ssh/id_rsa_df8bfb342d387d49fc1be8444fbd2c0e
EOF
- run:
name: deploy neps
command: |
if [ "${CIRCLE_BRANCH}" == "main" ]; then
touch doc/neps/_build/html/.nojekyll
./tools/ci/push_docs_to_repo.py doc/neps/_build/html \
[email protected]:numpy/neps.git \
--committer "numpy-circleci-bot" \
--email "numpy-circleci-bot@nomail" \
--message "Docs build of $CIRCLE_SHA1" \
--force
else
echo "Not on the main branch; skipping deployment"
fi
touch doc/neps/_build/html/.nojekyll
./tools/ci/push_docs_to_repo.py doc/neps/_build/html \
--committer "numpy-circleci-bot" \
--email "numpy-circleci-bot@nomail" \
--message "Docs build of $CIRCLE_SHA1" \
--count 5 \
--force \
[email protected]:numpy/neps.git \
workflows:
version: 2
default:
jobs:
- build
- deploy:
requires:
- build
filters:
branches:
only: main
54 changes: 54 additions & 0 deletions .cirrus.star
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# The guide to programming cirrus-ci tasks using starlark is found at
# https://cirrus-ci.org/guide/programming-tasks/
#
# In this simple starlark script we simply check conditions for whether
# a CI run should go ahead. If the conditions are met, then we just
# return the yaml containing the tasks to be run.

load("cirrus", "env", "fs", "http")

def main(ctx):
######################################################################
# Should wheels be built?
# Only test on the numpy/numpy repository
######################################################################

if env.get("CIRRUS_REPO_FULL_NAME") != "numpy/numpy":
return []

# only run the wheels entry on a cron job
if env.get("CIRRUS_CRON", "") == "nightly":
return fs.read("tools/ci/cirrus_wheels.yml")

# Obtain commit message for the event. Unfortunately CIRRUS_CHANGE_MESSAGE
# only contains the actual commit message on a non-PR trigger event.
# For a PR event it contains the PR title and description.
SHA = env.get("CIRRUS_CHANGE_IN_REPO")
url = "https://api.github.com/repos/numpy/numpy/git/commits/" + SHA
dct = http.get(url).json()

commit_msg = dct["message"]
if "[skip cirrus]" in commit_msg or "[skip ci]" in commit_msg:
return []

wheel = False
labels = env.get("CIRRUS_PR_LABELS", "")
pr_number = env.get("CIRRUS_PR", "-1")
tag = env.get("CIRRUS_TAG", "")

if "[wheel build]" in commit_msg:
wheel = True

# if int(pr_number) > 0 and ("14 - Release" in labels or "36 - Build" in labels):
# wheel = True

if tag.startswith("v") and "dev0" not in tag:
wheel = True

if wheel:
return fs.read("tools/ci/cirrus_wheels.yml")

if int(pr_number) < 0:
return []

return fs.read("tools/ci/cirrus_arm.yml")
17 changes: 17 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
// More info about Features: https://containers.dev/features
"image": "mcr.microsoft.com/devcontainers/universal:2",
"features": {},

"onCreateCommand": ".devcontainer/setup.sh",
"postCreateCommand": "",

"customizations": {
"vscode": {
"extensions": [
"ms-python.python"
],
"settings": {}
}
}
}
17 changes: 17 additions & 0 deletions .devcontainer/setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash

set -e

"${SHELL}" <(curl -Ls micro.mamba.pm/install.sh) < /dev/null

conda init --all
micromamba shell init -s bash
micromamba env create -f environment.yml --yes
# Note that `micromamba activate numpy-dev` doesn't work, it must be run by the
# user (same applies to `conda activate`)

git submodule update --init

# Enables users to activate environment without having to specify the full path
echo "envs_dirs:
- /home/codespace/micromamba/envs" > /opt/conda/.condarc
10 changes: 3 additions & 7 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -9,25 +9,22 @@
# Mark some files as vendored
numpy/linalg/lapack_lite/f2c.c linguist-vendored
numpy/linalg/lapack_lite/f2c.h linguist-vendored
tools/npy_tempita/* linguist-vendored
numpy/core/include/numpy/libdivide/* linguist-vendored
numpy/core/src/umath/svml/* linguist-vendored
numpy/core/src/common/dlpack/dlpack.h linguist-vendored

# Mark some files as generated
numpy/linalg/lapack_lite/f2c_*.c linguist-generated
numpy/linalg/lapack_lite/lapack_lite_names.h linguist-generated
numpy/_version.py linguist-generated

# versioneer config
numpy/_version.py export-subst
# version generated from pyproject.toml during build
numpy/version.py linguist-generated

# Configuration files
*.ini text
*.cfg text
./MANIFEST.in text
./numpy/core/npymath.ini.in text
./numpy/core/mlib.ini.in text
./site.cfg.example text

# Python sources
*.py text diff=python
Expand Down Expand Up @@ -106,7 +103,6 @@ numpy/_version.py export-subst
./doc/neps/index.rst.tmpl text
./benchmarks/asv_compare.conf.json.tpl text
./tools/swig/test/*.i text
./tools/gitpod/gitpod.Dockerfile text
./doc/source/dev/gitwash/git_links.inc text
./doc/source/reference/simd/*.inc text
./numpy/core/src/_simd/*.inc text diff=c
Expand Down
1 change: 0 additions & 1 deletion .github/CODE_OF_CONDUCT.md

This file was deleted.

3 changes: 0 additions & 3 deletions .github/FUNDING.yml

This file was deleted.

Loading

0 comments on commit 24d9a89

Please sign in to comment.