Announcing lib2nbdev, a one-stop-shop for converting non-nbdev libraries to nbdev

Have you ever wanted to use nbdev on your existing libraries? Normally you need to rebuild from the ground up, copy all the source code to notebooks, add tags, etc etc. lib2nbdev aims to fix that!

What does it do?

Through a simple CLI, you will generate nbdev’s settings.ini file, and then your entire library will be converted into an nbdev one, with the proper tags, notebooks generated into a nbs folder (or any you specify), and optionally you can include the GH CI that nbdev utilizes as well.

It is quite literally as simple as:

  1. pip install lib2nbdev
  2. %cd into your root directory of the repository
  3. convert_lib

And you are done! No headache, no needing to go and modify any files, everything is automatically done for you. Even private and public functions are given the right declarations:

The last and final step you need to do is go and make titles and descriptions on your notebooks (as of course I can’t figure that out for you :wink: )

I hope people find this tool valuable for trying to bring nbdev into their organizations or existing projects.

Feel free to use this thread for questions or debugging help :slight_smile:

The documentation is available here:

And the source code as well:

VERY big thank you to @jeremy, @sgugger, and @hamelsmu for not only helping me with answering all my various nbdev questions, but also for releasing nbdev in the first place. It’s a magical software :slight_smile:

6 Likes