kerrickstaley / genanki

A Python 3 library for generating Anki decks
MIT License
1.99k stars 150 forks source link

How does this compare to the official anki library? #83

Closed bmaupin closed 3 years ago

bmaupin commented 3 years ago

Since this project doesn't have the GitHub Discussions feature enabled, I thought I'd ask my question here.

The official Anki application is open-source and has classes for importing (https://github.com/ankitects/anki/tree/main/pylib/anki/importing) and exporting (https://github.com/ankitects/anki/blob/main/pylib/anki/exporting.py).

How does this compare? Are there any pros/cons for using one over the other?

From what I can see, genanki seems to have a more permissive licence and the API is documented. On the other hand, I would be concerned that since it's not an official library that the apkg files it generates could have compatibility issues with the official Anki applications.

Thanks!

bmaupin commented 3 years ago

I dug into this a bit myself, and my conclusion is more or less the same as I originally suspected.

This package has a more permissive license than the official Anki API, and also seems to have a cleaner API that is more clearly documented. The code in this project also seems to be cleaner and easier to read than the official Anki python code.

The official Anki python API is documented here, but the documentation isn't comprehensive: https://addon-docs.ankiweb.net/getting-started.html

I've also documented it a little bit myself: https://github.com/bmaupin/flashcard-sets/tree/main/scripts#anki-api

I think the biggest advantage of using the official Anki API is that there would be a better guarantee that the Anki package (.apkg) file generated would be compatible with Anki.

In the end I'm guessing either option is probably a reasonable choice.

Thanks!