Python API¶
Comprehensive guide to ebk's Python API for programmatic library management.
Overview¶
ebk provides a powerful SQLAlchemy-based API for working with ebook libraries programmatically. The API follows modern Python conventions and supports context managers, fluent queries, and async operations (for LLM features).
Basic Usage¶
Opening a Library¶
from pathlib import Path
from ebk.library_db import Library
# Open existing library
lib = Library.open(Path("~/my-library"))
# Use context manager (recommended)
with Library.open(Path("~/my-library")) as lib:
# Work with library
results = lib.search("Python")
# Library is automatically closed
See the API Guide for complete documentation.
Core Classes¶
Library- Main library classBook- Book model (SQLAlchemy ORM)Author- Author modelSubject- Subject/tag modelFile- File modelCover- Cover image model
Further Reading¶
- API Guide - Complete API reference
- LLM Features - AI-powered features
- CLI Reference - Command-line interface