Skip to main content

fabricatio-anki

MIT Python Versions PyPI Version PyPI Downloads PyPI Downloads Build Tool: uv

AI-powered Anki flashcard deck generation and compilation for the Fabricatio framework. Uses LLM-driven templates to produce card layouts, model definitions, and topic analyses, then compiles them into .apkg files compatible with Anki 2.1+.

Installation

pip install fabricatio[anki]
# or
uv pip install fabricatio[anki]

For the full Fabricatio suite:

pip install fabricatio[full]

Overview

The package splits into two layers:

  • Rust (fabricatio_anki.rust) — fast filesystem operations for project scaffolding, template serialization, and deck compilation via deck_loader.
  • Python (fabricatio_anki) — LLM-driven generation of deck metadata, card models, HTML/JS/CSS templates, and topic analyses, integrated with Fabricatio's Propose capability system.

Project Structure

A deck project created by create_deck_project follows this layout:

deck_project/
├── deck.yaml           # Deck metadata (name, description, author)
├── models/             # One subdirectory per note type
│   └── basic_card/
│       ├── fields.yaml # Field definitions (e.g. Front, Back)
│       └── templates/  # One subdirectory per card template
│           └── card/
│               ├── front.html
│               ├── back.html
│               └── style.css
├── data/               # CSV files with card content
│   └── basic_card.csv
└── media/              # Global images, audio, etc.

Rust Functions (fabricatio_anki.rust)

| Function | Description | :|---|---| | compile_deck(path, output) | Compile a deck project into an .apkg file. | | create_deck_project(path, deck_name?, description?, author?, model_name?, fields?) | Scaffold a new deck project with sample templates and data. | | save_metadata(dir_path, name, data) | Write a Python dict as YAML into a project directory. | | add_csv_data(project_path, model_name, data_path) | Copy a CSV file into the project's data/ directory. | | save_template(dir_path, front, back, css?) | Write front.html, back.html, and optional style.css for a card template. | | extract_html_component(html) | Parse an HTML string into (layout, js, css) by separating <script> and <style> content. | | extract_content_by_tag(html, tag) | Extract inner text from all occurrences of a given HTML tag. |

Python Models

Model Description
Template Card template with front and back Side objects (each containing layout, js, css).
Side One face of a card — HTML layout, JavaScript, and CSS.
Model Note type with a name, field list, and list of Templates.
Deck Full deck with metadata, author, and list of Models.
ModelMetaData Patch class carrying deck-level metadata (name, description, author).
TopicAnalysis Analysis of a topic: difficulty coefficient, subjects, detailed solution, key points, summary.

Python Capabilities

GenerateDeck

LLM-driven deck generation. Extends Propose. Key methods:

Method Description
generate_deck(requirement, fields, …) Generate a complete Deck from a natural-language requirement.
generate_model(fields, requirement, …) Generate Model(s) with auto-named templates.
generate_template(fields, requirement, …) Generate Template(s) with front/back HTML, JS, and CSS.
generate_front_side(fields, requirement, …) Generate front-side Side objects.
generate_back_side(fields, requirement, …) Generate back-side Side objects.

Accepts a single requirement string or a list for batch generation. All methods pass through Fabricatio's validation system.

GenerateAnalysis

Generates structured TopicAnalysis objects from topic strings.

Method Description
generate_analysis(topic, …) Produce TopicAnalysis for one or more topics.

AppendTopicAnalysis

An Action that reads a CSV file, runs generate_analysis on each row, and appends a "Topic Analysis" column.

from fabricatio_anki.actions.topic_analysis import AppendTopicAnalysis

action = AppendTopicAnalysis(
    csv_file="questions.csv",
    output_file="questions_with_analysis.csv",
)
result = await action.execute()

Configuration

All options below are read through the fabricatio configuration chain (see the Configuration Guide). Set them under the [ext.anki] table in fabricatio.toml, equivalently under [tool.fabricatio.ext.anki] in pyproject.toml, or via FABRICATIO_EXT__ANKI__<FIELD_UPPER> environment variables.

[ext.anki]
generate_anki_card_front_side_template = "built-in/generate_anki_card_front_side"
Option Type Default Description
generate_anki_card_front_side_template str "built-in/generate_anki_card_front_side" The template name used for generating the front side of Anki cards.
generate_anki_card_back_side_template str "built-in/generate_anki_card_back_side" The template name used for generating the back side of Anki cards.
generate_anki_card_template_template str "built-in/generate_anki_card_template" The template name used for generating Anki card types.
generate_anki_model_name_template str "built-in/generate_anki_model_name" The template name used for generating Anki model names.
generate_anki_card_template_generation_requirements_template str "built-in/generate_anki_card_template_generation_requirements" The template name used for generating Anki card template generation requirements.
generate_anki_deck_metadata_template str "built-in/generate_anki_deck_metadata" The template name used for generating Anki deck metadata.
generate_anki_model_generation_requirements_template str "built-in/generate_anki_model_generation_requirements" The template name used for generating Anki model generation requirements.
topic_analysis_assemble_template str "built-in/topic_analysis_assemble" The template name used for assembling topic analysis.
generate_topic_analysis_template str "built-in/generate_topic_analysis" The template name used for generating analysis.

