skillfed

anki

Python library for Anki, the spaced repetition flashcard program

anki v26.8.1 276.3K downloads/30d#8,165 on PyPI29,756
AGPL license AGPL-3.0-or-later Active released

What it is and what it does

Anki is a Python library that exposes the core scheduling and database engine behind Anki, the popular spaced-repetition flashcard application. It wraps a Rust backend (rslib) and provides a programmatic interface to collections, notes, cards, decks, scheduling algorithms (FSRS/SM-2), media management, import/export, and synchronisation with AnkiWeb. The library is primarily used by Anki add-on developers and anyone building automation or custom workflows around flashcard learning.

The package depends on seven runtime libraries: decorator, distro, markdown, orjson, protobuf, requests, and typing-extensions. It requires Python 3.10 or later and ships as platform-specific compiled wheels (macOS ARM64/x86-64, Linux aarch64/x86-64, Windows amd64/ARM64). Installation has medium friction due to these compiled dependencies, but the project is actively maintained with a large, engaged community.

Use it for:

  • Build Anki add-ons that extend the desktop application with custom scheduling, UI, or data-processing features.
  • Automate flashcard generation and bulk import from external data sources into Anki collections.
  • Create custom spaced-repetition learning applications that leverage Anki's scheduling algorithms.
  • Programmatically query and analyse learning statistics from existing Anki collections.
  • Synchronise flashcard data between Anki and external learning platforms or databases.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Provides Python access to Anki's core spaced-repetition engine, wrapping the Rust backend to let you programmatically open, query, and modify flashcard collections, schedules, and media.

Yes, if you are building Anki add-ons, automating flashcard workflows, or need programmatic access to spaced-repetition scheduling. The library is actively maintained, well-established (29756 stars), and has no known vulnerabilities. The AGPL-3.0-or-later license requires that derivative works be open-source; verify this aligns with your project before use. Medium install friction (compiled wheels, Python 3.10+ required) is a minor trade-off for core functionality.

Install

anki on PyPI

pip

pip install anki

uv

uv add anki

poetry

poetry add anki

Installing anki

Before you install

Medium install friction due to compiled wheels (abi3, platform-specific); active maintenance with recent release (9 days old) and strong repository signals (29756 stars, last commit 2026-08-14). Requires Python 3.10+.

License in practice

AGPL-3.0-or-later: derivative works and modifications must be released under AGPL. Suitable for open-source projects and add-ons; proprietary applications using this library must comply with copyleft obligations or seek alternative licensing.

Quickstart

pip install anki

from anki import Collection

col = Collection('/path/to/collection.anki2')
notes = col.find_notes('deck:Default')
print(len(notes))

Requires Python 3.10 or later; platform-specific compiled wheels (macOS, Linux, Windows); Anki collection file path must exist and be readable.

Verify before relying

  • Whether the Rust backend is bundled in the wheel or requires separate installation.
  • Performance characteristics when working with large collections (thousands of cards).
  • Stability guarantees for the Python API across minor version updates.

Package facts

License AGPL-3.0-or-later (agpl)
Python support supports the current Python release (>=3.10)
Install friction medium — platform-specific wheel
Runtime dependencies 7 — decorator, distro, markdown, orjson, protobuf, requests, typing-extensions
Maintenance actively maintained — 9 days since the last release
Last repo commit
First released
Downloads 276,344/month — #8,165 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: anki-26.8.1-cp310-abi3-macosx_12_0_arm64.whl; anki-26.8.1-cp310-abi3-macosx_12_0_x86_64.whl; anki-26.8.1-cp310-abi3-manylinux_2_35_aarch64.whl; anki-26.8.1-cp310-abi3-manylinux_2_35_x86_64.whl; anki-26.8.1-cp310-abi3-win_amd64.whl; anki-26.8.1-cp310-abi3-win_arm64.whl

Tags

anki flashcard apispaced repetition pythonanki collection libraryflashcard scheduling algorithmanki add-on developmentanki database accessmemory learning automation
spaced-repetitionflashcard-engineadd-on-development

More Application Frameworks packages