I cannot set a breakpoint on the apkg.py source code of Anki 23.10.1

Hello, Damien
I used to work on ANki 2.1.43 version on my main computer for a long time, as I also have the source code of this version downloaded on this computer, which allows me to study the code accordingly. Recently, due to the corresponding upgrade of the plugin, the version of Anki on this main work computer has been upgraded to Anki 23.10.1, and accordingly, I have also deployed the development environment of this version.

However, I have encountered a very troublesome problem. Previously, in version 2.1.43, I could easily set breakpoints and control when importing apkg files, as shown in Image 1.

But after upgrading to Anki 23.10.1, when importing the same apkg file, I set breakpoints at the same source code location, but the program would not stop running and I could not control its execution, as shown in Image 2.

I have tried setting breakpoints in multiple classes and methods related to anki’s import, but none of them achieved the expected effect. The file directory where my breakpoints are located is shown in Image 3.

I would like to know why this is happening? Could it be that I am setting the breakpoints in the wrong place? In which file and method should I set the breakpoint in order to trace the specific steps and logic of importing the apkg file?

1 Like

The default importer is written in Rust and can not be stepped through with a Python debugger. You’re looking at legacy code that is activated via the legacy import/export feature in the preferences.

1 Like

Alright, thank you for your response. Actually, I only saw your reply today. I was originally waiting for the system to automatically send me an email notification if you responded. I checked my emails for two days but didn’t see any reply from you, and it was only when I went into the forum website that I saw your response. It seems that the new forum doesn’t notify the questioner of new replies via email as it used to. But that’s okay, I’ll just check the forum more often. Anyway, I still want to say thank you very much for your response.

After reading the email and looking at the source code, I now understand the situation. So, now that the desktop version of Anki involves development in both Python and Rust, effectively making it a mix of two languages, what kind of IDE should be used to debug programs developed in both languages simultaneously? Can you recommend one?

Additionally, since Anki is developed in two languages, which parts are developed in Rust and which are developed in Python? How can I find this out? Also, in the case of mixed-language development, how can I set up my own development environment? I hope you can also provide me with some guidance.

It’s strange that the forum did not notify you - maybe the mail landed in your spam folder?

Anki’s development docs can be found in the docs/ folder of the repo, and on https://addon-docs.ankiweb.net/.

allright, this time i received the email about your reply. thank you

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.