Notebook Style¶
How to clean up a notebook for us to feature:
Make sure that the notebook meets a high standard in general:
high-quality code
illuminating data analysis
clear communication of what you’re doing and your findings
as short as possible, but no shorter
this random style guide I found in a few minutes of Googling seems good, but it’s not our official style guide or anything
Do the following specific things to clean up:
as much as possible, avoid showing extraneous output from cells
you can use the
%%capture
magic to suppress all output from a cell (helpful if a function in the cell prints something)you can add a
;
at the end of the last line in a cell to suppress printing the return value of the linethink about what cells the reader really needs to see vs. which ones just have to be there for setup or whatnot. Collapse the latter.
use the latest version of
ergo
make sure that any secrets like passwords are removed from the notebook
Pull out any code not central to the main point of the model into a module in
ergo/contrib/
. See Notebook contrib folder for details.
The featured notebooks in our README should be exemplars of the above, so refer to those to see what this looks like in practice.