Access at runtime: from fabricatio_anki.config import anki_config.

Usage Example

from fabricatio_anki.rust import create_deck_project, compile_deck, add_csv_data
from pathlib import Path

# 1. Scaffold a project
create_deck_project(
    Path("./my_deck"),
    deck_name="French Vocabulary",
    description="Essential French words for beginners",
    author="Language Team",
    model_name="french_vocab",
    fields=["French", "English", "Pronunciation", "Example"],
)

# 2. Add your CSV data
add_csv_data(Path("./my_deck"), "french_vocab", Path("./words.csv"))

# 3. Compile to .apkg
compile_deck(Path("./my_deck"), Path("./french_vocab.apkg"))

For LLM-driven generation via GenerateDeck:

from fabricatio_anki.capabilities.generate_deck import GenerateDeck

gen = GenerateDeck()
deck = await gen.generate_deck(
    "Create a deck for learning Japanese JLPT N5 vocabulary",
    fields=["Kanji", "Reading", "Meaning", "Example Sentence"],
)
# deck is a Deck with auto-generated models and templates

Dependencies

  • fabricatio-core — core interfaces and utilities
  • fabricatio-capabilities — capability framework (Propose)
  • deck_loader (Rust) — Anki deck serialization and project management

License

MIT — see LICENSE

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

fabricatio_anki-0.2.17-cp314-cp314-win_amd64.whl (6.5 MB view details)

Uploaded CPython 3.14Windows x86-64

fabricatio_anki-0.2.17-cp314-cp314-manylinux_2_34_x86_64.whl (7.3 MB view details)

Uploaded CPython 3.14manylinux: glibc 2.34+ x86-64

fabricatio_anki-0.2.17-cp314-cp314-manylinux_2_34_aarch64.whl (6.7 MB view details)

Uploaded CPython 3.14manylinux: glibc 2.34+ ARM64

fabricatio_anki-0.2.17-cp313-cp313-win_amd64.whl (6.5 MB view details)

Uploaded CPython 3.13Windows x86-64

