From the collection

cquarry

No. 029

Python (stdlib only) · complete

A lightweight, canonical Python package providing read-only access to Calibre’s metadata.db and a full parser for Calibre’s search expression grammar.

This library powers CalibreQuarry (CLI/TUI), Hermitage (GTK4 Desktop Gallery), Bindery (EPUB repair tool), and Carrel-calibre-web (Web Reader) within the ecosystem, ensuring that Virtual Library definitions and search queries evaluate identically across all frontends.

It implements a recursive-descent parser that perfectly matches Calibre’s native search capabilities (exact matches, substring, boolean logic, date math, custom columns, identifiers, and nested virtual libraries), bypassing Calibre’s heavy Python initialization overhead.

← Return to the codex