From fa47147562dd74c1727e43e80c7c5eb6c0b44898 Mon Sep 17 00:00:00 2001 From: Leah Wasser Date: Wed, 7 Oct 2026 16:49:02 -0600 Subject: [PATCH 1/6] chore(ci): setup netlify --- CONTRIBUTING.md | 9 +++++++++ netlify.toml | 14 ++++++++++++++ scripts/netlify-build.sh | 13 +++++++++++++ 3 files changed, 36 insertions(+) create mode 100644 netlify.toml create mode 100755 scripts/netlify-build.sh diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 870475bf..090a88ee 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -280,6 +280,15 @@ An image showing the status of the checks in a pull request in GitHub. The check To get more information about the errors, you can click on the "Details" link next to the failed check. +### Pull request previews + +This guide uses [Netlify](https://www.netlify.com/) deploy previews. After +the Netlify check finishes on a pull request, click **Details** next to the +deploy-preview status to open a live build with your changes. + +Production stays on GitHub Pages: +. + ### What to expect from the review process Once you submit a pull request, a maintainer of the repository will review your changes and provide feedback. The review process may involve: diff --git a/netlify.toml b/netlify.toml new file mode 100644 index 00000000..f8cb2b6c --- /dev/null +++ b/netlify.toml @@ -0,0 +1,14 @@ +# Netlify deploy previews for the pyOpenSci Python package guide (Sphinx). +# Production remains GitHub Pages: +# https://www.pyopensci.org/python-package-guide/ + +[build] + command = "bash scripts/netlify-build.sh" + publish = "_build/html" + +[build.environment] + PYTHON_VERSION = "3.13" + MPLBACKEND = "Agg" + # Previews are served from the preview URL root, so language-selector + # links use "/" (conf.py treats anything other than production that way). + SPHINX_ENV = "development" diff --git a/scripts/netlify-build.sh b/scripts/netlify-build.sh new file mode 100755 index 00000000..fc124b4c --- /dev/null +++ b/scripts/netlify-build.sh @@ -0,0 +1,13 @@ +#!/usr/bin/env bash +# Build the Sphinx Python package guide on Netlify (deploy previews). +set -euo pipefail + +# Full history so hatch-vcs can resolve the version from git tags. +if [ "$(git rev-parse --is-shallow-repository)" = "true" ]; then + git fetch --unshallow +fi +git fetch --tags || true + +python -m pip install --upgrade pip +python -m pip install nox +nox -s docs From ba2b754438e84214e37398d50ea507487f4c6298 Mon Sep 17 00:00:00 2001 From: Leah Wasser Date: Wed, 7 Oct 2026 16:51:57 -0600 Subject: [PATCH 2/6] fix: Remove circle ci and update netlify to build languages --- .circleci/config.yml | 33 --------------------------------- conf.py | 6 +++++- netlify.toml | 3 ++- 3 files changed, 7 insertions(+), 35 deletions(-) delete mode 100644 .circleci/config.yml diff --git a/.circleci/config.yml b/.circleci/config.yml deleted file mode 100644 index ac29986f..00000000 --- a/.circleci/config.yml +++ /dev/null @@ -1,33 +0,0 @@ -version: 2.1 -jobs: - build-book: - docker: - - image: cimg/python:3.13 - steps: - - checkout - - run: - name: Restore mtimes from git history - command: | - sudo apt-get update - sudo apt-get install git-restore-mtime - git restore-mtime - - run: - name: setup environment - command: | - pip install --upgrade pip - pip install nox - pip list - - run: - name: Build book html - command: nox -s docs - - - store_artifacts: - path: _build/html - destination: html - -# Tell CircleCI to use this workflow when it builds the site -workflows: - version: 2 - build-book: - jobs: - - build-book diff --git a/conf.py b/conf.py index 8f2be65b..a1413bbc 100644 --- a/conf.py +++ b/conf.py @@ -51,7 +51,11 @@ # languages that will be included in the language dropdown # (ie. all that are being built in this nox build session) -if sphinx_env == "production": +# Netlify sets NETLIFY=true. Those builds publish the same languages as +# production. Link prefixes stay at "/" because SPHINX_ENV is development +# there (see netlify.toml). Local builds are unchanged. +on_netlify = os.environ.get("NETLIFY", "").lower() == "true" +if sphinx_env == "production" or on_netlify: build_languages = ["en"] + release_languages else: build_languages = ["en"] + languages diff --git a/netlify.toml b/netlify.toml index f8cb2b6c..dd66da27 100644 --- a/netlify.toml +++ b/netlify.toml @@ -10,5 +10,6 @@ PYTHON_VERSION = "3.13" MPLBACKEND = "Agg" # Previews are served from the preview URL root, so language-selector - # links use "/" (conf.py treats anything other than production that way). + # links use "/" (conf.py does that whenever SPHINX_ENV is not production). + # Netlify also sets NETLIFY=true, which limits the menu to release languages. SPHINX_ENV = "development" From aebb2121769e3d1dcdbc640c7c50e409f5c014fc Mon Sep 17 00:00:00 2001 From: Leah Wasser Date: Wed, 7 Oct 2026 17:12:43 -0600 Subject: [PATCH 3/6] chore: version issues --- scripts/netlify-build.sh | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/scripts/netlify-build.sh b/scripts/netlify-build.sh index fc124b4c..8021d352 100755 --- a/scripts/netlify-build.sh +++ b/scripts/netlify-build.sh @@ -2,12 +2,10 @@ # Build the Sphinx Python package guide on Netlify (deploy previews). set -euo pipefail -# Full history so hatch-vcs can resolve the version from git tags. -if [ "$(git rev-parse --is-shallow-repository)" = "true" ]; then - git fetch --unshallow -fi -git fetch --tags || true +# hatch-vcs reads the package version from git tags. Netlify's checkout +# often has no tags. The docs do not display this version. +export SETUPTOOLS_SCM_PRETEND_VERSION="${SETUPTOOLS_SCM_PRETEND_VERSION:-0.0.0}" python -m pip install --upgrade pip python -m pip install nox -nox -s docs +python -m nox -s docs From 78588d8a8a2fdc66fef1e7503e8e5d0541e0d111 Mon Sep 17 00:00:00 2001 From: Leah Wasser Date: Wed, 7 Oct 2026 17:15:52 -0600 Subject: [PATCH 4/6] Apply suggestion from @lwasser --- CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 090a88ee..9bbaa68d 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -286,7 +286,7 @@ This guide uses [Netlify](https://www.netlify.com/) deploy previews. After the Netlify check finishes on a pull request, click **Details** next to the deploy-preview status to open a live build with your changes. -Production stays on GitHub Pages: +The guide is still deployed live using GitHub Pages: . ### What to expect from the review process From 0908f47d03ec46b501ec81835f5550d076ed0ac7 Mon Sep 17 00:00:00 2001 From: Inessa Pawson Date: Wed, 7 Oct 2026 23:47:10 -0400 Subject: [PATCH 5/6] chore(ci): remove remaining CircleCI references --- .github/workflows/artifact_redirect.yml | 24 ------------------------ README.md | 2 -- 2 files changed, 26 deletions(-) delete mode 100644 .github/workflows/artifact_redirect.yml diff --git a/.github/workflows/artifact_redirect.yml b/.github/workflows/artifact_redirect.yml deleted file mode 100644 index 4b43d972..00000000 --- a/.github/workflows/artifact_redirect.yml +++ /dev/null @@ -1,24 +0,0 @@ -name: Book Preview Redirect -on: [status] - -concurrency: - group: docs-preview-${{ github.ref }} - cancel-in-progress: true - -jobs: - circleci_artifacts_redirector_job: - runs-on: ubuntu-latest - # For testing this action on a fork, remove the "github.repository =="" condition. - if: "github.event.context == 'ci/circleci: build-book'" - permissions: - statuses: write - name: Run CircleCI artifacts redirector - steps: - - name: GitHub Action step - uses: scientific-python/circleci-artifacts-redirector-action@5d358ff96e96429a5c64a969bb4a574555439f4f # v1.3.1 - with: - repo-token: ${{ secrets.GITHUB_TOKEN }} - api-token: ${{ secrets.CIRCLECI_TOKEN }} - artifact-path: 0/html/index.html - circleci-jobs: build-book - job-title: View rendered book here! diff --git a/README.md b/README.md index 4851177b..9483f63f 100644 --- a/README.md +++ b/README.md @@ -6,8 +6,6 @@ [![DOI](https://zenodo.org/badge/556814582.svg)](https://zenodo.org/badge/latestdoi/556814582) -[![CircleCI](https://circleci.com/gh/pyOpenSci/python-package-guide.svg?style=svg)](https://circleci.com/gh/pyOpenSci/python-package-guide) - [![Mentioned in Awesome Scientific Python](https://awesome.re/mentioned-badge.svg)](https://github.com/rossant/awesome-scientific-python) ## What is pyOpenSci? From 30dc56b763e11c66ffc6dbcf827c11b1b1fc2a29 Mon Sep 17 00:00:00 2001 From: Leah Wasser Date: Thu, 8 Oct 2026 14:47:39 -0600 Subject: [PATCH 6/6] Update CONTRIBUTING.md Co-authored-by: Inessa Pawson --- CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 9bbaa68d..2f68cec0 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -256,7 +256,7 @@ Once you submit a pull request, a series of checks will be run to ensure that yo - **Code formatting and styles**: checks that your code is formatted correctly, by `pre-commit.ci - pr check`. - **docs build**: checks that the documentation builds correctly, using `circleci`. - +- **docs build / preview**: builds the guide and publishes a Netlify deploy preview (see [Pull request previews](#pull-request-previews) below). You will see the status of these checks in your pull request. ```{figure} images/contributing/pull-requests-checks.png