Skip to main content

Python utilities for creating Anki flashcards. Designed for AI agent integration.

Project description

anki-utils

Python utilities for creating Anki flashcards. Designed for AI agent integration.

Install

pip install anki-utils

Features

  • Card Generation: Create .apkg files for 6 card types (Front-Back, Concept, Cloze, Image, Person, Image Occlusion)
  • Theme System: 4 built-in themes (minimal, classic, high-contrast, calm)
  • Markdown Support: Convert markdown formatting to Anki-compatible HTML
  • Input Validation: Clear error messages for invalid card data
  • Image Occlusion: OCR-based automatic region detection
  • Preview Assets: React components for card preview
  • Agent-Friendly: CLI commands for querying roadmap and changelog

Quick Start

# Generate .apkg from JSON
echo '{"deck_name": "Test", "cards": [...]}' | anki-utils export-apkg --output deck.apkg

# Resolve relative media paths (image_path/photo_path) against a base directory
echo '{"deck_name": "Test", "cards": [...]}' | anki-utils export-apkg --output deck.apkg --base-path /path/to/project

# List available themes
anki-utils themes --list

# Get preview template
anki-utils asset preview-template

# Detect occlusion regions in an image
anki-utils occlusion-detect image.jpg --json

For AI Agents

See AGENTS.md for complete context on working with this codebase.

anki-utils roadmap                    # Full roadmap
anki-utils changelog --latest         # Most recent changes

Development

# Clone and install in dev mode
git clone https://github.com/Gilbetrar/anki-package.git
cd anki-package
pip install -e ".[dev]"

# Run tests
pytest -v

# Run with coverage
pytest --cov=anki_utils

Repository Structure

anki-package/
├── AGENTS.md            # Context for AI coding agents
├── anki_utils/          # Published PyPI package
│   ├── exporter.py      # Core .apkg generation
│   ├── markdown.py      # Markdown to HTML conversion
│   ├── themes.py        # CSS theme definitions
│   ├── occlusion.py     # Image occlusion detection
│   ├── cli.py           # Command-line interface
│   ├── ROADMAP.md       # Development roadmap
│   └── CHANGELOG.md     # Version history
├── tests/               # Test suite (pytest)
└── .github/workflows/   # CI/CD (runs tests on push/PR)

License

MIT

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_utils-0.2.7.tar.gz (345.0 kB view details)

Uploaded Source

Built Distribution

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

anki_utils-0.2.7-py3-none-any.whl (67.2 kB view details)

Uploaded Python 3

File details

Details for the file anki_utils-0.2.7.tar.gz.

File metadata

  • Download URL: anki_utils-0.2.7.tar.gz
  • Upload date:
  • Size: 345.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for anki_utils-0.2.7.tar.gz
Algorithm Hash digest
SHA256 47039674024f426b56a0c328c1ad1ae676629a827555cd955ac9f2e0c6f68358
MD5 78aa166a69b7b86464d5296d31faa9a5
BLAKE2b-256 6c9416905542ca9e43e36fb74f104dd1faa3ae9bba1b40a11f6677781de6d5a3

See more details on using hashes here.

Provenance

The following attestation bundles were made for anki_utils-0.2.7.tar.gz:

Publisher: publish.yml on Gilbetrar/anki-package

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file anki_utils-0.2.7-py3-none-any.whl.

File metadata

  • Download URL: anki_utils-0.2.7-py3-none-any.whl
  • Upload date:
  • Size: 67.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for anki_utils-0.2.7-py3-none-any.whl
Algorithm Hash digest
SHA256 0310e6d1dcf98da01a44cd48af0e2a17ed2f44a1b4f8b10869e736e7ebb9e2ac
MD5 45a24fb29188c69c5526c458477c34c3
BLAKE2b-256 e0b31c2dfb1e7633ba7b9cac84cb087d992afc0d75d5eb022f37c0ae4bf93e51

See more details on using hashes here.

Provenance

The following attestation bundles were made for anki_utils-0.2.7-py3-none-any.whl:

Publisher: publish.yml on Gilbetrar/anki-package

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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