Skip to content

Commit

Permalink
Add github action for notebooks (#26)
Browse files Browse the repository at this point in the history
* add github action for notebooks

* update dependencies

* fix notebooks

* fix other issues

* test adding requirement

* fix another bug
  • Loading branch information
nwlandry authored Jan 13, 2025
1 parent a4eee56 commit 44320b6
Show file tree
Hide file tree
Showing 13 changed files with 59,532 additions and 59,536 deletions.
48 changes: 48 additions & 0 deletions .github/workflows/test-notebooks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Test tutorials

on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
tutorials:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.13"

- name: Install packages
run: |
sudo apt-get install -y rename
python -m pip install --upgrade pip wheel setuptools
python -m pip install -r requirements/tutorials.txt
python -m pip list
- name: Prepare notebooks
run: |
# go into tutorial location
cd tutorials
# convert each notebook into a python file
jupyter nbconvert --to script *.ipynb
# rename the files so they are found by pytest: add 'test' at the beginning
rename 's/(.*)\.py/test $1.py/' *
# rename the files so they are found by pytest: change spaces to underscores
rename 's/ /_/g' test*
# modify each file by adding one level of indentation to each line
sed -i 's/^/ /' test*.py
# modify each file by adding 'def test_func():' at the top
sed -i '1s;^;def test_func():\n;' test*.py
- name: Test tutorial notebooks
run: |
# run pytest ONLY on the tutorials
cd tutorials
pytest --color=yes
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
python-version: "3.13"

- name: Install packages
run: |
Expand Down
10 changes: 7 additions & 3 deletions requirements/tutorials.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
HypergraphAnalysisToolbox
hypergraphx
hypernetx
hypernetx>=2.3.10
networkx
xgi
requests
xgi>=0.9.1
requests
jupyter>=1.0
ipython<=8.12.0
nx_hif
rich
2 changes: 1 addition & 1 deletion tutorials/data/contacts_high_school.hif.json

Large diffs are not rendered by default.

Loading

0 comments on commit 44320b6

Please sign in to comment.