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

Metadata

Release files for fabricatio-anki 0.2.18

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distributions (wheels)

Table of built distributions (wheels) for fabricatio-anki 0.2.18
File Actions
fabricatio_anki-0.2.18-cp314-cp314-win_amd64.whl CPython 3.14 CPython 3.14 Windows x86-64 Details for fabricatio_anki-0.2.18-cp314-cp314-win_amd64.whl
fabricatio_anki-0.2.18-cp314-cp314-manylinux_2_34_x86_64.whl CPython 3.14 CPython 3.14 Linux glibc 2.34+ x86-64 Details for fabricatio_anki-0.2.18-cp314-cp314-manylinux_2_34_x86_64.whl
fabricatio_anki-0.2.18-cp314-cp314-manylinux_2_34_aarch64.whl CPython 3.14 CPython 3.14 Linux glibc 2.34+ ARM64 Details for fabricatio_anki-0.2.18-cp314-cp314-manylinux_2_34_aarch64.whl
fabricatio_anki-0.2.18-cp313-cp313-win_amd64.whl CPython 3.13 CPython 3.13 Windows x86-64 Details for fabricatio_anki-0.2.18-cp313-cp313-win_amd64.whl
fabricatio_anki-0.2.18-cp313-cp313-manylinux_2_34_x86_64.whl CPython 3.13 CPython 3.13 Linux glibc 2.34+ x86-64 Details for fabricatio_anki-0.2.18-cp313-cp313-manylinux_2_34_x86_64.whl
fabricatio_anki-0.2.18-cp313-cp313-manylinux_2_34_aarch64.whl CPython 3.13 CPython 3.13 Linux glibc 2.34+ ARM64 Details for fabricatio_anki-0.2.18-cp313-cp313-manylinux_2_34_aarch64.whl
fabricatio_anki-0.2.18-cp312-cp312-win_amd64.whl CPython 3.12 CPython 3.12 Windows x86-64 Details for fabricatio_anki-0.2.18-cp312-cp312-win_amd64.whl
fabricatio_anki-0.2.18-cp312-cp312-manylinux_2_34_x86_64.whl CPython 3.12 CPython 3.12 Linux glibc 2.34+ x86-64 Details for fabricatio_anki-0.2.18-cp312-cp312-manylinux_2_34_x86_64.whl
fabricatio_anki-0.2.18-cp312-cp312-manylinux_2_34_aarch64.whl CPython 3.12 CPython 3.12 Linux glibc 2.34+ ARM64 Details for fabricatio_anki-0.2.18-cp312-cp312-manylinux_2_34_aarch64.whl

Total release size: 60.7 MB

Release files / fabricatio_anki-0.2.18-cp314-cp314-win_amd64.whl

