Skip to main content

New file format for Anki with improved review intervals and Peewee SQLite powered

Project description

Ankix

PyPI version shields.io PyPI license

New file format for Anki with improved review intervals. Pure peewee SQLite database, no zipfile. Available to work with on Jupyter Notebook.

Usage

On Jupyter Notebook,

>>> from ankix import ankix, db as a
>>> ankix.init('test.ankix')  # A file named 'test.ankix' will be created.
>>> ankix.import_apkg('foo.apkg')  # Import the contents from 'foo.apkg'
>>> iter_quiz = a.iter_quiz()
>>> card = next(iter_quiz)
>>> card
'A flashcard is show on Jupyter Notebook. You can click to change card side, to answer-side.'
'It is HTML, CSS, Javascript, Image enabled. Cloze test is also enabled. Audio is not yet tested.'
>>> card.right()  # Mark the card as right
>>> card.wrong()  # Mark the card as wrong
>>> card.mark()  # Add the tag 'marked' to the note.

You can directly make use of Peewee capabilities,

 >>> a.Card.select().join(a.Note).where(a.Note.data['field_a'] == 'bar')[0]
 'The front side of the card is shown.'

Adding new cards

Adding new cards is now possible. This has been tested in https://github.com/patarapolw/zhlib/blob/master/zhlib/export.py#L15

from ankix import ankix, db as a
ankix.init('test.ankix')
a_model = a.Model.add(
    name='foo',
    templates=[
        a.TemplateMaker(
            name='Forward', 
            question=Q_FORMAT,
            answer=A_FORMAT
        ),
        a.TemplateMaker(
            name='Reverse', 
            question=Q_FORMAT,
            answer=A_FORMAT)
    ],
    css=CSS,
    js=JS
)
# Or, a_model = a.Model.get(name='foo')
for record in records:
    a.Note.add(
        data=record,
        model=a_model,
        card_to_decks={
            'Forward': 'Forward deck',
            'Reverse': 'Reverse deck'
        },
        tags=['bar', 'baz']
    )

Installation

$ pip install ankix

Plans

  • Test by using it a lot.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ankix-0.2.0.1.tar.gz (11.2 kB view details)

Uploaded Source

Built Distribution

ankix-0.2.0.1-py2.py3-none-any.whl (36.3 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file ankix-0.2.0.1.tar.gz.

File metadata

  • Download URL: ankix-0.2.0.1.tar.gz
  • Upload date:
  • Size: 11.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/0.11.5 CPython/3.7.0 Darwin/17.7.0

File hashes

Hashes for ankix-0.2.0.1.tar.gz
Algorithm Hash digest
SHA256 006a71fc3e65f4f743f6834070a8832f264356c38451a2679ad732dfd3c90a43
MD5 07079a76c8331ea7e4c5811f7bb879b3
BLAKE2b-256 a38272828e6fa09f5d98f8c148fbd17e7476763ea5f570fb0a83e99849555bdd

See more details on using hashes here.

File details

Details for the file ankix-0.2.0.1-py2.py3-none-any.whl.

File metadata

  • Download URL: ankix-0.2.0.1-py2.py3-none-any.whl
  • Upload date:
  • Size: 36.3 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/0.11.5 CPython/3.7.0 Darwin/17.7.0

File hashes

Hashes for ankix-0.2.0.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 aaff0191160481e6d6b4c279418d8e5d95e95a159f1f511294673b25edb4d661
MD5 6fab395b035497f17d70d47e5c470bf8
BLAKE2b-256 3a73dcdb892ae584277326452f804201595e09ebf8ed61fc8e3fc6abbbe78d7f

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page