Skip to content
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

gh-365: upload HTML rendering of notebooks as artifact #367

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Comment on lines 46 to +53
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this now executes all of the examples twice: once with jupyter execute examples/**/*.ipynb and once with jupyter nbconvert --execute. You could either remove the first step, or I believe you can remove --execute from the second step.

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.

22 changes: 18 additions & 4 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,25 @@ 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"))


@nox.session
Expand Down