Download URL fabricatio_anki-0.2.18-cp314-cp314-win_amd64.whl
Size 6.4 MB
Tags CPython 3.14 Windows x86-64
SHA-256 checksum
How to use checksums
2e6a9231c0cde869f983d853e7c0700b146e3260cf7e7070e9e7d4d1ad66766b
BLAKE2b-256 checksum
How to use checksums
d2270b7fee7b69290f3c7b720080f224bab67fa3269578065c5152299e7a5ce7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.9 {"installer":{"name":"uv","version":"0.13.9","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}

Release files / fabricatio_anki-0.2.18-cp314-cp314-manylinux_2_34_x86_64.whl

Download URL fabricatio_anki-0.2.18-cp314-cp314-manylinux_2_34_x86_64.whl
Size 7.2 MB
Tags CPython 3.14 Linux glibc 2.34+ x86-64
SHA-256 checksum
How to use checksums
717c21db12ae1cecf6a7d24169d0baddf05839c7a4cd048c0baca3611b42eacb
BLAKE2b-256 checksum
How to use checksums
fd447e5820f673d10c5e9b40232700fa068f76cecc75917e2e19c0ee0933c974
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.9 {"installer":{"name":"uv","version":"0.13.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / fabricatio_anki-0.2.18-cp314-cp314-manylinux_2_34_aarch64.whl

Download URL fabricatio_anki-0.2.18-cp314-cp314-manylinux_2_34_aarch64.whl
Size 6.7 MB
Tags CPython 3.14 Linux glibc 2.34+ ARM64
SHA-256 checksum
How to use checksums
4ddfb7f7ea8ce2eae138c217631f8f1d13e20b6e0b755e42014f46b73b22d804
BLAKE2b-256 checksum
How to use checksums
0f3b800610d18004af12045be60b45bdb40fb0b5f608fe3bdc7487cc6b7b29a8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.9 {"installer":{"name":"uv","version":"0.13.9","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}

Release files / fabricatio_anki-0.2.18-cp313-cp313-win_amd64.whl

Download URL fabricatio_anki-0.2.18-cp313-cp313-win_amd64.whl
Size 6.4 MB
Tags CPython 3.13 Windows x86-64
SHA-256 checksum
How to use checksums
b91d5c10b8fa7ae78edb7c24d6ac2df126f6cb0e2b4f6a1f33cefdd030182162
BLAKE2b-256 checksum
How to use checksums
f160a7e6747e1204434f43a98095cd97ea203741113aebf3e1fce1b63257de39
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.9 {"installer":{"name":"uv","version":"0.13.9","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}

Release files / fabricatio_anki-0.2.18-cp313-cp313-manylinux_2_34_x86_64.whl

Download URL fabricatio_anki-0.2.18-cp313-cp313-manylinux_2_34_x86_64.whl
Size 7.2 MB
Tags CPython 3.13 Linux glibc 2.34+ x86-64
SHA-256 checksum
How to use checksums
6d88e70ea85c1cc9d26f9b1eb8036a0ab4b0ad8905e9b2cc3940ca5b9d7f54c2
BLAKE2b-256 checksum
How to use checksums
f92d8622d0a2771d396398b3562ac2f3dda1b3dd04ddc86ebb71ea21a120fe9c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.9 {"installer":{"name":"uv","version":"0.13.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / fabricatio_anki-0.2.18-cp313-cp313-manylinux_2_34_aarch64.whl

Download URL fabricatio_anki-0.2.18-cp313-cp313-manylinux_2_34_aarch64.whl
Size 6.7 MB
Tags CPython 3.13 Linux glibc 2.34+ ARM64
SHA-256 checksum
How to use checksums
9a93df8b6958e61e41f00c37c4c602d1715b6cb1a4490c17f2ff52b9871039a5
BLAKE2b-256 checksum
How to use checksums
15b29395410378e77fce30a1161a645532cd1d583cecade95e51f3c6f099b8c6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.9 {"installer":{"name":"uv","version":"0.13.9","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}

Release files / fabricatio_anki-0.2.18-cp312-cp312-win_amd64.whl

Download URL fabricatio_anki-0.2.18-cp312-cp312-win_amd64.whl
Size 6.4 MB
Tags CPython 3.12 Windows x86-64
SHA-256 checksum
How to use checksums
ea3dccbb3db23db9873b51563d8558055605377e4c6dc3ce9a40253db5fbeb70
BLAKE2b-256 checksum
How to use checksums
d1b653553b3e6ae3d66da49ca9abfbf801b8cf5275256ea506796823c49a8db3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.9 {"installer":{"name":"uv","version":"0.13.9","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}

Release files / fabricatio_anki-0.2.18-cp312-cp312-manylinux_2_34_x86_64.whl

Download URL fabricatio_anki-0.2.18-cp312-cp312-manylinux_2_34_x86_64.whl
Size 7.2 MB
Tags CPython 3.12 Linux glibc 2.34+ x86-64
SHA-256 checksum
How to use checksums
5a858f72ed2f0103aef6216ca174373ff99cd572a0bca4eede9673c8be1b6c58
BLAKE2b-256 checksum
How to use checksums
9697706d44dcf66c3ec6cf2bfb82d69d7cdd5475fa5e72a9e59a316e9a951214
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.9 {"installer":{"name":"uv","version":"0.13.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / fabricatio_anki-0.2.18-cp312-cp312-manylinux_2_34_aarch64.whl

Download URL fabricatio_anki-0.2.18-cp312-cp312-manylinux_2_34_aarch64.whl
Size 6.7 MB
Tags CPython 3.12 Linux glibc 2.34+ ARM64
SHA-256 checksum
How to use checksums
c69bc6e9d4eea26a609fb86ce6a7e8310a4ec3693453be469e73699ee7b42f52
BLAKE2b-256 checksum
How to use checksums
6b1857913f5c85a662a27a5adcbe1a39f2c213b8735225fdf80a00de5ff908a4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.9 {"installer":{"name":"uv","version":"0.13.9","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}

Security for fabricatio-anki 0.2.18

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.2.18 This release

9 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page