# simple-spaced-repetition
Simple spaced repetition scheduler, based on the [classic Anki algorithm](https://faqs.ankiweb.net/what-spaced-repetition-algorithm.html) and implemented in under 40 lines of code.
This scheduler is used at [Python.cards](https://python.cards).
[!Test status](https://github.com/vlopezferrando/simple-spaced-repetition/actions/workflows/python-package.yml/badge.svg)
[![Supported Versions](https://img.shields.io/pypi/pyversions/simple_spaced_repetition.svg)](https://pypi.org/project/simple_spaced_repetition)
## Installation
Install with pip:
pip install simple_spaced_repetition
## Example usage
The `Card` class is what you should use:
```python
>>> from simple_spaced_repetition import Card
>>> Card()
Card(status=learning, step=0, interval=None, ease=2.5)
```
`Card` has a single method `options()` which returns the 4 possible choices for answering a card:
```python
>>> from simple_spaced_repetition import Card
>>> card = Card()
>>> card.options()
[('again', Card(status=learning, step=0, interval=0:01:00, ease=2.5)),
('hard', Card(status=learning, step=1, interval=0:06:00, ease=2.5)),
('good', Card(status=learning, step=1, interval=0:10:00, ease=2.5)),
('easy', Card(status=reviewing, step=0, interval=4 days, 0:00:00, ease=2.5))]
```
Next to each answer is a new `Card` object that represents the card after answering with that option.
The attribute `interval` holds the time that must pass before the card is due again:
```python
>>> from simple_spaced_repetition import Card
>>> card = Card()
>>> for answer, new_card in card.options():
... print(answer, new_card.interval)
again 0:01:00
hard 0:06:00
good 0:10:00
easy 4 days, 0:00:00
```
## Run tests
Simply run:
python test_simple_spaced_repetition.py
Raw data
{
"_id": null,
"home_page": "https://github.com/vlopezferrando/simple-spaced-repetition",
"name": "simple-spaced-repetition",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "spaced repetition,anki",
"author": "V\u00edctor L\u00f3pez Ferrando",
"author_email": "victor@thediligentdeveloper.com",
"download_url": "https://files.pythonhosted.org/packages/58/b1/852482e7533f5f23dcff84eb8fd8a9e0ba27306783fc1829bc7e36818faf/simple_spaced_repetition-0.2.0.tar.gz",
"platform": null,
"description": "# simple-spaced-repetition\n\nSimple spaced repetition scheduler, based on the [classic Anki algorithm](https://faqs.ankiweb.net/what-spaced-repetition-algorithm.html) and implemented in under 40 lines of code.\n\nThis scheduler is used at [Python.cards](https://python.cards).\n\n[!Test status](https://github.com/vlopezferrando/simple-spaced-repetition/actions/workflows/python-package.yml/badge.svg)\n[![Supported Versions](https://img.shields.io/pypi/pyversions/simple_spaced_repetition.svg)](https://pypi.org/project/simple_spaced_repetition)\n\n## Installation\n\nInstall with pip:\n\n pip install simple_spaced_repetition\n\n## Example usage\n\nThe `Card` class is what you should use:\n\n```python\n>>> from simple_spaced_repetition import Card\n>>> Card()\nCard(status=learning, step=0, interval=None, ease=2.5)\n```\n\n`Card` has a single method `options()` which returns the 4 possible choices for answering a card:\n\n```python\n>>> from simple_spaced_repetition import Card\n>>> card = Card()\n>>> card.options()\n[('again', Card(status=learning, step=0, interval=0:01:00, ease=2.5)),\n ('hard', Card(status=learning, step=1, interval=0:06:00, ease=2.5)),\n ('good', Card(status=learning, step=1, interval=0:10:00, ease=2.5)),\n ('easy', Card(status=reviewing, step=0, interval=4 days, 0:00:00, ease=2.5))]\n```\n\nNext to each answer is a new `Card` object that represents the card after answering with that option.\n\nThe attribute `interval` holds the time that must pass before the card is due again:\n\n```python\n>>> from simple_spaced_repetition import Card\n>>> card = Card()\n>>> for answer, new_card in card.options():\n... print(answer, new_card.interval)\nagain 0:01:00\nhard 0:06:00\ngood 0:10:00\neasy 4 days, 0:00:00\n```\n\n## Run tests\n\nSimply run:\n\n python test_simple_spaced_repetition.py\n",
"bugtrack_url": null,
"license": "",
"summary": "Simple spaced repetition library",
"version": "0.2.0",
"project_urls": {
"Bug Reports": "https://github.com/vlopezferrando/simple-spaced-repetition/issues",
"Homepage": "https://github.com/vlopezferrando/simple-spaced-repetition",
"Source": "https://github.com/vlopezferrando/simple-spaced-repetition",
"Used at": "https://python.cards"
},
"split_keywords": [
"spaced repetition",
"anki"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "58b1852482e7533f5f23dcff84eb8fd8a9e0ba27306783fc1829bc7e36818faf",
"md5": "801161a7b7c6bc1886770e47e116698f",
"sha256": "4bb3cf9350c2e0268d565401d29e32cdee5e0b17ae97f642ea584b0afb945879"
},
"downloads": -1,
"filename": "simple_spaced_repetition-0.2.0.tar.gz",
"has_sig": false,
"md5_digest": "801161a7b7c6bc1886770e47e116698f",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 3235,
"upload_time": "2024-01-10T15:53:28",
"upload_time_iso_8601": "2024-01-10T15:53:28.311576Z",
"url": "https://files.pythonhosted.org/packages/58/b1/852482e7533f5f23dcff84eb8fd8a9e0ba27306783fc1829bc7e36818faf/simple_spaced_repetition-0.2.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-01-10 15:53:28",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "vlopezferrando",
"github_project": "simple-spaced-repetition",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "simple-spaced-repetition"
}