Convert jupyter notebook to anki cards?

Is there tool or snippet of code that could convert Juyiter notebook to Anki cards ?

1 Like

I did not try it yet. It is late for tonight but it seems there is a way, haha
Covert notebook to google sheet and then google sheet to Anki
I will try and report here.

In the APL category @Ezno built something to do that.

1 Like

Check out the " Cards from study group NB" section in this notebook for starter code on converting the notebooks to cards.

The Header Cells Section works pretty well. The Code Cells exports all the code cells into cards properly, but the output needs to be post processed to remove some cells we don’t really need cards for. That could either be done afterward, or quite possibly add tag or some way in the notebook to say whether to export them or not.

I am not completely sure when/if I will get to making that deck solid. Feel free to take a look at what i’ve done and make something better! I think lots of people would find it helpful :slight_smile:

As a side note on how to automate the code cell cleanup for the future, I’ve been considering a couple ideas. I’ve been thinking about adding tags to code cells, but also about about an nbdev style #| anki directive. I think an #| anki nbdev directive could be neat for this project, but also other libraries, and also there could be some neat applications with educational blogs. If you could just tag pieces of your code/tests as you develop a blog post or a library that’d make good anki cards it could be a cool onboarding piece of documentation. This is just a thought in my head at this point - I have not spoken to jeremy or anyone else about the idea and I have no idea what would need to be done to implement. Possibly code an extension to nbdev or something as I am not sure if it fits into nbdev proper or not.

3 Likes

@Ezno I saw your notebook. It is awesome as is and thanks for making it. As you mentioned it has room for education proposes. Notebooks support way more language than few years ago. I was even thinking Making a website so people could upload a notebook and get Anki flashcard back. For now I need to go through live coding and data science book(wanted use flashcard for that book) that Jeremy mentioned. When/if I try to improve or make a UI for your notebook I will definitely get it touch with you since you did all the hard part.