A tiny spaced-repetition flashcard library with a command-line app.
Project description
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
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 memodeck-0.1.0.tar.gz.
File metadata
- Download URL: memodeck-0.1.0.tar.gz
- Upload date:
- Size: 14.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
52eb142f13bcaf86178a7e87511788ac91baba140b702aae7cc8aad91f499e42
|
|
| MD5 |
6d030d78831032d8230445239da70dd1
|
|
| BLAKE2b-256 |
96d6f566bc694678fd73eaf97a2d91f83484beacc93320fde9cc9f7aa1c83d04
|
File details
Details for the file memodeck-0.1.0-py3-none-any.whl.
File metadata
- Download URL: memodeck-0.1.0-py3-none-any.whl
- Upload date:
- Size: 11.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fd8968db7a8286b2d14f59afadb97fcb27c3aaac5f43dbaa12c2f8ba75bfc66d
|
|
| MD5 |
9905113b91daafda91c4b16b1d0d034c
|
|
| BLAKE2b-256 |
a07377bd8be6a87f3df9abb0dd0d37c867e9795042f55cf571bf56a135aafbca
|