-
Notifications
You must be signed in to change notification settings - Fork 37
How to: prepare notebooks so that all checks pass
Ludovico Bianchi edited this page Jul 12, 2022
·
3 revisions
- Use absolute import paths when importing Python modules located in the
dispatches
package. This includes Python files located in the same directory as the notebook file
Code cells should be skipped if any of the following is true:
- The cell takes a long time to run (more than 5-10 minutes)
- The cell requires particular solvers, executables, etc that are not available in the CI environment
- e.g. the
gurobi
solver is typically not available
- e.g. the
- The cell depends on previous cells that have also been skipped
- e.g. if a cell contains code to generate a plot, which depends on a data file that would be generated in a skipped cell
Code cells will be skipped in CI if the cell has a cell tag named nbval-skip
. Refer to the How to: add a tag to a notebook cell page in this wiki.
- Remove empty cells
- Ensure notebook starts with Markdown (text) cell containing a level 1 header/title (i.e. if the title of the notebook is "My notebook", the first line of the Markdown source is
# My notebook
) - Ensure all cells of the notebook have been run in order without errors. To do so from the Jupyter notebook interface, select
Kernel > Restart and run all