This GitHub action enforces rules on certain cells and metadata in Jupyter Notebooks.
Because Jupyter notebooks contain metadata such as outputs and execution_count, they do not lend themselves well to versioning unless the unnecessary information has first been removed.
This GitHub action can ensure that CI tests fail unless Jupyter notebooks have been appropriately linted prior to being pushed to the repository.
Add the following step to your GitHub action:
- uses: ResearchSoftwareActions/EnsureCleanNotebooksAction@1.1All of the following are checked by default:
The Jupyter outputs field is a list of outputs from each cell.
These can include binary data.
By default the action will fail if outputs is not an empty list ([]).
The Jupyter execution_count field is an integer counting the number of cell executions.
By default the action will fail if execution_count is not null.
This action takes one optional argument (disable-checks) that specifies which checks, supplied as a comma separated list, should be disabled.
The full list of checks are:
outputsdisable checks relating to cell outputsexecution_countdisable checks relating to execution count
- uses: ResearchSoftwareActions/EnsureCleanNotebooksAction@1.1
with:
disable-checks: outputs,execution_count