The project is structured as follow:
ir/
contains the source code (Python + javascript)tests/
contains the test codedocs/
contains documentation
We use poetry
to manage project dependency.
First, install poetry following the instructions from https://python-poetry.org/docs/#installation . Then, install poetry-bumpversion plugin
poetry self add poetry-bumpversion
Then, install dependencies:
make install-deps
Poetry will automatically create a virtual environment and install the dependencies. To use the virtual environment, see https://python-poetry.org/docs/basic-usage/#using-your-virtual-environment
To iterate quickly on your changes, you should add the local repo to Anki as an add-on. The manual testing cycle then becomes: make code changes, restart Anki, and test your change.
Steps:
- Find where Anki stores its add-on: Open Anki > Tools > Add-ons > View Files.
- Then create a symlink from Anki's add-on directory to your "ir" directory.
For example:
- My Anki add-on directory is
$HOME/.local/share/Anki2/addons21
. - My local incremental reading workspace is
$HOME/workplace/incremental-reading
. - Then to add my local workspace as an Anki add-on, I'd run
ln -s $HOME/workplace/incremental-reading/ir $HOME/.local/share/Anki2/addons21/ir
- My Anki add-on directory is
- Restart Anki.
- Create a "Test" profile to test your changes, for your own safety.
- Then run Anki from terminal. This will show stdout, which is useful for debugging.
# On Ubuntu /usr/local/bin/anki -p Test # On Mac /Applications/Anki.app/Contents/MacOS/anki -p Test
make test
- Update the version
poetry version patch|minor|major
- Build the
release/incremental-reading-v{version}.zip
file:make release
- Test the zip file in Anki
- Disable current IR add-on: Open Anki > Tools > Add-ons > Select current IR add-on > Toggle Enabled.
- Add the zipped add-on: In Add-ons page > Install from file... > Pick the zip file from earlier.
- Restart Anki to test.
- After finish testing, disable the local add-on and re-enable the public add-on.
- Upload to https://ankiweb.net/shared/addons/ .