From c43564614e9fe2bc2c4a78bb3c3efd0a4b09f43e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Brigitta=20Sip=C5=91cz?= Date: Thu, 6 Nov 2025 06:44:29 -0800 Subject: [PATCH 1/9] ENH: adding myst config and toc --- myst.yml | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 myst.yml diff --git a/myst.yml b/myst.yml new file mode 100644 index 00000000..fa935f15 --- /dev/null +++ b/myst.yml @@ -0,0 +1,35 @@ +version: 1 +project: + title: Numpy Tutorials + # description: + # keywords: [] + authors: Numpy Community + github: https://github.com/numpy/numpy-tutorials + toc: + - file: site/index.md + + - title: Applications + children: + - file: content/mooreslaw-tutorial.md + - file: content/tutorial-deep-learning-on-mnist.md + - file: content/tutorial-x-ray-image-processing.md + - file: content/tutorial-static_equilibrium.md + - file: content/tutorial-plotting-fractals.md + - file: content/tutorial-air-quality-analysis.md + + - title: Features + children: + - file: content/tutorial-svd.md + - file: content/save-load-arrays.md + - file: content/tutorial-ma.md + - title: Contributing + file: site/contributing.md + children: + - file: content/tutorial-style-guide.md + + +site: + template: book-theme + options: + favicon: site/_static/favicon.png + logo: site/_static/numpylogo.svg From bdc5b00fdba92b55e6bb127454dea2c261bdbe89 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Brigitta=20Sip=C5=91cz?= Date: Thu, 6 Nov 2025 06:45:17 -0800 Subject: [PATCH 2/9] Removing toctrees and unused index files --- site/applications.md | 17 ----------------- site/articles.md | 13 ------------- site/contributing.md | 15 +-------------- site/features.md | 13 ------------- site/index.md | 20 -------------------- 5 files changed, 1 insertion(+), 77 deletions(-) delete mode 100644 site/applications.md delete mode 100644 site/articles.md delete mode 100644 site/features.md diff --git a/site/applications.md b/site/applications.md deleted file mode 100644 index fa81374e..00000000 --- a/site/applications.md +++ /dev/null @@ -1,17 +0,0 @@ -# NumPy Applications - -A collection of highlighting the use of NumPy for applications in science, -engineering, and data analysis. - -```{toctree} ---- -maxdepth: 1 ---- - -content/mooreslaw-tutorial -content/tutorial-deep-learning-on-mnist -content/tutorial-x-ray-image-processing -content/tutorial-static_equilibrium -content/tutorial-plotting-fractals -content/tutorial-air-quality-analysis -``` diff --git a/site/articles.md b/site/articles.md deleted file mode 100644 index 8540ed69..00000000 --- a/site/articles.md +++ /dev/null @@ -1,13 +0,0 @@ -# Articles - -```{admonition} Help improve the tutorials! - -Want to make a valuable contribution to the tutorials? Consider working on -these articles so that they become fully executable/reproducible! -``` - -```{toctree} - -content/tutorial-deep-reinforcement-learning-with-pong-from-pixels -content/tutorial-nlp-from-scratch -``` diff --git a/site/contributing.md b/site/contributing.md index e95774a5..a4287490 100644 --- a/site/contributing.md +++ b/site/contributing.md @@ -44,12 +44,6 @@ accept both Jupyter notebooks (`.ipynb`) and MyST-NB notebooks (`.md`). If you want to sync your `.ipynb` to your `.md` file follow the [pairing tutorial](content/pairing). -```{toctree} -:hidden: - -content/pairing -``` - ## Adding your own tutorials If you have your own tutorial in the form of a Jupyter notebook (an `.ipynb` @@ -66,14 +60,7 @@ We will try to respond as quickly as possible with comments, if applicable. ### Check out our suggested template You can use this template to make your content consistent with our existing -tutorials: - -```{toctree} ---- -maxdepth: 1 ---- -content/tutorial-style-guide -``` +tutorials. ### Upload your content diff --git a/site/features.md b/site/features.md deleted file mode 100644 index fb966a8a..00000000 --- a/site/features.md +++ /dev/null @@ -1,13 +0,0 @@ -# NumPy Features - -A collection of notebooks pertaining to built-in NumPy functionality. - -```{toctree} ---- -maxdepth: 1 ---- - -content/tutorial-svd -content/save-load-arrays -content/tutorial-ma -``` diff --git a/site/index.md b/site/index.md index c15d6877..ad8340c2 100644 --- a/site/index.md +++ b/site/index.md @@ -19,18 +19,6 @@ local copy of the `.ipynb` files, you can either [clone this repository](https://docs.github.com/en/github/creating-cloning-and-archiving-repositories/cloning-a-repository) or use the download icon in the upper-right corner of each tutorial. -## Content - -```{toctree} ---- -maxdepth: 2 ---- - -features -applications -contributing -``` - ### Non-executable articles ```{admonition} Help improve the tutorials! @@ -39,14 +27,6 @@ Want to make a valuable contribution to the tutorials? Consider contributing to these existing articles to help make them fully executable and reproducible! ``` -```{toctree} ---- -maxdepth: 2 ---- - -articles -``` - ## Useful links and resources The following links may be useful: From 627b2108ad8ffb1c8cb4e7e8156e2f9b3199584d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Brigitta=20Sip=C5=91cz?= Date: Thu, 6 Nov 2025 07:10:26 -0800 Subject: [PATCH 3/9] Switching the build engine --- site/Makefile | 29 ----------------------------- site/requirements.txt | 5 +---- tox.ini | 5 +++-- 3 files changed, 4 insertions(+), 35 deletions(-) delete mode 100644 site/Makefile diff --git a/site/Makefile b/site/Makefile deleted file mode 100644 index 89fe53b6..00000000 --- a/site/Makefile +++ /dev/null @@ -1,29 +0,0 @@ -# Minimal makefile for Sphinx documentation -# - -# You can set these variables from the command line, and also -# from the environment for the first two. -SPHINXOPTS ?= -SPHINXBUILD ?= sphinx-build -SOURCEDIR = . -BUILDDIR = _build - -# Put it first so that "make" without argument is like "make help". -help: - @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) - -notebooks: - mkdir -p notebooks - jupytext -k python3 ../content/*.md --from myst --to notebook - mv ../content/*.ipynb notebooks - -clean: - rm -rf _build - rm -rf notebooks - -.PHONY: help Makefile notebooks clean - -# Catch-all target: route all unknown targets to Sphinx using the new -# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). -%: Makefile - @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) diff --git a/site/requirements.txt b/site/requirements.txt index e040deba..e6e749ac 100644 --- a/site/requirements.txt +++ b/site/requirements.txt @@ -1,4 +1 @@ -sphinx -myst-nb -sphinx-book-theme -sphinx-copybutton +jupyter-book>=2 diff --git a/tox.ini b/tox.ini index f1198620..6075ba4d 100644 --- a/tox.ini +++ b/tox.ini @@ -28,7 +28,7 @@ deps = devdeps: matplotlib>=0.0.dev0 devdeps: pandas>=0.0.dev0 -allowlist_externals = bash, make +allowlist_externals = bash commands = # Force numpy reinstall to work around upper version limits in downstream dependencies (e.g. pandas) @@ -40,7 +40,8 @@ commands = !buildhtml: bash -c 'find content -name "*.md" | grep -vf ignore_testing | xargs jupytext --to notebook ' !buildhtml: pytest --nbval-lax --durations=10 content/ - buildhtml: make -C site/ SPHINXOPTS="-nWT --keep-going" html + + buildhtml: bash -c "jupyter-book build --execute --html -d" pip_pre = predeps: true From bae9cdd021a3efece92be6a0e3eb93a7daeba7bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Brigitta=20Sip=C5=91cz?= Date: Thu, 6 Nov 2025 07:19:52 -0800 Subject: [PATCH 4/9] MAINT: adding to gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index bee3f8ec..30b4c933 100644 --- a/.gitignore +++ b/.gitignore @@ -23,6 +23,7 @@ pmip tags cscope.out .ipynb_checkpoints +.tox # Compiled source # ################### From c43505a1dfe324ff422b4b55c746f032e0d60a5f Mon Sep 17 00:00:00 2001 From: Ross Barnowski Date: Thu, 6 Nov 2025 08:57:33 -0800 Subject: [PATCH 5/9] Attempt at fixing conda job. --- .github/workflows/conda.yml | 8 ++------ environment.yml | 4 ++++ 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/conda.yml b/.github/workflows/conda.yml index 0d2bc0f0..0f519f55 100644 --- a/.github/workflows/conda.yml +++ b/.github/workflows/conda.yml @@ -40,12 +40,8 @@ jobs: run: | conda info conda list - make -C site/ SPHINXOPTS="-nWT --keep-going" html - - - uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0 - with: - name: sphinx-build-artifact - path: site/_build/html/reports + export OMP_NUM_THREADS=1 + python -m tox -e py313-buildhtml - name: fail on build errors if: steps.build_step.outcome != 'success' diff --git a/environment.yml b/environment.yml index 15dd1085..d22a797e 100644 --- a/environment.yml +++ b/environment.yml @@ -16,3 +16,7 @@ dependencies: - sphinx-copybutton # to load the md files in binder - jupytext + - pip + - pip: + - jupyterbook>=2 + - jupyterlab_myst From 9269726f7729c7423bf8814f0efd4cbe8555715e Mon Sep 17 00:00:00 2001 From: Ross Barnowski Date: Thu, 6 Nov 2025 09:02:28 -0800 Subject: [PATCH 6/9] Spelling. --- environment.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/environment.yml b/environment.yml index d22a797e..8cfda206 100644 --- a/environment.yml +++ b/environment.yml @@ -18,5 +18,5 @@ dependencies: - jupytext - pip - pip: - - jupyterbook>=2 + - jupyter-book>=2 - jupyterlab_myst From ba4c0bd1af8f866e15da35d5861c421281b10dee Mon Sep 17 00:00:00 2001 From: Ross Barnowski Date: Thu, 6 Nov 2025 09:05:53 -0800 Subject: [PATCH 7/9] Add tox, rm sphinx. --- environment.yml | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/environment.yml b/environment.yml index 8cfda206..769fb7b0 100644 --- a/environment.yml +++ b/environment.yml @@ -10,11 +10,7 @@ dependencies: - pandas - imageio # For building the site - - sphinx - - myst-nb - - sphinx-book-theme - - sphinx-copybutton - # to load the md files in binder + - tox - jupytext - pip - pip: From ba34aa04083dc717e593529ee3adba9e6d165fbf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Brigitta=20Sip=C5=91cz?= Date: Thu, 6 Nov 2025 19:56:55 -0800 Subject: [PATCH 8/9] CI: fixing conda job --- .github/workflows/conda.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/conda.yml b/.github/workflows/conda.yml index 0f519f55..662289ff 100644 --- a/.github/workflows/conda.yml +++ b/.github/workflows/conda.yml @@ -41,7 +41,7 @@ jobs: conda info conda list export OMP_NUM_THREADS=1 - python -m tox -e py313-buildhtml + jupyter-book build --execute --html -d - name: fail on build errors if: steps.build_step.outcome != 'success' From 631fc3cd5c693c2e848f940ab062543e081e6160 Mon Sep 17 00:00:00 2001 From: Ross Barnowski Date: Fri, 7 Nov 2025 00:06:16 -0800 Subject: [PATCH 9/9] CI: rm conda job - to be updated with pixi later. --- .github/workflows/conda.yml | 48 ------------------------------------- 1 file changed, 48 deletions(-) delete mode 100644 .github/workflows/conda.yml diff --git a/.github/workflows/conda.yml b/.github/workflows/conda.yml deleted file mode 100644 index 662289ff..00000000 --- a/.github/workflows/conda.yml +++ /dev/null @@ -1,48 +0,0 @@ -name: Test building site with conda environment - -on: - push: - branches: - - main - pull_request: - branches: - - main - schedule: - - cron: '0 5 * * 1' - workflow_dispatch: - -jobs: - test: - runs-on: ${{ matrix.os }}-latest - - strategy: - matrix: - os: [ubuntu, macos, windows] - - defaults: - run: - shell: bash -l {0} - - steps: - - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 - - uses: conda-incubator/setup-miniconda@835234971496cad1653abb28a638a281cf32541f # v3.2.0 - with: - auto-update-conda: true - activate-environment: numpy-tutorials - environment-file: environment.yml - miniforge-version: latest - use-mamba: true - python-version: "3.11" - auto-activate-base: false - - name: inspect and build - id: build_step - continue-on-error: true - run: | - conda info - conda list - export OMP_NUM_THREADS=1 - jupyter-book build --execute --html -d - - - name: fail on build errors - if: steps.build_step.outcome != 'success' - run: exit 1