From ccb50abf7fdf3e8fe0b244a5e98c90acf9890443 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Franz=20Kir=C3=A1ly?= Date: Sun, 25 Aug 2024 16:36:28 +0100 Subject: [PATCH] &felipeangelimvieira, yarnabrina [MNT] CI step to test that notebooks run (#1621) This adds a CI step to run all the tutorial notebooks. The test passes if all tutorial notebooks run without error, and can be used to test the fixes in https://github.com/jdb78/pytorch-forecasting/pull/1615 --- .github/workflows/test.yml | 16 ++++++++++++++++ build_tools/run_examples.sh | 12 ++++++++++++ pyproject.toml | 9 +++++++++ 3 files changed, 37 insertions(+) create mode 100755 build_tools/run_examples.sh diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 7a3602b2..3088aef7 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -14,6 +14,22 @@ concurrency: cancel-in-progress: true jobs: + run-notebook-tutorials: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: 3.9 + - name: Install dependencies + run: | + python -m pip install --upgrade pip + python -m pip install ".[dev,github-actions,graph,mqf2]" + - name: Run example notebooks + run: build_tools/run_examples.sh + shell: bash + pytest: name: Run pytest runs-on: ${{ matrix.os }} diff --git a/build_tools/run_examples.sh b/build_tools/run_examples.sh new file mode 100755 index 00000000..db1168fb --- /dev/null +++ b/build_tools/run_examples.sh @@ -0,0 +1,12 @@ +#!/bin/bash + +# Script to run all example notebooks. +# copy-paste from sktime's run_examples.sh +set -euxo pipefail + +CMD="jupyter nbconvert --to notebook --inplace --execute --ExecutePreprocessor.timeout=600" + +for notebook in docs/source/tutorials/*.ipynb; do + echo "Running: $notebook" + $CMD "$notebook" +done diff --git a/pyproject.toml b/pyproject.toml index 9f82203c..8180f03d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -102,3 +102,12 @@ dev = [ github-actions = ["pytest-github-actions-annotate-failures"] graph = ["networkx"] mqf2 = ["cpflows"] + +[tool.setuptools] +py-modules = ["pytorch_forecasting"] + +[build-system] +build-backend = "setuptools.build_meta" +requires = [ + "setuptools>=70.0.0", +]