fabricatio_anki-0.2.17-cp313-cp313-manylinux_2_34_x86_64.whl (7.3 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.34+ x86-64

fabricatio_anki-0.2.17-cp313-cp313-manylinux_2_34_aarch64.whl (6.7 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.34+ ARM64

fabricatio_anki-0.2.17-cp312-cp312-win_amd64.whl (6.5 MB view details)

Uploaded CPython 3.12Windows x86-64

fabricatio_anki-0.2.17-cp312-cp312-manylinux_2_34_x86_64.whl (7.3 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.34+ x86-64

fabricatio_anki-0.2.17-cp312-cp312-manylinux_2_34_aarch64.whl (6.7 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.34+ ARM64

File details

Details for the file fabricatio_anki-0.2.17-cp314-cp314-win_amd64.whl.

File metadata

  • Download URL: fabricatio_anki-0.2.17-cp314-cp314-win_amd64.whl
  • Upload date:
  • Size: 6.5 MB
  • Tags: CPython 3.14, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for fabricatio_anki-0.2.17-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 829a039e99bcb6fda8aef527aa24c30c537f946f6ca292cab05ba5a73b3653de
MD5 2b405e6570a4d0b4dda40fa080b23c12
BLAKE2b-256 1fa88f47c4c629b99d62bb319379ecc2ad4f1dc3c4db72791e9041444b93843b

See more details on using hashes here.

File details

Details for the file fabricatio_anki-0.2.17-cp314-cp314-manylinux_2_34_x86_64.whl.

File metadata

  • Download URL: fabricatio_anki-0.2.17-cp314-cp314-manylinux_2_34_x86_64.whl
  • Upload date:
  • Size: 7.3 MB
  • Tags: CPython 3.14, manylinux: glibc 2.34+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for fabricatio_anki-0.2.17-cp314-cp314-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 7956d50efc291e464d6bd9d2e003ee4130374779a738e1544aa3e589630b7bef
MD5 f3d5b34bddb6029d164c8418d3a530c8
BLAKE2b-256 476f1442ebcf0d2990a04b52b3569bc43b353acad3ef9da50a5284e740e79f82

See more details on using hashes here.

File details

Details for the file fabricatio_anki-0.2.17-cp314-cp314-manylinux_2_34_aarch64.whl.

File metadata

  • Download URL: fabricatio_anki-0.2.17-cp314-cp314-manylinux_2_34_aarch64.whl
  • Upload date:
  • Size: 6.7 MB
  • Tags: CPython 3.14, manylinux: glibc 2.34+ ARM64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for fabricatio_anki-0.2.17-cp314-cp314-manylinux_2_34_aarch64.whl
Algorithm Hash digest
SHA256 bd6ae628964a7607dd457816a72bc36082240fa3a5751b4d8cabe2678a405938
MD5 e987ed9aaf39088ff43339bfe5f1ec91
BLAKE2b-256 1bd2b885053c43129c00893e75aab8c283a2f06eda768190f837621a33699aa5

See more details on using hashes here.

File details

Details for the file fabricatio_anki-0.2.17-cp313-cp313-win_amd64.whl.

File metadata

  • Download URL: fabricatio_anki-0.2.17-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 6.5 MB
  • Tags: CPython 3.13, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for fabricatio_anki-0.2.17-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 2091700c861ceb3fd90082a31d80bd31125286e2ee5de156e8fb606fa165eff9
MD5 deb02a317b1181dec3420eb7921c13b8
BLAKE2b-256 99405db0eba961ed54045d1914920a2e858323fc4cc8e3b2767ffd9eae9e3cd1

See more details on using hashes here.

File details

Details for the file fabricatio_anki-0.2.17-cp313-cp313-manylinux_2_34_x86_64.whl.

File metadata

  • Download URL: fabricatio_anki-0.2.17-cp313-cp313-manylinux_2_34_x86_64.whl
  • Upload date:
  • Size: 7.3 MB
  • Tags: CPython 3.13, manylinux: glibc 2.34+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for fabricatio_anki-0.2.17-cp313-cp313-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 4f0e7cc023f24aa74c4b9d2a450d589c8a25b31205b6dc8d1efd8c787f4653f4
MD5 5ef3df0b825239095ed00140d49ac908
BLAKE2b-256 d541ece39b27654ff5e4a26ef53072c8a3127cfc3fbaa9c185689b83eff880d3

See more details on using hashes here.

File details

Details for the file fabricatio_anki-0.2.17-cp313-cp313-manylinux_2_34_aarch64.whl.

File metadata

  • Download URL: fabricatio_anki-0.2.17-cp313-cp313-manylinux_2_34_aarch64.whl
  • Upload date:
  • Size: 6.7 MB
  • Tags: CPython 3.13, manylinux: glibc 2.34+ ARM64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for fabricatio_anki-0.2.17-cp313-cp313-manylinux_2_34_aarch64.whl
Algorithm Hash digest
SHA256 180fe653a84364b6f5cc8e94c6ae0071ce968f499623545c0b9e93167cf509a4
MD5 11eacfdbec8e0345cdc41e4366705b9b
BLAKE2b-256 40dd95663dbcd249990a581c3b25d850821df6ef43277819b46a12bc82328f45

See more details on using hashes here.

File details

Details for the file fabricatio_anki-0.2.17-cp312-cp312-win_amd64.whl.

File metadata

  • Download URL: fabricatio_anki-0.2.17-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 6.5 MB
  • Tags: CPython 3.12, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for fabricatio_anki-0.2.17-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 e25caa34d198a7bc5358ebca5c060b15467ad03a3747afe16c252f84a113dfab
MD5 f435643550460cfd510ef1f6337b3972
BLAKE2b-256 6e08cd76958c24829d005f34da50fa4fd8cdfec5b7da1d8e87ba108b126336f8

See more details on using hashes here.

File details

Details for the file fabricatio_anki-0.2.17-cp312-cp312-manylinux_2_34_x86_64.whl.

File metadata

  • Download URL: fabricatio_anki-0.2.17-cp312-cp312-manylinux_2_34_x86_64.whl
  • Upload date:
  • Size: 7.3 MB
  • Tags: CPython 3.12, manylinux: glibc 2.34+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for fabricatio_anki-0.2.17-cp312-cp312-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 1738c198719e3dece5de26fca0279953420a9e395f1d67bf8949c6e5ac2a6c0c
MD5 f81358c18dc1531dcfc1c832427a99c2
BLAKE2b-256 d92da8b494b1a7fe44eb7054e7b6c284b11ac3ce0f0cec029f86c3c964e38163

See more details on using hashes here.

File details

Details for the file fabricatio_anki-0.2.17-cp312-cp312-manylinux_2_34_aarch64.whl.

File metadata

  • Download URL: fabricatio_anki-0.2.17-cp312-cp312-manylinux_2_34_aarch64.whl
  • Upload date:
  • Size: 6.7 MB
  • Tags: CPython 3.12, manylinux: glibc 2.34+ ARM64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for fabricatio_anki-0.2.17-cp312-cp312-manylinux_2_34_aarch64.whl
Algorithm Hash digest
SHA256 46fbd4bfe17c357b9929c56741fc2a5b9a7d59fdc816018eba32b0944df460df
MD5 4132df0b6cd506cbf8285fcb10da0faf
BLAKE2b-256 22f57069d2b19916e3dcc5bf97c14d3dfb3e150dfe9881b8afd5b9123153be88

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.2.17 This release

9 files

0.2.16

9 files

0.2.14

9 files

0.2.13

12 files

0.2.12

12 files

0.2.11

12 files

0.2.10

12 files

0.2.9

12 files

0.2.8

8 files

0.2.7

8 files

0.2.6

8 files

0.2.5

8 files

0.2.4

8 files

0.2.3

8 files

0.2.1

8 files

0.2.0

8 files

0.1.4

8 files

0.1.3

4 files

0.1.2

4 files

0.1.1

4 files

0.1.0

4 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page