Advice for incrementally building a big class in nbdev

So I’m using nbdev to incrementally build a class that is pretty big (several hundred lines), and its kinda painful to have to scroll up, change code, run cell, and then back down in my notebook again and again as I get things working.

Wondering if folks facing a similar scenario have figured out a way to make development a bit less painful. One idea I had is to have one notebook dedicated to just the class and a separate notebook, with autoreloading enabled, for iteratively building/testing code experimentally as I usually do with Jupyter.

Thoughts? Ideas?

Thanks - wg

That’s what patch is for https://fastcore.fast.ai/basics.html#patch

Jeremy and I use it often for this purpose.

1 Like

Yah okay thanks.

Curious to hear how, for example, the Learner class was built out … its pretty big and everything is in one cell (with patch being used to build it out even further). Perhaps, it just feels more right being able to look at a class and see its entire interface in there without having to scroll through the notebook … maybe I’m just old school.

You can look at the source code and see

1 Like