Skip to main content
spacedr
=======

Spaced Repetition API
---------------------

Enhance your learning speed with **Spaced Repetition** technique. It uses increasing intervals of time between card reviews.

But now you have **API**. Create cards, organise them into decks, study and actually review.

*And there is no* ``session`` *object to pass it everywhere.*

Installation
------------

.. code-block:: bash

$ pip install spacedr

Usage
-----

At first, you need to import the module:

.. code-block:: python

>>> import spacedr

And initialise the database:

.. code-block:: python

>>> spacedr.db_init()

Create a deck
"""""""""""""

.. code-block:: python

>>> spacedr.create_deck(name='Test Deck', description='Just a test.')

Get a deck
""""""""""

You can get a **deck id from a card** *(which you get using* ``get_cards_to_review`` *or* ``get_cards_to_study`` *functions)*:

.. code-block:: python

>>> deck_id = card.deck_id

And then use this to get the ``deck`` object.

.. code-block:: python

>>> deck = spacedr.get_deck_by_id(deck_id)

Create a card
"""""""""""""

.. code-block:: python

>>> spacedr.create_card(deck,
... question='What is the meaning of life?',
... answers=[42, '42'])

Update a card
"""""""""""""

You have to update a card each time the user answers.

If answer is right, card's level will be increased, othervise decreased. And the card will be postponed accordingly.

.. code-block:: python

>>> spacedr.update_card(card, answer='43')

Get cards to study
""""""""""""""""""

You will get a number of cards *(limited by* ``num``*)*, that haven't been practiced, in the given deck.

.. code-block:: python

>>> spacedr.get_cards_to_study(deck, num=20)
[...]

Get cards to review
"""""""""""""""""""

You will get a number of cards, that need to be reviewed, in the given deck.

.. code-block:: python

>>> spacedr.get_cards_to_review(deck)
[...]

Edit a deck
"""""""""""

You have to pass ``name`` and ``description`` as keyword arguments:

.. code-block:: python

>>> spacedr.edit_deck(deck, name='test2', description='new one')

Edit a card
"""""""""""

You have to pass ``deck_id`` *(replace to an another deck)*, ``question`` and ``answers`` as keyword arguments:

.. code-block:: python

>>> spacedr.edit_card(card, deck_id=deck_id, question='What is life?',
... answers=[42])

Delete a deck
"""""""""""""

The cards assigned to given deck will be deleted too:

.. code-block:: python

>>> spacedr.delete_deck(deck)

Delete a card
"""""""""""""

.. code-block:: python

>>> spacedr.delete_card(card)

Export a deck
"""""""""""""

Export the deck from a file descriptor:

.. code-block:: python

>>> with open('mydeck.json', 'w') as file_d:
... spacedr.export_deck(deck, file_d)


Import a deck
"""""""""""""

Import the deck from a file descriptor:

.. code-block:: python

>>> with open('mydeck.json') as file_d:
... spacedr.import_deck(deck, file_d)

.. note::

The deck and the cards will be imported as new ones. The old won't be removed.

Metadata

Release files for spacedr 1.0.1

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

Source distribution (sdist)

Source distribution for spacedr 1.0.1
File Size Uploaded
spacedr-1.0.1.tar.gz 16.3 kB Details

Release files / spacedr-1.0.1.tar.gz

Download URL spacedr-1.0.1.tar.gz
Size 16.3 kB
Tags Source
SHA-256 checksum
How to use checksums
169a0bc123e942017c26c6b832b4adab505bd2c3c1c9f4309472d91e0aa8dbe6
BLAKE2b-256 checksum
How to use checksums
fdadc74f815c20e531226039ff630b6ac482e02ec39a56f58a0af073ada7b664
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.1 pkginfo/1.4.2 requests/2.20.0 setuptools/40.4.3 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.7.0

Release history Release notifications | RSS feed

This release

1.0.1 This release

1 release file

1.0

1 release file

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