An install that looks after itself
An install that looks after itself. Three items cut from v0.8.0 so the name
could be claimed, plus one gap a reader found in the code.
A missing spaCy model is offered, not just reported
A fresh pip install tango-anki got as far as fetching the transcript and
then stopped with "spaCy model not found. Run: ...". The message was correct
and the timing was not: the work was already spent, and the user was sent
away to run a second command before seeing anything work at all.
The check now runs before the transcript is fetched, where it costs nothing,
and on a terminal it offers to do the download:
[warn] The spaCy model for 'ca' (ca_core_news_sm) is not installed.
[info] It is a one-off download of a few tens of MB.
Download ca_core_news_sm now? [Y/n]:
Answering yes installs it and the run carries straight on. Answering no, or
running with the output piped, prints tango install-model <lang> and exits
1 rather than prompting into something that cannot answer.
The dictionary index is deliberately still manual. It is a
several-hundred-MB download per language, which is not something to start
without being asked.
tango uninstall
pip uninstall tango-anki removes about 130 KB of Python and leaves
everything that takes space. Measured on the development machine: 1.1 GB of
dictionary indexes, 82 MB of packages, 46 MB of cached audio, a 4.9 MB
definition cache. pip only owns what it installed, so nothing else could
offer to remove the rest.
1.1 GB Dictionary and antonym indexes
rebuild with 'tango build-dictionary <lang>'
80.8 MB Generated .apkg packages
your decks, if you have not imported them yet
4.9 MB Definition cache and run history
expensive to rebuild: it is every definition ever fetched
--dry-run reports and stops. --yes skips the prompt. Piped with no
--yes it reports and deletes nothing, because the alternative is a script
silently destroying a cache that took hours of API calls to build. The paths
come from your config, so a redirected DICT_DIR or DB_PATH is reported
rather than the defaults.
A Dockerfile
docker build -t tango .
docker run --rm -v "$PWD/out:/data/output" tango run <id> --deck "French"663 MB, English model baked in, all state in a /data volume, non-root so
the files it writes are deletable by the host user. Built and run before
release rather than written and hoped for.
Something else on port 8765
AnkiConnect answers on 8765 and nothing guarantees AnkiConnect is what is
there. A different service on that port, or a stale ANKI_HOST, got as far
as a successful HTTP request and then died on response.json() with
"Expecting value: line 1 column 1 (char 0)".
Three shapes are now typed errors naming the address, the port and
ANKI_HOST: an answer that is not JSON, an HTTP error status, and JSON with
no result field. Deliberately not "Anki is not running", because the port
answered, so that is the one cause already ruled out.
Found by a reader looking at the code, not by a failure.
Upgrading
pip install --upgrade tango-ankiNothing to do to your collection. The notetype is unchanged.
Full detail in CHANGELOG.md.