Metadata-Version: 2.4
Name: memodeck
Version: 0.1.0
Summary: A tiny spaced-repetition flashcard library with a command-line app.
Author-email: Vladislav Ainshtein <vladislav.ainshtein@gmail.com>
License-Expression: MIT
Project-URL: Homepage, https://github.com/Vladikasik/memodeck
Project-URL: Repository, https://github.com/Vladikasik/memodeck
Keywords: flashcards,spaced-repetition,leitner,cli
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Console
Classifier: Intended Audience :: Education
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Topic :: Education
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Dynamic: license-file

# 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](https://en.wikipedia.org/wiki/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

```bash
pip install memodeck
```

Or from source, in a virtual environment:

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

## The CLI

```bash
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:

```python
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

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

## License

MIT
