Name | sm-2 JSON |
Version |
0.3.0
JSON |
| download |
home_page | None |
Summary | SM-2 spaced repetition scheduler |
upload_time | 2024-12-07 21:42:16 |
maintainer | None |
docs_url | None |
author | None |
requires_python | >=3.10 |
license | MIT License Copyright (c) 2024 Open Spaced Repetition Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
keywords |
sm-2
spaced-repetition
flashcard
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
<div align="center">
<img src="https://avatars.githubusercontent.com/u/96821265?s=200&v=4" height="100" alt="Open Spaced Repetition logo"/>
</div>
<div align="center">
# SM-2
</div>
<div align="center">
<em>🧠🔄 Build your own Spaced Repetition System in Python 🧠🔄</em>
</div>
<br />
<div align="center" style="text-decoration: none;">
<a href="https://pypi.org/project/sm-2/"><img src="https://img.shields.io/pypi/v/sm-2"></a>
<a href="https://github.com/open-spaced-repetition/sm-2/blob/main/LICENSE" style="text-decoration: none;"><img src="https://img.shields.io/badge/License-MIT-brightgreen.svg"></a>
</div>
<br />
<div align="left">
<strong>
Python package implementing the classic <a href="https://super-memory.com/english/ol/sm2.htm">SM-2</a> algorithm for spaced repetition scheduling.
</strong>
</div>
## Installation
You can install the sm-2 python package from [PyPI](https://pypi.org/project/sm-2/) using pip:
```
pip install sm-2
```
## Quickstart
Import and initialize the SM-2 scheduler
```python
from sm_2 import Scheduler, Card, ReviewLog
scheduler = Scheduler()
```
Create a new Card object
```python
card = Card()
```
Choose a rating and review the card
```python
"""
5 - perfect response
4 - correct response after a hesitation
3 - correct response recalled with serious difficulty
2 - incorrect response; where the correct one seemed easy to recall
1 - incorrect response; the correct one remembered
0 - complete blackout.
"""
rating = 5
card, review_log = scheduler.review_card(card, rating)
print(f"Card rated {review_log.rating} at {review_log.review_datetime}")
# > Card rated 5 at 2024-10-24 02:14:20.802958+00:00
```
See when the card is due next
```python
from datetime import datetime, timezone
due = card.due
# how much time between when the card is due and now
time_delta = due - datetime.now(timezone.utc)
print(f"Card due: at {repr(due)}")
print(f"Card due in {time_delta.seconds / 3600} hours")
# > Card due: at datetime.datetime(2024, 10, 25, 2, 14, 20, 799320, tzinfo=datetime.timezone.utc)
# > Card due in 23.99972222222222 hours
```
## Usage
### Timezone
SM-2 uses UTC only. You can still specify custom datetimes, but they must be UTC.
```python
from sm_2 import Scheduler, Card, ReviewLog
from datetime import datetime, timezone
scheduler = Scheduler()
# create a new due card on Jan. 1, 2024
card = Card(due=datetime(2024, 1, 1, 0, 0, 0, 0, timezone.utc)) # right
#card = Card(due=datetime(2024, 1, 1, 0, 0, 0, 0)) # wrong
# review the card on Jan. 2, 2024
card, review_log = scheduler.review_card(card=card, rating=Rating.Good, review_datetime=datetime(2024, 1, 2, 0, 0, 0, 0, timezone.utc)) # right
#card, review_log = scheduler.review_card(card=card, rating=Rating.Good, review_datetime=datetime(2024, 1, 2, 0, 0, 0, 0)) # wrong
```
### Serialization
`Card` and `ReviewLog` objects are json-serializable via their `to_dict` and `from_dict` methods for easy database storage:
```python
# serialize before storage
card_dict = card.to_dict()
review_log_dict = review_log.to_dict()
# deserialize from dict
card = Card.from_dict(card_dict)
review_log = ReviewLog.from_dict(review_log_dict)
```
## Versioning
This python package is currently unstable and adheres to the following versioning scheme:
- **Minor** version will increase when a backward-incompatible change is introduced.
- **Patch** version will increase when a bug is fixed or a new feature is added.
Once this package is considered stable, the **Major** version will be bumped to 1.0.0 and will follow [semver](https://semver.org/).
## Contribute
Checkout [CONTRIBUTING](https://github.com/open-spaced-repetition/sm-2/blob/main/CONTRIBUTING.md) to help improve sm-2!
Raw data
{
"_id": null,
"home_page": null,
"name": "sm-2",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.10",
"maintainer_email": null,
"keywords": "sm-2, spaced-repetition, flashcard",
"author": null,
"author_email": "Joshua Hamilton <hamiltonjoshuadavid@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/ac/2f/23951eb5d7fa300d2d614a86a432103ea947bf4d1ad4d67d3fd8c062fa83/sm_2-0.3.0.tar.gz",
"platform": null,
"description": "<div align=\"center\">\n <img src=\"https://avatars.githubusercontent.com/u/96821265?s=200&v=4\" height=\"100\" alt=\"Open Spaced Repetition logo\"/>\n</div>\n<div align=\"center\">\n\n# SM-2\n</div>\n\n<div align=\"center\">\n <em>\ud83e\udde0\ud83d\udd04 Build your own Spaced Repetition System in Python \ud83e\udde0\ud83d\udd04</em>\n</div>\n<br />\n<div align=\"center\" style=\"text-decoration: none;\">\n <a href=\"https://pypi.org/project/sm-2/\"><img src=\"https://img.shields.io/pypi/v/sm-2\"></a>\n <a href=\"https://github.com/open-spaced-repetition/sm-2/blob/main/LICENSE\" style=\"text-decoration: none;\"><img src=\"https://img.shields.io/badge/License-MIT-brightgreen.svg\"></a>\n</div>\n<br />\n\n<div align=\"left\">\n <strong>\n Python package implementing the classic <a href=\"https://super-memory.com/english/ol/sm2.htm\">SM-2</a> algorithm for spaced repetition scheduling.\n </strong>\n</div>\n\n\n## Installation\n\nYou can install the sm-2 python package from [PyPI](https://pypi.org/project/sm-2/) using pip:\n```\npip install sm-2\n```\n\n## Quickstart\n\nImport and initialize the SM-2 scheduler\n\n```python\nfrom sm_2 import Scheduler, Card, ReviewLog\n\nscheduler = Scheduler()\n```\n\nCreate a new Card object\n\n```python\ncard = Card()\n```\n\nChoose a rating and review the card\n\n```python\n\"\"\"\n5 - perfect response\n4 - correct response after a hesitation\n3 - correct response recalled with serious difficulty\n2 - incorrect response; where the correct one seemed easy to recall\n1 - incorrect response; the correct one remembered\n0 - complete blackout.\n\"\"\"\n\nrating = 5\n\ncard, review_log = scheduler.review_card(card, rating)\n\nprint(f\"Card rated {review_log.rating} at {review_log.review_datetime}\")\n# > Card rated 5 at 2024-10-24 02:14:20.802958+00:00\n```\n\nSee when the card is due next\n```python\nfrom datetime import datetime, timezone\n\ndue = card.due\n\n# how much time between when the card is due and now\ntime_delta = due - datetime.now(timezone.utc)\n\nprint(f\"Card due: at {repr(due)}\")\nprint(f\"Card due in {time_delta.seconds / 3600} hours\")\n# > Card due: at datetime.datetime(2024, 10, 25, 2, 14, 20, 799320, tzinfo=datetime.timezone.utc)\n# > Card due in 23.99972222222222 hours\n```\n\n## Usage\n\n### Timezone\n\nSM-2 uses UTC only. You can still specify custom datetimes, but they must be UTC.\n\n```python\nfrom sm_2 import Scheduler, Card, ReviewLog\nfrom datetime import datetime, timezone\n\nscheduler = Scheduler()\n\n# create a new due card on Jan. 1, 2024\ncard = Card(due=datetime(2024, 1, 1, 0, 0, 0, 0, timezone.utc)) # right\n#card = Card(due=datetime(2024, 1, 1, 0, 0, 0, 0)) # wrong\n\n# review the card on Jan. 2, 2024\ncard, review_log = scheduler.review_card(card=card, rating=Rating.Good, review_datetime=datetime(2024, 1, 2, 0, 0, 0, 0, timezone.utc)) # right\n#card, review_log = scheduler.review_card(card=card, rating=Rating.Good, review_datetime=datetime(2024, 1, 2, 0, 0, 0, 0)) # wrong\n```\n\n### Serialization\n\n`Card` and `ReviewLog` objects are json-serializable via their `to_dict` and `from_dict` methods for easy database storage:\n```python\n# serialize before storage\ncard_dict = card.to_dict()\nreview_log_dict = review_log.to_dict()\n\n# deserialize from dict\ncard = Card.from_dict(card_dict)\nreview_log = ReviewLog.from_dict(review_log_dict)\n```\n\n## Versioning\n\nThis python package is currently unstable and adheres to the following versioning scheme:\n\n- **Minor** version will increase when a backward-incompatible change is introduced.\n- **Patch** version will increase when a bug is fixed or a new feature is added.\n\nOnce this package is considered stable, the **Major** version will be bumped to 1.0.0 and will follow [semver](https://semver.org/).\n\n## Contribute\n\nCheckout [CONTRIBUTING](https://github.com/open-spaced-repetition/sm-2/blob/main/CONTRIBUTING.md) to help improve sm-2!\n",
"bugtrack_url": null,
"license": "MIT License Copyright (c) 2024 Open Spaced Repetition Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.",
"summary": "SM-2 spaced repetition scheduler",
"version": "0.3.0",
"project_urls": {
"homepage": "https://github.com/open-spaced-repetition/sm-2"
},
"split_keywords": [
"sm-2",
" spaced-repetition",
" flashcard"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "32dd746fa57b583019f337d5a9cc9f05d2c37e5c4ebd6e2f8f60fae8815fb7ce",
"md5": "5cc0ca778fa1d84af758b3715ffa2b25",
"sha256": "031864c89dad9c681786016ff616df1cdb6826f9a5b3ac98fcece95c424c4333"
},
"downloads": -1,
"filename": "sm_2-0.3.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "5cc0ca778fa1d84af758b3715ffa2b25",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.10",
"size": 6570,
"upload_time": "2024-12-07T21:42:15",
"upload_time_iso_8601": "2024-12-07T21:42:15.782453Z",
"url": "https://files.pythonhosted.org/packages/32/dd/746fa57b583019f337d5a9cc9f05d2c37e5c4ebd6e2f8f60fae8815fb7ce/sm_2-0.3.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "ac2f23951eb5d7fa300d2d614a86a432103ea947bf4d1ad4d67d3fd8c062fa83",
"md5": "43462b8e5458124e69da218a489f22eb",
"sha256": "35943918a81720b18ae90bde712b812429c6afe967d1d171462aa239baa46d50"
},
"downloads": -1,
"filename": "sm_2-0.3.0.tar.gz",
"has_sig": false,
"md5_digest": "43462b8e5458124e69da218a489f22eb",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.10",
"size": 6982,
"upload_time": "2024-12-07T21:42:16",
"upload_time_iso_8601": "2024-12-07T21:42:16.842567Z",
"url": "https://files.pythonhosted.org/packages/ac/2f/23951eb5d7fa300d2d614a86a432103ea947bf4d1ad4d67d3fd8c062fa83/sm_2-0.3.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-12-07 21:42:16",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "open-spaced-repetition",
"github_project": "sm-2",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "sm-2"
}