Skip to main content

Generate Anki notes with LLMs.

Project description

Anknote

Anknote 📝✨

Build Status

Anknote is a powerful command-line tool that intelligently generates Anki flashcards from your markdown notes using state-of-the-art AI models.

Stop manually creating flashcards and let Anknote help you focus on what truly matters: learning and retaining knowledge efficiently.

Overview

Anknote processes your markdown files (either a single file or an entire directory structure) and leverages AI to identify key concepts, important information, and insightful questions. It then transforms these into a structured format ready for import into Anki, your favorite spaced repetition software.

The tool is designed to create flashcards that emphasize understanding and intuition rather than rote memorization of simple facts or definitions.

Features

  • AI-Powered Card Generation: Uses language models via LiteLLM (e.g., Gemini, GPT) to create high-quality flashcards.
  • Markdown Input: Accepts individual .md files or recursively scans directories for notes.
  • Anki-Compatible Output: Generates .tsv files that can be directly imported into Anki.
  • Customizable AI Model: Easily switch between different AI models supported by LiteLLM.
  • Selective Processing: Avoids re-processing notes for which flashcards already exist (unless forced).
  • In-Place Output: Option to save generated flashcards alongside your original notes.
  • Progress Tracking: Clear progress bar during the generation process.
  • Focus on Conceptual Understanding: Prompts are designed to extract non-trivial ideas and conceptual links.

How It Works

  1. Input: You provide a path to a markdown file or a directory containing markdown files.
  2. Parsing & Retrieval: Anknote reads your notes. If a directory is provided, it recursively finds all .md files.
  3. AI Processing: For each note, the content is sent to the configured AI model with a specialized prompt. This prompt guides the AI to extract key information and formulate question/answer pairs suitable for flashcards.
  4. Formatting: The AI's response is parsed into a list of distinct flashcards.
  5. Output: The generated flashcards are saved as .tsv files (tab-separated values), with each line representing a card (prompt and answer). The output directory structure mirrors the input structure. ======= Generate Anki notes with LLMs.

Installation

pip install anknote

Development

This project uses uv for dependency management.

# Install dependencies
uv sync --extra test --extra lint --extra docs

# Run tests
uv run pytest

# Run linting
uv run pre-commit run --all-files

Automatic Versioning and Publishing

This project uses automated versioning and publishing to PyPI based on Conventional Commits.

How it works

  1. Commit Format: Use conventional commit messages:

    • feat: for new features (minor version bump)
    • fix: for bug fixes (patch version bump)
    • feat!: or fix!: for breaking changes (major version bump)
    • docs:, style:, refactor:, test:, chore: for other changes (no version bump)
  2. Automatic Release: When you push to the main branch:

    • The system analyzes commit messages since the last release
    • Automatically determines the next version number
    • Creates a GitHub release with changelog
    • Publishes the package to PyPI

Commit Message Examples

# Patch release (0.1.0 → 0.1.1)
git commit -m "fix: resolve authentication issue"

# Minor release (0.1.0 → 0.2.0)
git commit -m "feat: add new export functionality"

# Major release (0.1.0 → 1.0.0)
git commit -m "feat!: redesign API with breaking changes"

# No release
git commit -m "docs: update README"
git commit -m "test: add unit tests for auth module"

Setting up the commit message template

To use the provided commit message template:

git config commit.template .gitmessage

Manual Release

You can also trigger a release manually from the GitHub Actions tab using the "Release" workflow.

PyPI Publishing Setup

The package is automatically published to PyPI using GitHub's trusted publishing feature. No API tokens are required.

First-time setup on PyPI:

  1. Go to PyPI and create an account
  2. Create a new project named anknote
  3. Go to the project settings and add a "Trusted Publisher"
  4. Configure it with:
    • Repository: your-username/anknote
    • Workflow: release.yaml
    • Environment: pypi

License

This project is licensed under the MIT License - see the LICENSE file for details.

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

anknote-0.1.1.tar.gz (90.5 kB view details)

Uploaded Source

Built Distribution

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

anknote-0.1.1-py3-none-any.whl (14.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: anknote-0.1.1.tar.gz
  • Upload date:
  • Size: 90.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for anknote-0.1.1.tar.gz
Algorithm Hash digest
SHA256 8a3a1101548f1c2b6e9b28932f0c27fc0172181fa26ea9a65717cfcaaa47fd1c
MD5 674ab2267a6cde74b819357e737d0883
BLAKE2b-256 75c6907566b82907b8823d1ad5f9fba2a733abd3ea3f81f69c561d0ceeaf2637

See more details on using hashes here.

File details

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

File metadata

  • Download URL: anknote-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 14.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for anknote-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 8c3d7babf8d7905a74642783809b1fd1502ee42e6bfb4f33d1a79d38303f7dc6
MD5 16b237f1e0aaf48015560f17c1350cfa
BLAKE2b-256 75f534349d9a454dd944d2e867586432eb430b489fff734b4de48296488bec80

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