tetrak_ocr.registry

Resolve a backend by name.

Every backend exposes the same callable — ocr_image(path) -> str — so the rest of the package can treat them interchangeably. This module is where a name becomes one of those callables, and where a missing optional dependency turns into an error that says which extra to install.

Importing a backend module is always safe: each one records whether its heavy dependency imported successfully in _IMPORT_OK rather than failing at import time. That matters because available() needs to inspect every backend, including the ones this machine cannot run.

Functions

available()

Every backend whose dependencies are installed here.

get_backend(name)

Return the ocr_image callable for name.

is_available(name)

True when name can actually run on this machine.

supported_extensions(name)

File extensions name accepts, from the backend's own declaration.