anki
Python library for Anki, the spaced repetition flashcard program
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 ankiuv
uv add ankipoetry
poetry add ankiInstalling 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
More Application Frameworks packages
FastAPI is a Python web framework for building…
permissive · top 100 on PyPI
annotated-docProvides a way to document function parameters,…
permissive · top 100 on PyPI
textualTextual is a Python framework for building…
permissive · top 100 on PyPI
typerTyper builds command-line applications from…
permissive · top 1,000 on PyPI
mcpBuild and connect to Model Context Protocol…
permissive · top 1,000 on PyPI
WerkzeugWerkzeug is a WSGI utility library providing…
permissive · top 1,000 on PyPI
aqtaqt is the Qt-based desktop GUI for Anki, the…
agpl · top 15,000 on PyPI
fsrsImplements the Free Spaced Repetition Scheduler…
permissive · top 15,000 on PyPI
genankiGenerates Anki flashcard decks programmatically…
permissive · top 15,000 on PyPI
browser-use-coreProvides packaged Rust terminal binaries and…
unclear · top 15,000 on PyPI
anchorpy-coreProvides Python bindings to Anchor Rust code,…
permissive · top 15,000 on PyPI
scheduleSchedule provides a human-friendly API for…
permissive · top 5,000 on PyPI
APSchedulerAPScheduler lets you schedule Python code to…
permissive · top 1,000 on PyPI
Flask-APSchedulerFlask-APScheduler integrates APScheduler with…
permissive · top 15,000 on PyPI
flpcflpc wraps the Rust regex crate to provide…
permissive · top 5,000 on PyPI
aiorecollectAsyncio-based Python library for querying waste…
permissive · top 15,000 on PyPI