forked from stellargraph/stellargraph
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add fixed IDs to each notebook cell (stellargraph#1842)
nbformat recently released 5.1.0, which includes randomly generated cell IDs in every cell: https://nbformat.readthedocs.io/en/latest/changelog.html#id2 > - Implemented CellIds from > [JEP-62](https://github.com/jupyter/enhancement-proposals/blob/master/62-cell-id/cell-id.md) This thus requires us to update our notebooks, or else our CI validation of their formatting fails (https://github.com/stellargraph/stellargraph/runs/1699039930?check_suite_focus=true). Using the default mode doesn't work, because they seem to be randomly generated on every run (even after saving them once), and thus the 'formatting' changes each time `format_notebook.py` is run. This PR thus implements a basic hashing scheme to give fixed IDs for a cell: - hash the cell's source code with SHA256 and use the first 8 hex digits (e.g. `abcd1234`) - add a counter if this is not the first cell with the given source code in the notebook (e.g. `abcd1234-1`) This is idempotent: reformatting a notebook without changes will give the same result. Thus, it can be easily used as a check on CI.
- Loading branch information
Showing
57 changed files
with
3,072 additions
and
0 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.