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.1.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.1-py3-none-any.whl (8.8 kB view details)

Uploaded Python 3

File details

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

File metadata

File hashes

Hashes for anki_kanji_deck_generator-0.1.1.tar.gz
Algorithm Hash digest
SHA256 410ac14b613d7968cab96aa7a7ebd9a5f40bd50f0625ee3316c93540fb567dce
MD5 eed84d9b76f489955c9ee3ae2a28b9e8
BLAKE2b-256 20ea988fa1f4757bb62b911699071681a5dd386f10d5c412797e8308c3894435

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for anki_kanji_deck_generator-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 cebab89be75eebd5a378366c94939fbf6061ba2377e234e4dcb714e22d0fe8d4
MD5 dd06655e370dbe3150f16ba06e0583d9
BLAKE2b-256 d73eff95b3b32a94e4ca55770f6decc56a4d5332d285b04ba425a06d7083db9e

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