-
Notifications
You must be signed in to change notification settings - Fork 98
Run notebooks in CI #1013
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
selmanozleyen
wants to merge
31
commits into
scverse:main
Choose a base branch
from
selmanozleyen:feature/test-notebooks-ci
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Run notebooks in CI #1013
Changes from 6 commits
Commits
Show all changes
31 commits
Select commit
Hold shift + click to select a range
dd09e76
init
selmanozleyen 40a92e2
add yaml file
selmanozleyen ee40db6
fix tox ini file
selmanozleyen 460d659
update tox deps
selmanozleyen dd1d60a
since the notebooks work add others to test
selmanozleyen 77c7eca
remove the tutorials folder as it has too much dependencies
selmanozleyen 3ada541
Merge branch 'main' into feature/test-notebooks-ci
selmanozleyen 8da3ed9
convert to python
selmanozleyen 41bff5e
use uv and hatch for notebooks only
selmanozleyen fd5461f
need to add notebook dependencies now
selmanozleyen 88b32c6
add yaml file
selmanozleyen 250c0c9
fix tox ini file
selmanozleyen bb01800
update tox deps
selmanozleyen f46277b
since the notebooks work add others to test
selmanozleyen b545067
remove the tutorials folder as it has too much dependencies
selmanozleyen 7e49bd5
convert to python
selmanozleyen 9ce411c
update with new rebase
selmanozleyen 4f53eb6
Merge branch 'feature/test-notebooks-ci' of https://github.com/selman…
selmanozleyen 2ce1318
specify path
selmanozleyen 8ad34c5
Merge branch 'main' into feature/test-notebooks-ci
selmanozleyen 8236ab5
remove .run_notebooks
selmanozleyen 496efb1
Merge branch 'feature/test-notebooks-ci' of https://github.com/selman…
selmanozleyen 46f0ef4
no need to specify uv anymore
selmanozleyen 1afa96b
remove toxini and make sure pyproject is same as main
selmanozleyen 1ca5718
add step to setup squidpy kernel
selmanozleyen 6ecab08
fix syntax err
selmanozleyen bef64d3
update the notebook commit
selmanozleyen 3a9a004
update the nb commit for rendering
selmanozleyen 494e38b
Merge branch 'main' into feature/test-notebooks-ci
selmanozleyen f474058
update the home page to add new section
selmanozleyen fd6f9a4
Merge branch 'feature/test-notebooks-ci' of https://github.com/selman…
selmanozleyen File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
name: Test notebooks | ||
|
||
on: | ||
push: | ||
branches: [main] | ||
pull_request: | ||
branches: [main] | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
test: | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: [ubuntu-latest] | ||
python: ["3.11"] | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
submodules: recursive | ||
- name: Set up Python ${{ matrix.python }} | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: ${{ matrix.python }} | ||
|
||
- name: Install pip dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install tox | ||
flying-sheep marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
- name: Test notebooks | ||
env: | ||
MPLBACKEND: agg | ||
PLATFORM: ${{ matrix.os }} | ||
DISPLAY: :42 | ||
run: | | ||
tox -e examples-docs |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
#!/bin/bash | ||
selmanozleyen marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
||
# Check if the base directory is provided as an argument | ||
if [ "$#" -ne 1 ]; then | ||
echo "Usage: $0 <base_notebook_directory>" | ||
exit 1 | ||
fi | ||
|
||
# Base directory for notebooks | ||
base_dir=$1 | ||
|
||
# Define notebook directories or patterns | ||
declare -a notebooks=( | ||
"$base_dir/examples/tools/*.ipynb" | ||
"$base_dir/examples/plotting/*.ipynb" | ||
"$base_dir/examples/image/*.ipynb" | ||
"$base_dir/examples/graph/*.ipynb" | ||
# "$base_dir/tutorials/*.ipynb" don't include because it contains many external modules | ||
) | ||
|
||
# Initialize an array to hold valid notebook paths | ||
declare -a valid_notebooks | ||
|
||
# Gather all valid notebook files from the patterns | ||
echo "Gathering notebooks..." | ||
for pattern in "${notebooks[@]}"; do | ||
for nb in $pattern; do | ||
if [[ -f "$nb" ]]; then # Check if the file exists | ||
valid_notebooks+=("$nb") # Add to the list of valid notebooks | ||
fi | ||
done | ||
done | ||
|
||
# Check if we have any notebooks to run | ||
if [ ${#valid_notebooks[@]} -eq 0 ]; then | ||
echo "No notebooks found to run." | ||
exit 1 | ||
fi | ||
|
||
# Echo the notebooks that will be run for clarity | ||
echo "Preparing to run the following notebooks:" | ||
for nb in "${valid_notebooks[@]}"; do | ||
echo "$nb" | ||
done | ||
|
||
# Initialize a flag to track the success of all commands | ||
all_success=true | ||
|
||
# Execute all valid notebooks | ||
for nb in "${valid_notebooks[@]}"; do | ||
echo "Running $nb" | ||
jupytext -k squidpy --execute "$nb" || { | ||
echo "Failed to run $nb" | ||
all_success=false | ||
} | ||
done | ||
|
||
# Check if any executions failed | ||
if [ "$all_success" = false ]; then | ||
echo "One or more notebooks failed to execute." | ||
exit 1 | ||
fi | ||
|
||
echo "All notebooks executed successfully." |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For reproducibility, should we have a check for whether the notebooks change? This would basically turn the notebooks into tests-for-stability, but could be a nice check. @timtreis or @LucaMarconato have you guys ever received feedback about stability?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we could have expected and output folders to compare but we'd have to update expected when we expect/want the output to change. Similar to plot unit tests. I think this is doable but would fit better as a separate issue imo