I wanted to share with you an extension to nbdev that I have been developing. It allows to export designated cells in a notebook to a separate test module, wrapping the code in those cells as functions that can be consumed by pytest and other test engines. This is done by introducing new directives
#| test, and optionally
#| import and
#| data. Please check a complete explanation of the mechanism and usage here:
In addition to that, it also allows to freeze the test cells so that we avoid running them when running the cells of the notebook. This is done while preserving the original output of those cells, so we can visually see what each cell was doing. All of this is explained in the above link, and it is part of a broader library I’m developing, please check the complete library here:
I use it everyday at work, so I am continuously improving it. I am also in the process of documenting this library, but if you find it useful I can prioritize documenting specific pieces that are required.
Thanks for all the great work.