Introduction

This is my work product submission for the Google Summer of Code 2020 project on testbook. I had an amazing time working with my mentor Matthew Seal. I would like to thank him for guiding me in every step of the way.

Testbook is a unit testing framework for testing code in Jupyter Notebooks. With testbook, you can now write pytest style unit tests for notebooks, in separate .py files. Testbook can now help you write maintainable and reliable Jupyter Notebooks.

What work was done

Testbook was built from scratch with the help of existing libraries such as nbclient and nbformat. We have done 6 releases of testbook so far and at the time of writing this report, we are currently at version 0.2.2.

All deliverables in the proposal have been fulfilled.

Features Added

  • Execute all or some specific cells before unit test
  • Share kernel context across multiple tests (using pytest fixtures)
  • Support for patching objects
  • Inject code into Jupyter notebooks

Technical Talks

SciPy 2020 Lightning Talks

I delivered a lightning talk at SciPy 2020 where I talked about testbook. The video can be found here and the slides that were presented can be found here.

PyCon India 2020

Matthew and I have jointly submitted a talk proposal about testbook to PyCon India 2020. We are yet to hear from the PyCon India team about talk acceptances, we are anxiously waiting!

The talk proposal can be found here.

What’s next

Here is what is in store for future releases of testbook

Conclusion and Acknowledgement

I would like to thank the team at National Solar Observatory, Colorado, USA for considering use of testbook. I would also like to thank the team at Mindtree, Bangalore, India for providing critical feedback.

I really hope that more and more organizations embrace unit testing for Jupyter Notebooks. We have already seen a few open source projects investigating the use of testbook and we would love to see more of that.

I’m extremely glad that I got this opportunity to create and design a new open source project. I would like to thank nteract, NumFOCUS and Google for this opportunity.