Skip to main content

memodeck

A tiny spaced-repetition flashcard library with a command-line app. Pure standard library — zero runtime dependencies.

On PyPI: https://pypi.org/project/memodeck/ · Source: https://github.com/Vladikasik/memodeck

Cards live in decks, decks live in a SQLite database, and every review is logged. A simple 3-box Leitner system decides when a card is due again: answer correctly and it moves up a box (waiting 1, then 3 days), answer wrong and it drops back to box 1.

Install

pip install memodeck

Or from source, in a virtual environment:

python -m venv .venv && source .venv/bin/activate
pip install -e .
pip install -r requirements.txt   # dev tools: pytest, build, twine

The CLI

memodeck import examples/capitals.json   # sample deck from the source repo
memodeck decks                           # list decks
memodeck list capitals                   # show cards and their boxes
memodeck study capitals                  # review whatever is due
memodeck stats capitals                  # per-card accuracy
memodeck add capitals                    # add a card interactively
memodeck export capitals backup.json     # write a deck to JSON

The database defaults to ~/.memodeck.db; use --db path to keep it elsewhere.

The library

The CLI is just one consumer — everything it does is available as an API:

from memodeck import BasicCard, ClozeCard, Deck, DeckStore

deck = Deck("chemistry", [
    BasicCard("Symbol for gold?", "Au"),
    ClozeCard("Water is H2{{O}}."),
])

for card in deck.due():                  # polymorphism: any card type works
    print(card.question)
    if not card.check(input("> ")):
        print(f"Answer: {card.answer}")

with DeckStore("chem.db") as store:      # SQLite persistence
    store.save(deck)

Card types are subclasses of the Card ABC. Each one defines three members — question, answer, and check(response) — and registers itself for JSON deserialization automatically, so adding a new card type touches exactly one file:

Type Written as Checks
BasicCard front / back case-insensitive text match
ClozeCard "Water boils at {{100}} degrees" the hidden blank
MultipleChoiceCard prompt + choices + answer index letter or full text

Project layout

src/memodeck/
├── cards.py     # Card ABC + the three card types (inheritance, polymorphism)
├── deck.py      # Deck collection (dunder protocols: len/iter/contains)
├── storage.py   # DeckStore (SQLite) + JSON import/export (serialization)
└── cli.py       # argparse front-end over the library
tests/           # pytest suite, written test-first

Development

python -m pytest          # run the tests
python -m build           # build sdist + wheel into dist/
twine upload dist/*       # publish to PyPI

License

MIT

Metadata

Release files for memodeck 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for memodeck 0.1.0
File Size Uploaded
memodeck-0.1.0.tar.gz 14.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for memodeck 0.1.0
File Interpreter ABI Platform
memodeck-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 25.9 kB

Release files / memodeck-0.1.0.tar.gz

Download URL memodeck-0.1.0.tar.gz
Size 14.8 kB
Tags Source
SHA-256 checksum
How to use checksums
52eb142f13bcaf86178a7e87511788ac91baba140b702aae7cc8aad91f499e42
BLAKE2b-256 checksum
How to use checksums
96d6f566bc694678fd73eaf97a2d91f83484beacc93320fde9cc9f7aa1c83d04
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.10.13

Release files / memodeck-0.1.0-py3-none-any.whl

Download URL memodeck-0.1.0-py3-none-any.whl
Size 11.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
fd8968db7a8286b2d14f59afadb97fcb27c3aaac5f43dbaa12c2f8ba75bfc66d
BLAKE2b-256 checksum
How to use checksums
a07377bd8be6a87f3df9abb0dd0d37c867e9795042f55cf571bf56a135aafbca
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.10.13

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page