Skip to content

Commit

Permalink
gh-365: upload HTML rendering of notebooks as artifact
Browse files Browse the repository at this point in the history
  • Loading branch information
Saransh-cpp committed Oct 18, 2024
1 parent e797fe6 commit 614f214
Show file tree
Hide file tree
Showing 10 changed files with 165 additions and 263 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/examples.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,9 @@ jobs:
run: pip install nox
- name: Run examples
run: nox -s examples
- name: Generate HTML
run: nox -s examples -- html
- uses: actions/upload-artifact@v4
with:
name: Examples
path: examples/**/*.html
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ dist
.env
.coverage*
coverage*
examples/**/*.html
50 changes: 15 additions & 35 deletions examples/1-basic/density.ipynb

Large diffs are not rendered by default.

57 changes: 17 additions & 40 deletions examples/1-basic/lensing.ipynb

Large diffs are not rendered by default.

29 changes: 9 additions & 20 deletions examples/1-basic/matter.ipynb

Large diffs are not rendered by default.

81 changes: 37 additions & 44 deletions examples/1-basic/photoz.ipynb

Large diffs are not rendered by default.

35 changes: 10 additions & 25 deletions examples/1-basic/shells.ipynb

Large diffs are not rendered by default.

68 changes: 27 additions & 41 deletions examples/2-advanced/cosmic_shear.ipynb

Large diffs are not rendered by default.

77 changes: 23 additions & 54 deletions examples/2-advanced/stage_4_galaxies.ipynb

Large diffs are not rendered by default.

24 changes: 20 additions & 4 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,27 @@ def doctests(session: nox.Session) -> None:

@nox.session
def examples(session: nox.Session) -> None:
"""Run the example notebooks."""
"""Run the example notebooks. Pass "html" to build html."""
session.install("-e", ".[examples]")
session.run(
"jupyter", "execute", *Path().glob("examples/**/*.ipynb"), *session.posargs
)

if session.posargs:
if "html" in session.posargs:
print("Generating HTML for the example notebooks")
session.run(
"jupyter",
"nbconvert",
"--to",
"html",
"--embed-images",
"--execute",
"examples/**/*.ipynb",
)
else:
print("Unsupported argument to examples")
else:
session.run(
"jupyter", "execute", *Path().glob("examples/**/*.ipynb"), *session.posargs
)


@nox.session
Expand Down

0 comments on commit 614f214

Please sign in to comment.