Skip to main content

Generate Anki flashcard decks for JLPT Kanji with customizable templates

Project description

Anki Kanji Deck Generator

A Python package designed to generate Anki flashcard decks for JLPT and Kyōiku Kanji with highly customizable templates. This tool provides a clean API using the KanjiDeck class to fetch comprehensive data from the Kanjilive API and build structured Anki decks (.apkg files) using the genanki library.

🌟 Features

  • Flexible API: Easy-to-use KanjiDeck().generate_deck() method allows simple deck creation via code.
  • Dual Filtering Support: Generate decks based on:
    • JLPT Levels: N5, N4, N3, N2, N1.
    • Kyōiku Grades: Grade 1 through Grade 6.
  • Customizable Templates: Supports using custom HTML and CSS templates for unique card styling.
  • Simple Installation: Available directly via PyPI.

🛠️ Prerequisites

  • Python 3.11 or newer.

🚀 Installation

Install the package directly from PyPI using pip:

pip install anki-kanji-deck-generator

💡 Usage

The primary way to use this tool is by importing the KanjiDeck class and calling the generate_deck method with the desired parameters within a Python script.

Example: Generating All Decks

Create a Python file (e.g., generate_all.py) and include the following code to generate all JLPT and Kyōiku Grade decks:

from kanjideck_generator import KanjiDeck
# Initialize the deck generator
generator = KanjiDeck()

# --- Generate JLPT Decks (N5 to N1) ---
print("Generating JLPT decks...")
generator.generate_deck(level_type='jlpt', level='n5', output_filename='jlpt_n5_deck.apkg')
generator.generate_deck(level_type='jlpt', level='n4', output_filename='jlpt_n4_deck.apkg')
generator.generate_deck(level_type='jlpt', level='n3', output_filename='jlpt_n3_deck.apkg')
generator.generate_deck(level_type='jlpt', level='n2', output_filename='jlpt_n2_deck.apkg')
generator.generate_deck(level_type='jlpt', level='n1', output_filename='jlpt_n1_deck.apkg')

# --- Generate Kyōiku Grade Decks (Grade 1 to 6) ---
print("Generating Grade decks...")
generator.generate_deck(level_type='grade', level=1, output_filename='grade_1_deck.apkg')
generator.generate_deck(level_type='grade', level=2, output_filename='grade_2_deck.apkg')
generator.generate_deck(level_type='grade', level=3, output_filename='grade_3_deck.apkg')
generator.generate_deck(level_type='grade', level=4, output_filename='grade_4_deck.apkg')
generator.generate_deck(level_type='grade', level=5, output_filename='grade_5_deck.apkg')
generator.generate_deck(level_type='grade', level=6, output_filename='grade_6_deck.apkg')


### Running the Example

Execute the script using your Python interpreter:

```bash
python generate_all.py

Importing into Anki

Find the generated .apkg files in the directory where you ran the script, open your Anki application, and import them via FileImport.


📦 Key Dependencies

This package automatically installs the following core dependencies:

  • genanki: For programmatic generation of Anki decks.
  • requests: For fetching data from the Kanjilive API.
  • pandas: For data manipulation and structuring.
  • pydantic: For validating the fetched Kanji data schema.

🤝 Credits

This project relies on the following excellent tools and services:

  • Kanjilive API: The source for comprehensive Kanji data.
  • genanki: The library used for deck construction.

📄 License

This project is licensed under the MIT License.

Project details


Download files

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

Source Distribution

anki_kanji_deck_generator-0.1.2.tar.gz (6.4 kB view details)

Uploaded Source

Built Distribution

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

anki_kanji_deck_generator-0.1.2-py3-none-any.whl (8.8 kB view details)

Uploaded Python 3

File details

Details for the file anki_kanji_deck_generator-0.1.2.tar.gz.

File metadata

File hashes

Hashes for anki_kanji_deck_generator-0.1.2.tar.gz
Algorithm Hash digest
SHA256 c66a1c18019f1d3eb829b963998750d365016f37f801cb50b839d014d87419e5
MD5 8f3ea86e6d4d1414150d91aa92bd6492
BLAKE2b-256 58b19de5cbe203865931788332a977fbc92757e971bf180ce42fa99c981d0bd8

See more details on using hashes here.

File details

Details for the file anki_kanji_deck_generator-0.1.2-py3-none-any.whl.

File metadata

File hashes

Hashes for anki_kanji_deck_generator-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 2c0ffdb13916d496674edbdaea2b430fd7935ea261a9df7d4010b5b3d8a41afd
MD5 fde5010a529b65888cd0ece5f4f2948f
BLAKE2b-256 92d1cde8f6931b6ec3c5b83ce28eff5272ba61abe1de5bc7e66cc7da6e553674

See more details on using hashes here.

Supported by

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