Generate Anki notes with LLMs.
Project description
Anknote
Anknote 📝✨
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
.mdfiles or recursively scans directories for notes. - Anki-Compatible Output: Generates
.tsvfiles 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
- Input: You provide a path to a markdown file or a directory containing markdown files.
- Parsing & Retrieval: Anknote reads your notes. If a directory is provided, it recursively finds all
.mdfiles. - 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.
- Formatting: The AI's response is parsed into a list of distinct flashcards.
- Output: The generated flashcards are saved as
.tsvfiles (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
-
Commit Format: Use conventional commit messages:
feat:for new features (minor version bump)fix:for bug fixes (patch version bump)feat!:orfix!:for breaking changes (major version bump)docs:,style:,refactor:,test:,chore:for other changes (no version bump)
-
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:
- Go to PyPI and create an account
- Create a new project named
anknote - Go to the project settings and add a "Trusted Publisher"
- Configure it with:
- Repository:
your-username/anknote - Workflow:
release.yaml - Environment:
pypi
- Repository:
License
This project is licensed under the MIT License - see the LICENSE file for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8a3a1101548f1c2b6e9b28932f0c27fc0172181fa26ea9a65717cfcaaa47fd1c
|
|
| MD5 |
674ab2267a6cde74b819357e737d0883
|
|
| BLAKE2b-256 |
75c6907566b82907b8823d1ad5f9fba2a733abd3ea3f81f69c561d0ceeaf2637
|
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8c3d7babf8d7905a74642783809b1fd1502ee42e6bfb4f33d1a79d38303f7dc6
|
|
| MD5 |
16b237f1e0aaf48015560f17c1350cfa
|
|
| BLAKE2b-256 |
75f534349d9a454dd944d2e867586432eb430b489fff734b4de48296488bec80
|