How to run Anki source codes .py from VScode?

Viewed 31

sorry I am a new developer, and new to Anki development, I am trying to figure out the source code from \pylib\anki, and when I run the source code for example collection.py, it shows this error when I run(from original code: from anki import ( card_rendering_pb2, collection_pb2, config_pb2, generic_pb2, import_export_pb2, links_pb2, search_pb2, stats_pb2, ))

Anki collection.py

1

could anyone tell me how should I solve this issue? I also try to set up Ubuntu to change the environment configuration. thank you so much. I find the Anki development manual confusing and can't figure out how I should set up VScode for the Anki environment.

1 Answers

You have to install aqt, through pip for example: pip3 install aqt[qt6]. The whole setup is explained in the manual.


Incidentally, you might want to read the section on ProtoBuf in the architecture description of Anki, where it explicitly says

At the moment, the protobuf is not considered public API. Some pylib methods expose a protobuf object directly to callers, but when they do so, they use a type alias, so callers outside pylib should never need to import a generated _pb2.py file.

Related